diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java index 212e9f727..8dfabcb8c 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java @@ -12,6 +12,7 @@ import com.earth2me.essentials.utils.VersionUtil; import com.google.common.base.Charsets; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -324,6 +325,7 @@ public class Commandessentials extends EssentialsCommand { } sender.sendMessage(tl(serverMessageKey, "Server", server.getBukkitVersion() + " " + server.getVersion())); + sender.sendMessage(tl(serverMessageKey, "Brand", server.getName())); sender.sendMessage(tl("versionOutputFine", "EssentialsX", essVer)); for (final Plugin plugin : pm.getPlugins()) { @@ -373,23 +375,23 @@ public class Commandessentials extends EssentialsCommand { switch (supportStatus) { case NMS_CLEANROOM: - sender.sendMessage(tl("serverUnsupportedCleanroom")); + sender.sendMessage(ChatColor.DARK_RED + tl("serverUnsupportedCleanroom")); break; case DANGEROUS_FORK: - sender.sendMessage(tl("serverUnsupportedDangerous")); + sender.sendMessage(ChatColor.DARK_RED + tl("serverUnsupportedDangerous")); break; case UNSTABLE: - sender.sendMessage(tl("serverUnsupportedMods")); + sender.sendMessage(ChatColor.DARK_RED + tl("serverUnsupportedMods")); break; case OUTDATED: - sender.sendMessage(tl("serverUnsupported")); + sender.sendMessage(ChatColor.RED + tl("serverUnsupported")); break; case LIMITED: - sender.sendMessage(tl("serverUnsupportedLimitedApi")); + sender.sendMessage(ChatColor.RED + tl("serverUnsupportedLimitedApi")); break; } if (VersionUtil.getSupportStatusClass() != null) { - sender.sendMessage(tl("serverUnsupportedClass", VersionUtil.getSupportStatusClass())); + sender.sendMessage(ChatColor.RED + tl("serverUnsupportedClass", VersionUtil.getSupportStatusClass())); } sender.sendMessage(tl("versionFetching")); diff --git a/Essentials/src/main/java/com/earth2me/essentials/utils/VersionUtil.java b/Essentials/src/main/java/com/earth2me/essentials/utils/VersionUtil.java index 7bf174c46..63ab836f6 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/utils/VersionUtil.java +++ b/Essentials/src/main/java/com/earth2me/essentials/utils/VersionUtil.java @@ -8,6 +8,7 @@ import io.papermc.lib.PaperLib; import net.ess3.nms.refl.ReflUtil; import org.bukkit.Bukkit; +import java.lang.reflect.Method; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; @@ -43,6 +44,12 @@ public final class VersionUtil { // * Messes with proxy-forwarded UUIDs // * Frequent data corruptions builder.put("org.yatopiamc.yatopia.server.YatopiaConfig", SupportStatus.DANGEROUS_FORK); + builder.put("net.yatopia.api.event.PlayerAttackEntityEvent", SupportStatus.DANGEROUS_FORK); + builder.put("org.bukkit.plugin.SimplePluginManager#getPluginLoaders", SupportStatus.DANGEROUS_FORK); + builder.put("org.bukkit.Bukkit#getLastTickTime", SupportStatus.DANGEROUS_FORK); + builder.put("brand:Yatopia", SupportStatus.DANGEROUS_FORK); + // Yatopia downstream(s) which attempt to do tricky things :) + builder.put("brand:Hyalus", SupportStatus.DANGEROUS_FORK); // KibblePatcher - Dangerous bytecode editor snakeoil whose only use is to break plugins builder.put("net.kibblelands.server.FastMath", SupportStatus.DANGEROUS_FORK); @@ -81,10 +88,35 @@ public final class VersionUtil { public static SupportStatus getServerSupportStatus() { if (supportStatus == null) { for (Map.Entry entry : unsupportedServerClasses.entrySet()) { + + if (entry.getKey().startsWith("brand:")) { + if (Bukkit.getName().equalsIgnoreCase(entry.getKey().replaceFirst("brand:", ""))) { + supportStatusClass = entry.getKey(); + return supportStatus = entry.getValue(); + } + } + final boolean inverted = entry.getKey().contains("!"); - final String clazz = entry.getKey().replace("!", ""); + final String clazz = entry.getKey().replace("!", "").split("#")[0]; + String method = ""; + if (entry.getKey().contains("#")) { + method = entry.getKey().split("#")[1]; + } try { - Class.forName(clazz); + final Class lolClass = Class.forName(clazz); + + if (!method.isEmpty()) { + for (final Method mth : lolClass.getDeclaredMethods()) { + if (mth.getName().equals(method)) { + if (!inverted) { + supportStatusClass = entry.getKey(); + return supportStatus = entry.getValue(); + } + } + } + continue; + } + if (!inverted) { supportStatusClass = entry.getKey(); return supportStatus = entry.getValue();