From 2a4e96665965b21d48a6ade15f1278e0873bdef6 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:41:48 -0500 Subject: [PATCH] Maybe fixing server crash. --- .../ellpeck/actuallyadditions/mod/data/PlayerData.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java index c52d434c2..7e29460d8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/data/PlayerData.java @@ -23,9 +23,15 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; public final class PlayerData { - + private static PlayerSave clientData = null; public static PlayerSave getDataFromPlayer(Player player) { - WorldData worldData = WorldData.get((ServerLevel) player.getCommandSenderWorld()); + if (!(player.getCommandSenderWorld() instanceof ServerLevel)) { + if (clientData == null) { + clientData = new PlayerSave(player.getUUID()); + } + return clientData; + } + WorldData worldData = WorldData.get(player.getCommandSenderWorld()); ConcurrentHashMap data = worldData.playerSaveData; UUID id = player.getUUID();