1
0
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:
nossr50
2026-01-31 11:40:11 -08:00
parent 95026e6016
commit 1b8897b8ab
3 changed files with 6 additions and 47 deletions

View File

@@ -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!");
}
}

View File

@@ -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);
}
}

View File

@@ -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();
}