2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-22 20:28:00 +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
public Multimap<String, UUID> jedisTask(Jedis jedis) {
ImmutableMultimap.Builder<String, UUID> builder = ImmutableMultimap.builder();
for (String proxyId : getProxiesIds()) {
Set<String> players = jedis.smembers("proxy:" + proxyId + ":usersOnline");
for (String serverId : getProxiesIds()) {
Set<String> players = jedis.smembers("proxy:" + serverId + ":usersOnline");
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();
@ -223,10 +226,14 @@ public class RedisBungeeBungeePlugin extends Plugin implements RedisBungeePlugin
@Override
public Multimap<String, UUID> clusterJedisTask(JedisCluster jedisCluster) {
ImmutableMultimap.Builder<String, UUID> builder = ImmutableMultimap.builder();
for (String proxyId : getProxiesIds()) {
Set<String> players = jedisCluster.smembers("proxy:" + proxyId + ":usersOnline");
for (String serverId : getProxiesIds()) {
Set<String> players = jedisCluster.smembers("proxy:" + serverId + ":usersOnline");
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();

View File

@ -376,7 +376,11 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
for (String serverId : getProxiesIds()) {
Set<String> players = jedis.smembers("proxy:" + serverId + ":usersOnline");
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();
@ -388,7 +392,11 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
for (String serverId : getProxiesIds()) {
Set<String> players = jedisCluster.smembers("proxy:" + serverId + ":usersOnline");
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();