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
*/
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);
}
}
}

View File

@ -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();
}
/**