2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-23 04:28:01 +00:00

serverToPlayers was getting injected with null values as a server

This commit is contained in:
mohammed jasem alaajel 2022-07-19 07:19:32 +04:00
parent c125137a74
commit 2e8342f5c3
2 changed files with 24 additions and 9 deletions

View File

@ -210,11 +210,14 @@ public class RedisBungeeBungeePlugin extends Plugin implements RedisBungeePlugin
@Override @Override
public Multimap<String, UUID> jedisTask(Jedis jedis) { public Multimap<String, UUID> jedisTask(Jedis jedis) {
ImmutableMultimap.Builder<String, UUID> builder = ImmutableMultimap.builder(); ImmutableMultimap.Builder<String, UUID> builder = ImmutableMultimap.builder();
for (String proxyId : getProxiesIds()) { for (String serverId : getProxiesIds()) {
Set<String> players = jedis.smembers("proxy:" + proxyId + ":usersOnline"); Set<String> players = jedis.smembers("proxy:" + serverId + ":usersOnline");
for (String player : players) { for (String player : players) {
String playerServer = jedis.hget("player:" + player, "server");
builder.put(jedis.hget("player:" + player, "server"), UUID.fromString(player)); if (playerServer == null) {
continue;
}
builder.put(playerServer, UUID.fromString(player));
} }
} }
return builder.build(); return builder.build();
@ -223,10 +226,14 @@ public class RedisBungeeBungeePlugin extends Plugin implements RedisBungeePlugin
@Override @Override
public Multimap<String, UUID> clusterJedisTask(JedisCluster jedisCluster) { public Multimap<String, UUID> clusterJedisTask(JedisCluster jedisCluster) {
ImmutableMultimap.Builder<String, UUID> builder = ImmutableMultimap.builder(); ImmutableMultimap.Builder<String, UUID> builder = ImmutableMultimap.builder();
for (String proxyId : getProxiesIds()) { for (String serverId : getProxiesIds()) {
Set<String> players = jedisCluster.smembers("proxy:" + proxyId + ":usersOnline"); Set<String> players = jedisCluster.smembers("proxy:" + serverId + ":usersOnline");
for (String player : players) { for (String player : players) {
builder.put(jedisCluster.hget("player:" + player, "server"), UUID.fromString(player)); String playerServer = jedisCluster.hget("player:" + player, "server");
if (playerServer == null) {
continue;
}
builder.put(playerServer, UUID.fromString(player));
} }
} }
return builder.build(); return builder.build();

View File

@ -376,7 +376,11 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
for (String serverId : getProxiesIds()) { for (String serverId : getProxiesIds()) {
Set<String> players = jedis.smembers("proxy:" + serverId + ":usersOnline"); Set<String> players = jedis.smembers("proxy:" + serverId + ":usersOnline");
for (String player : players) { for (String player : players) {
builder.put(jedis.hget("player:" + player, "server"), UUID.fromString(player)); String playerServer = jedis.hget("player:" + player, "server");
if (playerServer == null) {
continue;
}
builder.put(playerServer, UUID.fromString(player));
} }
} }
return builder.build(); return builder.build();
@ -388,7 +392,11 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
for (String serverId : getProxiesIds()) { for (String serverId : getProxiesIds()) {
Set<String> players = jedisCluster.smembers("proxy:" + serverId + ":usersOnline"); Set<String> players = jedisCluster.smembers("proxy:" + serverId + ":usersOnline");
for (String player : players) { for (String player : players) {
builder.put(jedisCluster.hget("player:" + player, "server"), UUID.fromString(player)); String playerServer = jedisCluster.hget("player:" + player, "server");
if (playerServer == null) {
continue;
}
builder.put(playerServer, UUID.fromString(player));
} }
} }
return builder.build(); return builder.build();