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,14 +168,18 @@ public final class RedisBungee extends Plugin {
|
|||||||
if (pool != null) {
|
if (pool != null) {
|
||||||
Jedis rsc = pool.getResource();
|
Jedis rsc = pool.getResource();
|
||||||
try {
|
try {
|
||||||
|
List<String> keys = new ArrayList<>();
|
||||||
for (String i : getServerIds()) {
|
for (String i : getServerIds()) {
|
||||||
if (i.equals(configuration.getString("server-id"))) continue;
|
if (i.equals(configuration.getString("server-id")))
|
||||||
Set<String> users = rsc.smembers("server:" + i + ":usersOnline");
|
continue;
|
||||||
if (users != null && !users.isEmpty()) {
|
|
||||||
for (String user : users) {
|
keys.add("server:" + i + ":usersOnline");
|
||||||
if (UUIDTranslator.UUID_PATTERN.matcher(user).find()) {
|
}
|
||||||
setBuilder = setBuilder.add(UUID.fromString(user));
|
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()) {
|
||||||
|
setBuilder = setBuilder.add(UUID.fromString(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user