mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
Revert "Add support for checking velocity support with newer paper configs"
This reverts commit 6f9e8a49f1
.
Fixes #825
This commit is contained in:
@ -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() {
|
||||
|
Reference in New Issue
Block a user