diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index ef8679b..560a837 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -168,14 +168,18 @@ public final class RedisBungee extends Plugin { if (pool != null) { Jedis rsc = pool.getResource(); try { + List keys = new ArrayList<>(); for (String i : getServerIds()) { - if (i.equals(configuration.getString("server-id"))) continue; - Set users = rsc.smembers("server:" + i + ":usersOnline"); - if (users != null && !users.isEmpty()) { - for (String user : users) { - if (UUIDTranslator.UUID_PATTERN.matcher(user).find()) { - setBuilder = setBuilder.add(UUID.fromString(user)); - } + if (i.equals(configuration.getString("server-id"))) + continue; + + keys.add("server:" + i + ":usersOnline"); + } + Set users = rsc.sunion(keys.toArray(new String[keys.size()])); + if (users != null && !users.isEmpty()) { + for (String user : users) { + if (UUIDTranslator.UUID_PATTERN.matcher(user).find()) { + setBuilder = setBuilder.add(UUID.fromString(user)); } } }