From bff3c2f58dc10e9786211287ff65a290472e7616 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 27 Oct 2024 11:29:55 +0700 Subject: [PATCH] Fix the "Fix the fix that doesn't fix.". --- .../plugins/PlayersPersistentDataPlugin.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/plugins/PlayersPersistentDataPlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/PlayersPersistentDataPlugin.java index f5d9a56..5b3ac48 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/PlayersPersistentDataPlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/PlayersPersistentDataPlugin.java @@ -29,12 +29,17 @@ public class PlayersPersistentDataPlugin extends PlayersPlugin.Listener { @Override public void playerJoined(PlayerEntry target) { - final JsonElement originalObject = playersObject.get(target.profile.getName()); + final JsonElement originalElement = playersObject.get(target.profile.getName()); - final JsonObject object = new JsonObject(); - object.addProperty("uuid", target.profile.getIdAsString()); - if (originalObject != null && !originalObject.getAsJsonObject().has("lastSeen")) object.add("lastSeen", new JsonObject()); - if (originalObject != null && !originalObject.getAsJsonObject().has("ips")) object.add("ips", new JsonObject()); + JsonObject object; + + if (originalElement == null) { + object = new JsonObject(); + object.addProperty("uuid", target.profile.getIdAsString()); + object.add("ips", new JsonObject()); + } else { + object = originalElement.getAsJsonObject(); + } final CompletableFuture future = bot.players.getPlayerIP(target);