diff --git a/src/main/java/me/unurled/sacredrealms/sr/components/clientbuild/ClientBuildManager.java b/src/main/java/me/unurled/sacredrealms/sr/components/clientbuild/ClientBuildManager.java index 3359eac..2827361 100644 --- a/src/main/java/me/unurled/sacredrealms/sr/components/clientbuild/ClientBuildManager.java +++ b/src/main/java/me/unurled/sacredrealms/sr/components/clientbuild/ClientBuildManager.java @@ -32,7 +32,7 @@ public class ClientBuildManager extends Manager { private final List builds = new ArrayList<>(); /** a map of players that have ClientBuild displayed */ - private final Map> playerBlocks = new HashMap<>(); + private final Map> playerBlocks = new HashMap<>(); private final Map> temporaryBlocks = new HashMap<>(); private final Map> temporaryPreviousBlocks = new HashMap<>(); @@ -65,10 +65,10 @@ public class ClientBuildManager extends Manager { dh.set("sr.clientbuild." + build.getName(), json); } - for (Entry> entry : playerBlocks.entrySet()) { + for (Entry> entry : playerBlocks.entrySet()) { for (String name : entry.getValue()) { // save for player - dh.set(SR_PLAYERS_CLIENTBUILD + entry.getKey().getUniqueId() + "." + name, "true"); + dh.set(SR_PLAYERS_CLIENTBUILD + entry.getKey() + "." + name, "true"); } } } @@ -111,7 +111,7 @@ public class ClientBuildManager extends Manager { List names = new ArrayList<>(dh.getKeysAll(SR_PLAYERS_CLIENTBUILD + p.getUniqueId())); - playerBlocks.put(p, names); + playerBlocks.put(p.getUniqueId(), names); for (String name : names) { ClientBuild build = getBuild(name); @@ -124,7 +124,7 @@ public class ClientBuildManager extends Manager { @EventHandler public void onPlayerQuit(@NotNull PlayerQuitEvent e) { Player p = e.getPlayer(); - List names = playerBlocks.get(p); + List names = playerBlocks.get(p.getUniqueId()); if (names == null) { return; } @@ -151,9 +151,9 @@ public class ClientBuildManager extends Manager { dh.set(SR_PLAYERS_CLIENTBUILD + p.getUniqueId() + "." + name, "true"); } - playerBlocks.get(p).clear(); + playerBlocks.get(p.getUniqueId()).clear(); - playerBlocks.remove(p); + playerBlocks.remove(p.getUniqueId()); } public List getBuildNames() { @@ -188,18 +188,18 @@ public class ClientBuildManager extends Manager { } public List getPlayerBuilds(Player p) { - return playerBlocks.get(p); + return playerBlocks.get(p.getUniqueId()); } public void displayToPlayer(@NotNull Player p, @NotNull ClientBuild build) { - playerBlocks.get(p).add(build.getName()); + playerBlocks.get(p.getUniqueId()).add(build.getName()); for (Entry entry : build.getBlocks().entrySet()) { p.sendBlockChange(entry.getKey(), entry.getValue()); } } public void removeDisplayFromPlayer(@NotNull Player p, @NotNull ClientBuild build) { - playerBlocks.get(p).remove(build.getName()); + playerBlocks.get(p.getUniqueId()).remove(build.getName()); for (Entry entry : build.getBlocks().entrySet()) { p.sendBlockChange(entry.getKey(), entry.getKey().getBlock().getBlockData()); }