private int getOnlinePlayers() {
        try {
            Method onlinePlayerMethod = Server.class.getMethod("getOnlinePlayers");
            if(onlinePlayerMethod.getReturnType().equals(Collection.class)) {
                return ((Collection<?>)onlinePlayerMethod.invoke(Bukkit.getServer())).size();
            } else {
                return ((Player[])onlinePlayerMethod.invoke(Bukkit.getServer())).length;
            }
        } catch (Exception ex) {
            if (debug) {
                Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
            }
        }
        
        return 0;
    }