diff --git a/src/main/java/world/bentobox/warps/SignCacheManager.java b/src/main/java/world/bentobox/warps/SignCacheManager.java index b0611f8..d590604 100644 --- a/src/main/java/world/bentobox/warps/SignCacheManager.java +++ b/src/main/java/world/bentobox/warps/SignCacheManager.java @@ -72,8 +72,9 @@ public class SignCacheManager { * @param key - uuid of owner */ void removeWarp(World world, UUID key) { - cachedSigns.putIfAbsent(world, new HashMap<>()); - cachedSigns.get(world).remove(key); + if (cachedSigns.containsKey(world)) { + cachedSigns.get(world).remove(key); + } } } diff --git a/src/main/java/world/bentobox/warps/WarpSignsManager.java b/src/main/java/world/bentobox/warps/WarpSignsManager.java index 9789547..6c6e317 100644 --- a/src/main/java/world/bentobox/warps/WarpSignsManager.java +++ b/src/main/java/world/bentobox/warps/WarpSignsManager.java @@ -245,9 +245,10 @@ public class WarpSignsManager { if (getWarpMap(world).containsKey(uuid)) { popSign(getWarpMap(world).get(uuid)); getWarpMap(world).remove(uuid); - // Remove sign from warp panel cache - addon.getWarpPanelManager().removeWarp(world, uuid); + } + // Remove sign from warp panel cache + addon.getWarpPanelManager().removeWarp(world, uuid); saveWarpList(); } @@ -255,7 +256,8 @@ public class WarpSignsManager { * Saves the warp lists to the database */ public void saveWarpList() { - handler.saveObject(warpsData .save(worldsWarpList)); + handler.saveObject(warpsData.save(worldsWarpList)); + addon.getWarpPanelManager().saveCache(); } /**