1
0
mirror of https://github.com/BentoBoxWorld/Warps.git synced 2024-11-26 04:25:40 +01:00

Sign Cache could get out of sync with signs.

https://github.com/BentoBoxWorld/Warps/issues/80
This commit is contained in:
tastybento 2020-05-27 16:48:20 -07:00
parent 74675abce6
commit 94f0ff4e22
2 changed files with 8 additions and 5 deletions

View File

@ -72,8 +72,9 @@ public class SignCacheManager {
* @param key - uuid of owner * @param key - uuid of owner
*/ */
void removeWarp(World world, UUID key) { void removeWarp(World world, UUID key) {
cachedSigns.putIfAbsent(world, new HashMap<>()); if (cachedSigns.containsKey(world)) {
cachedSigns.get(world).remove(key); cachedSigns.get(world).remove(key);
}
} }
} }

View File

@ -245,9 +245,10 @@ public class WarpSignsManager {
if (getWarpMap(world).containsKey(uuid)) { if (getWarpMap(world).containsKey(uuid)) {
popSign(getWarpMap(world).get(uuid)); popSign(getWarpMap(world).get(uuid));
getWarpMap(world).remove(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(); saveWarpList();
} }
@ -255,7 +256,8 @@ public class WarpSignsManager {
* Saves the warp lists to the database * Saves the warp lists to the database
*/ */
public void saveWarpList() { public void saveWarpList() {
handler.saveObject(warpsData .save(worldsWarpList)); handler.saveObject(warpsData.save(worldsWarpList));
addon.getWarpPanelManager().saveCache();
} }
/** /**