Skip to content

Commit

Permalink
Sign Cache could get out of sync with signs.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed May 27, 2020
1 parent 74675ab commit 94f0ff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/java/world/bentobox/warps/SignCacheManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ List<String> getSign(World world, UUID playerUUID) {
* @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);
}
}

}
8 changes: 5 additions & 3 deletions src/main/java/world/bentobox/warps/WarpSignsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,19 @@ public void removeWarp(World world, UUID uuid) {
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();
}

/**
* Saves the warp lists to the database
*/
public void saveWarpList() {
handler.saveObject(warpsData .save(worldsWarpList));
handler.saveObject(warpsData.save(worldsWarpList));
addon.getWarpPanelManager().saveCache();
}

/**
Expand Down

0 comments on commit 94f0ff4

Please sign in to comment.