Skip to content

Commit 8c1d30c

Browse files
committed
Detect enabled Velocity support in server
1 parent 5612ca7 commit 8c1d30c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,25 @@ public void initialize() {
100100
}
101101

102102
private boolean detectBungeeCord() throws Exception {
103+
boolean enabledBungee = false;
104+
boolean enabledVelocity = false;
103105
try {
104-
enabled = Class.forName("org.spigotmc.SpigotConfig").getDeclaredField("bungee").getBoolean(null);
105-
return enabled;
106+
enabledBungee = Class.forName("org.spigotmc.SpigotConfig").getDeclaredField("bungee").getBoolean(null);
106107
} catch (ClassNotFoundException notFoundEx) {
107108
//ignore server has no bungee support
108-
return false;
109109
} catch (Exception ex) {
110110
throw ex;
111111
}
112+
113+
try {
114+
enabledVelocity = Class.forName("com.destroystokyo.paper.PaperConfig").getDeclaredField("velocitySupport").getBoolean(null);
115+
} catch (ClassNotFoundException notFoundEx) {
116+
//ignore server has no velocity support
117+
} catch (Exception ex) {
118+
throw ex;
119+
}
120+
121+
return enabledBungee || enabledVelocity;
112122
}
113123

114124
private void registerPluginChannels() {

0 commit comments

Comments
 (0)