mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-01-03 22:08:28 +00:00
Add more specific platform support messages
This commit is contained in:
parent
a4f580e319
commit
c12a031918
4 changed files with 67 additions and 7 deletions
|
@ -214,8 +214,16 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
|||
|
||||
Console.setInstance(this);
|
||||
|
||||
if (!VersionUtil.isServerSupported()) {
|
||||
getLogger().severe(tl("serverUnsupported"));
|
||||
switch (VersionUtil.getServerSupportStatus()) {
|
||||
case UNSTABLE:
|
||||
getLogger().severe(tl("serverUnsupportedMods"));
|
||||
break;
|
||||
case OUTDATED:
|
||||
getLogger().severe(tl("serverUnsupported"));
|
||||
break;
|
||||
case LIMITED:
|
||||
getLogger().info(tl("serverUnsupportedLimitedApi"));
|
||||
break;
|
||||
}
|
||||
|
||||
final PluginManager pm = getServer().getPluginManager();
|
||||
|
|
|
@ -314,11 +314,20 @@ public class Commandessentials extends EssentialsCommand {
|
|||
boolean isMismatched = false;
|
||||
boolean isVaultInstalled = false;
|
||||
boolean isUnsupported = false;
|
||||
final boolean isServerSupported = VersionUtil.isServerSupported();
|
||||
final VersionUtil.SupportStatus supportStatus = VersionUtil.getServerSupportStatus();
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
final String essVer = pm.getPlugin("Essentials").getDescription().getVersion();
|
||||
|
||||
sender.sendMessage(tl(isServerSupported ? "versionOutputFine" : "versionOutputWarn", "Server", server.getBukkitVersion() + " " + server.getVersion()));
|
||||
final String serverMessageKey;
|
||||
if (supportStatus.isSupported()) {
|
||||
serverMessageKey = "versionOutputFine";
|
||||
} else if (supportStatus == VersionUtil.SupportStatus.UNSTABLE) {
|
||||
serverMessageKey = "versionOutputUnsupported";
|
||||
} else {
|
||||
serverMessageKey = "versionOutputWarn";
|
||||
}
|
||||
|
||||
sender.sendMessage(tl(serverMessageKey, "Server", server.getBukkitVersion() + " " + server.getVersion()));
|
||||
sender.sendMessage(tl("versionOutputFine", "EssentialsX", essVer));
|
||||
|
||||
for (final Plugin plugin : pm.getPlugins()) {
|
||||
|
@ -366,8 +375,16 @@ public class Commandessentials extends EssentialsCommand {
|
|||
sender.sendMessage(tl("versionOutputUnsupportedPlugins"));
|
||||
}
|
||||
|
||||
if (!VersionUtil.isServerSupported()) {
|
||||
sender.sendMessage(tl("serverUnsupported"));
|
||||
switch (supportStatus) {
|
||||
case UNSTABLE:
|
||||
sender.sendMessage(tl("serverUnsupportedMods"));
|
||||
break;
|
||||
case OUTDATED:
|
||||
sender.sendMessage(tl("serverUnsupported"));
|
||||
break;
|
||||
case LIMITED:
|
||||
sender.sendMessage(tl("serverUnsupportedLimitedApi"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.utils;
|
|||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -44,8 +45,22 @@ public final class VersionUtil {
|
|||
return serverVersion;
|
||||
}
|
||||
|
||||
public static SupportStatus getServerSupportStatus() {
|
||||
try {
|
||||
Class.forName("net.minecraftforge.common.MinecraftForge");
|
||||
return SupportStatus.UNSTABLE;
|
||||
} catch (final ClassNotFoundException ignored) {
|
||||
}
|
||||
|
||||
if (!supportedVersions.contains(getServerBukkitVersion())) {
|
||||
return SupportStatus.OUTDATED;
|
||||
}
|
||||
|
||||
return PaperLib.isPaper() ? SupportStatus.FULL : SupportStatus.LIMITED;
|
||||
}
|
||||
|
||||
public static boolean isServerSupported() {
|
||||
return supportedVersions.contains(getServerBukkitVersion());
|
||||
return getServerSupportStatus().isSupported();
|
||||
}
|
||||
|
||||
public static final class BukkitVersion implements Comparable<BukkitVersion> {
|
||||
|
@ -188,4 +203,22 @@ public final class VersionUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum SupportStatus {
|
||||
FULL(true),
|
||||
LIMITED(true),
|
||||
UNSTABLE(false),
|
||||
OUTDATED(false)
|
||||
;
|
||||
|
||||
private final boolean supported;
|
||||
|
||||
SupportStatus(final boolean supported) {
|
||||
this.supported = supported;
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
return supported;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -706,6 +706,8 @@ serverFull=Server is full\!
|
|||
serverReloading=There's a good chance you're reloading your server right now. If that's the case, why do you hate yourself? Expect no support from the EssentialsX team when using /reload.
|
||||
serverTotal=\u00a76Server Total\:\u00a7c {0}
|
||||
serverUnsupported=You are running an unsupported server version!
|
||||
serverUnsupportedLimitedApi=You are running a server with limited API functionality. EssentialsX will still work, but certain features may be disabled.
|
||||
serverUnsupportedMods=You are running a server that does not properly support Bukkit plugins. Bukkit plugins should not be used with Forge mods! Consider using ForgeEssentials, or SpongeForge + Nucleus.
|
||||
setBal=\u00a7aYour balance was set to {0}.
|
||||
setBalOthers=\u00a7aYou set {0}\u00a7a''s balance to {1}.
|
||||
setSpawner=\u00a76Changed spawner type to\u00a7c {0}\u00a76.
|
||||
|
|
Loading…
Reference in a new issue