diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java index 7d6ac8e..736367b 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java @@ -182,11 +182,24 @@ public class RedisBungeeListener implements Listener { } catch (Exception e) {} out.writeUTF("ServerPlayers"); Multimap multimap = RedisBungee.getApi().getServerToPlayers(); - Multimap human = HashMultimap.create(); - for (Map.Entry entry : multimap.entries()) { - human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false)); + + boolean includesUsers = type1.equals("PLAYERS"); + + if (includesUsers) { + Multimap human = HashMultimap.create(); + for (Map.Entry entry : multimap.entries()) { + human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false)); + } + serializeMultimap(human, true, out); + } else { + // Due to Java generics, we are forced to coerce UUIDs into strings. This is less + // expensive than looking up names, since we just want counts. + Multimap flunk = HashMultimap.create(); + for (Map.Entry entry : multimap.entries()) { + flunk.put(entry.getKey(), entry.getValue().toString()); + } + serializeMultimap(flunk, false, out); } - serializeMultimap(human, type1.equals("PLAYERS"), out); break; case "Proxy": out.writeUTF("Proxy");