From c8be2a2a7b89fe26eefe6c34a1d3dbf2d47196fc Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Wed, 19 Jun 2024 20:32:34 -0400 Subject: [PATCH] [build] trigger the github action No longer using reflection to get the player count because we do not need to. --- .../badbones69/crazycrates/api/CustomMetrics.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/CustomMetrics.java b/paper/src/main/java/com/badbones69/crazycrates/api/CustomMetrics.java index 0e24039e4..e7a6162e9 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/CustomMetrics.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/CustomMetrics.java @@ -131,18 +131,7 @@ private void appendServiceData(JsonObjectBuilder builder) { } private int getPlayerAmount() { - try { - // Around MC 1.8 the return type was changed from an array to a collection, - // This fixes java.lang.NoSuchMethodError: - // org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection; - Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers"); - return onlinePlayersMethod.getReturnType().equals(Collection.class) - ? ((Collection) onlinePlayersMethod.invoke(Bukkit.getServer())).size() - : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length; - } catch (Exception e) { - // Just use the new method if the reflection failed - return Bukkit.getOnlinePlayers().size(); - } + return this.plugin.getServer().getOnlinePlayers().size(); } public static class MetricsBase {