Fix the "Fix the fix that doesn't fix.".

This commit is contained in:
Chayapak 2024-10-27 11:29:55 +07:00
parent 4142875c06
commit bff3c2f58d

View file

@ -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();
JsonObject object;
if (originalElement == null) {
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());
object.add("ips", new JsonObject());
} else {
object = originalElement.getAsJsonObject();
}
final CompletableFuture<String> future = bot.players.getPlayerIP(target);