diff --git a/bukkit/src/main/java/org/bstats/bukkit/Metrics.java b/bukkit/src/main/java/org/bstats/bukkit/Metrics.java index 8a99f24..96531bd 100644 --- a/bukkit/src/main/java/org/bstats/bukkit/Metrics.java +++ b/bukkit/src/main/java/org/bstats/bukkit/Metrics.java @@ -88,10 +88,12 @@ public Metrics(JavaPlugin plugin, int serviceId) { public void addCustomChart(CustomChart chart) { metricsBase.addCustomChart(chart); } + + private void appendPlatformData(JsonObjectBuilder builder) { builder.appendField("playerAmount", getPlayerAmount()); - builder.appendField("onlineMode", Bukkit.getOnlineMode() ? 1 : 0); + builder.appendField("onlineMode", getOnlineMode()); builder.appendField("bukkitVersion", Bukkit.getVersion()); builder.appendField("bukkitName", Bukkit.getName()); @@ -105,6 +107,16 @@ private void appendPlatformData(JsonObjectBuilder builder) { private void appendServiceData(JsonObjectBuilder builder) { builder.appendField("pluginVersion", plugin.getDescription().getVersion()); } + + private Object getOnlineMode() { + boolean onlineMode = Bukkit.getOnlineMode(); + try { + if (Class.forName("org.spigotmc.SpigotConfig").getField("bungee").getBoolean(null)) { + return "bungee"; + } + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException ignored) { } + return onlineMode ? 1 : 0; + } private int getPlayerAmount() { try { @@ -119,4 +131,4 @@ private int getPlayerAmount() { } } -} \ No newline at end of file +}