From 56b939d385146a82c9b5ad0248b52952b013bbe1 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 4 Apr 2022 19:42:57 +0200 Subject: [PATCH] add player to redis when player enters server --- .../proxy/listener/PostLoginListener.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/net/krakatoa/proxy/listener/PostLoginListener.java b/src/main/java/net/krakatoa/proxy/listener/PostLoginListener.java index 19c29b3..f6a04bb 100644 --- a/src/main/java/net/krakatoa/proxy/listener/PostLoginListener.java +++ b/src/main/java/net/krakatoa/proxy/listener/PostLoginListener.java @@ -71,6 +71,25 @@ public class PostLoginListener implements Listener { // redis ProxySystem.getInstance().getLogger().info("mongodb player " + document.keySet()); + RMap map = ProxySystem.getInstance().getRedisManager() + .getRedissonClient() + .getMap("player:" + uuid); + + if (map.isEmpty()) { + map.put("uuid", uuid); + map.put("voiceWebCode", "voiceWebCode"); + + document.forEach((key, value) -> { + ProxySystem.getInstance().getLogger() + .info("key " + key + " value " + value.toString()); + map.put(key, value.toString()); + }); + ProxySystem.getInstance().getLogger().info("PUT !"); + } else { + ProxySystem.getInstance().getLogger() + .warning("REDIS player " + uuid + " exists in the cache, but should not exist"); + } + // check if both sockets connected int cmdID = ProxySystem.getInstance().getKraSocketClientProtocol().generateCmdID();