Skip to content

Commit

Permalink
Fixed null when fetching server id. (#118)
Browse files Browse the repository at this point in the history
(cherry picked from commit 219a4ab)
  • Loading branch information
MassiveLag authored and ham1255 committed Sep 26, 2024
1 parent 981d42d commit d8704c8
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,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> {
Expand Down Expand Up @@ -248,7 +245,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) -> {
Expand All @@ -264,13 +263,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();
Expand Down

0 comments on commit d8704c8

Please sign in to comment.