Skip to content

Commit

Permalink
Detect enabled Velocity support in server
Browse files Browse the repository at this point in the history
  • Loading branch information
oldium committed Nov 21, 2021
1 parent 5612ca7 commit 8c1d30c
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,25 @@ public void initialize() {
}

private boolean detectBungeeCord() throws Exception {
boolean enabledBungee = false;
boolean enabledVelocity = false;
try {
enabled = Class.forName("org.spigotmc.SpigotConfig").getDeclaredField("bungee").getBoolean(null);
return enabled;
enabledBungee = Class.forName("org.spigotmc.SpigotConfig").getDeclaredField("bungee").getBoolean(null);
} catch (ClassNotFoundException notFoundEx) {
//ignore server has no bungee support
return false;
} catch (Exception ex) {
throw ex;
}

try {
enabledVelocity = Class.forName("com.destroystokyo.paper.PaperConfig").getDeclaredField("velocitySupport").getBoolean(null);
} catch (ClassNotFoundException notFoundEx) {
//ignore server has no velocity support
} catch (Exception ex) {
throw ex;
}

return enabledBungee || enabledVelocity;
}

private void registerPluginChannels() {
Expand Down

0 comments on commit 8c1d30c

Please sign in to comment.