mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-17 17:32:36 +01:00
version is outdated errors tweaked a bit
This commit is contained in:
@@ -245,15 +245,14 @@ public class mcMMO extends JavaPlugin {
|
||||
if (serverAPIOutdated) {
|
||||
foliaLib.getScheduler().runTimer(
|
||||
() -> getLogger().severe(
|
||||
"You are running an outdated version of "
|
||||
+ platformManager.getServerSoftware()
|
||||
"You are potentially running an outdated version of your server software"
|
||||
+ ", mcMMO will not work unless you update to a newer version!"),
|
||||
20, 20 * 60 * 30);
|
||||
|
||||
if (platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT) {
|
||||
if (!getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 20, 4)) {
|
||||
foliaLib.getScheduler().runTimer(
|
||||
() -> getLogger().severe(
|
||||
"We have detected you are using incompatible server software, our best guess is that you are using CraftBukkit. mcMMO requires Spigot or Paper, if you are not using CraftBukkit, you will still need to update your custom server software before mcMMO will work."),
|
||||
"This version of mcMMO requires at least Minecraft 1.20.4 to"
|
||||
+ " function properly, please update your software or use an older version of mcMMO!"),
|
||||
20, 20 * 60 * 30);
|
||||
}
|
||||
} else {
|
||||
@@ -359,10 +358,7 @@ public class mcMMO extends JavaPlugin {
|
||||
entityDamageEvent.getMethod("getDamageSource");
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
serverAPIOutdated = true;
|
||||
String software = platformManager.getServerSoftwareStr();
|
||||
getLogger().severe(
|
||||
"You are running an older version of " + software
|
||||
+ " that is not compatible with mcMMO, update your server software!");
|
||||
getLogger().severe("Your server software is missing APIs that mcMMO requires to function properly, please update your server software!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PlatformBuilder {
|
||||
private MinecraftGameVersion minecraftGameVersion;
|
||||
private ServerSoftwareType serverSoftwareType;
|
||||
|
||||
public PlatformBuilder() {
|
||||
|
||||
@@ -21,19 +20,8 @@ public class PlatformBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlatformBuilder setSoftwareType(@NotNull ServerSoftwareType softwareType) {
|
||||
this.serverSoftwareType = softwareType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public @Nullable Platform build() {
|
||||
return switch (serverSoftwareType) {
|
||||
case PAPER, SPIGOT, CRAFT_BUKKIT -> createBukkitPlatform();
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private BukkitPlatform createBukkitPlatform() {
|
||||
return new BukkitPlatform(minecraftGameVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,13 +30,11 @@ public class PlatformManager {
|
||||
}
|
||||
|
||||
private @Nullable Platform loadPlatform() {
|
||||
ServerSoftwareType serverSoftwareType = determinePlatformType();
|
||||
PlatformBuilder platformBuilder = new PlatformBuilder();
|
||||
MinecraftGameVersion gameVersion = determineGameVersion(Bukkit.getBukkitVersion());
|
||||
|
||||
return platformBuilder
|
||||
.setMinecraftGameVersion(gameVersion)
|
||||
.setSoftwareType(serverSoftwareType)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -68,29 +66,6 @@ public class PlatformManager {
|
||||
return new MinecraftGameVersion(major, minor, patch);
|
||||
}
|
||||
|
||||
//TODO: Rewrite this properly once we actually support a not-bukkit platform
|
||||
private @NotNull ServerSoftwareType determinePlatformType() {
|
||||
if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("paper")) {
|
||||
return ServerSoftwareType.PAPER;
|
||||
} else if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("spigot")) {
|
||||
return ServerSoftwareType.SPIGOT;
|
||||
} else {
|
||||
return ServerSoftwareType.CRAFT_BUKKIT;
|
||||
}
|
||||
}
|
||||
|
||||
public ServerSoftwareType getServerSoftware() {
|
||||
return platform.getServerSoftwareType();
|
||||
}
|
||||
|
||||
public String getServerSoftwareStr() {
|
||||
return switch (getServerSoftware()) {
|
||||
case PAPER -> "Paper";
|
||||
case SPIGOT -> "Spigot";
|
||||
default -> "CraftBukkit";
|
||||
};
|
||||
}
|
||||
|
||||
public @Nullable CompatibilityManager getCompatibilityManager() {
|
||||
return platform.getCompatibilityManager();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user