diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java index 49ff879c..a47715aa 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java @@ -33,7 +33,6 @@ import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collections; @@ -103,37 +102,18 @@ public class BungeeManager { private boolean isProxySupported(String className, String fieldName) { try { return Class.forName(className).getDeclaredField(fieldName).getBoolean(null); - } catch (ClassNotFoundException | NoSuchFieldException notFoundEx) { + } catch (ClassNotFoundException notFoundEx) { //ignore server has no proxy support - } catch (IllegalAccessException noSuchFieldException) { + } catch (NoSuchFieldException | IllegalAccessException noSuchFieldException) { plugin.getLog().warn("Cannot access proxy field", noSuchFieldException); } return false; } - private boolean isVelocityEnabled() { - if (isProxySupported("com.destroystokyo.paper.PaperConfig", "velocitySupport")) { - return true; - } - - try { - Object global = Class.forName("io.papermc.paper.configuration.GlobalConfiguration").getDeclaredMethod("get").invoke(null); - Object proxiesConfiguration = global.getClass().getDeclaredField("proxies").get(global); - Object velocityConfig = proxiesConfiguration.getClass().getDeclaredField("velocity").get(proxiesConfiguration); - - return velocityConfig.getClass().getDeclaredField("enabled").getBoolean(velocityConfig); - } catch (NoSuchMethodException | ClassNotFoundException | InvocationTargetException | IllegalAccessException | - NoSuchFieldException e) { - plugin.getLog().info("Errror", e); - } - - return false; - } - private boolean detectProxy() { return isProxySupported("org.spigotmc.SpigotConfig", "bungee") - || isVelocityEnabled(); + || isProxySupported("com.destroystokyo.paper.PaperConfig", "velocitySupport"); } private void registerPluginChannels() {