mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-10-31 18:48:01 +00:00
Optimize getPlayers()
This commit is contained in:
parent
c5d35a2a1c
commit
d84f42952c
@ -168,9 +168,14 @@ public final class RedisBungee extends Plugin {
|
||||
if (pool != null) {
|
||||
Jedis rsc = pool.getResource();
|
||||
try {
|
||||
List<String> keys = new ArrayList<>();
|
||||
for (String i : getServerIds()) {
|
||||
if (i.equals(configuration.getString("server-id"))) continue;
|
||||
Set<String> users = rsc.smembers("server:" + i + ":usersOnline");
|
||||
if (i.equals(configuration.getString("server-id")))
|
||||
continue;
|
||||
|
||||
keys.add("server:" + i + ":usersOnline");
|
||||
}
|
||||
Set<String> 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()) {
|
||||
@ -178,7 +183,6 @@ public final class RedisBungee extends Plugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (JedisConnectionException e) {
|
||||
// Redis server has disappeared!
|
||||
getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e);
|
||||
|
Loading…
Reference in New Issue
Block a user