diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java index 4a25d24d..2ce1a265 100644 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java +++ b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java @@ -29,10 +29,7 @@ import redis.clients.jedis.UnifiedJedis; import java.net.InetAddress; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.UUID; +import java.util.*; import java.util.concurrent.TimeUnit; public abstract class PlayerDataManager<P, LE, DE, PS extends IPubSubMessageEvent, SC extends IPlayerChangedServerNetworkEvent, NJE extends IPlayerLeftNetworkEvent, CE, PJN extends IPlayerJoinedNetworkEvent> { @@ -267,7 +264,9 @@ protected Multimap<String, UUID> serversToPlayersBuilder(Object o) { public Multimap<String, UUID> doPooledPipeline(Pipeline pipeline) { HashMap<UUID, Response<String>> responses = new HashMap<>(); for (UUID uuid : uuids) { - responses.put(uuid, pipeline.hget("redis-bungee::" + networkId + "::player::" + uuid + "::data", "server")); + Optional.ofNullable(pipeline.hget("redis-bungee::" + networkId + "::player::" + uuid + "::data", "server")).ifPresent(stringResponse -> { + responses.put(uuid, stringResponse); + }); } pipeline.sync(); responses.forEach((uuid, response) -> { @@ -283,13 +282,14 @@ public Multimap<String, UUID> doPooledPipeline(Pipeline pipeline) { public Multimap<String, UUID> clusterPipeline(ClusterPipeline pipeline) { HashMap<UUID, Response<String>> responses = new HashMap<>(); for (UUID uuid : uuids) { - responses.put(uuid, pipeline.hget("redis-bungee::" + networkId + "::player::" + uuid + "::data", "server")); + Optional.ofNullable(pipeline.hget("redis-bungee::" + networkId + "::player::" + uuid + "::data", "server")).ifPresent(stringResponse -> { + responses.put(uuid, stringResponse); + }); } pipeline.sync(); responses.forEach((uuid, response) -> { String key = response.get(); if (key == null) return; - builder.put(key, uuid); }); return builder.build();