Skip to content

Commit

Permalink
Invalidate home/warp list caches when deleting all homes/warps
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Oct 10, 2023
1 parent 0c66893 commit 63bfa21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ public int deleteAllHomes(@NotNull User owner) {
});
publicHomes.removeIf(h -> h.getOwner().getUuid().equals(owner.getUuid()));
plugin.getMapHook().ifPresent(hook -> hook.clearHomes(owner));
plugin.getCommands().stream()
.filter(command -> command instanceof ListCommand)
.map(command -> (ListCommand) command)
.forEach(ListCommand::invalidateCaches);
plugin.getManager().propagateCacheUpdate();
return deleted;
}
Expand All @@ -268,6 +272,10 @@ public int deleteAllHomes(@NotNull String worldName, @NotNull String serverName)
if (plugin.getSettings().doCrossServer() && serverName.equals(plugin.getServerName())) {
plugin.getMapHook().ifPresent(hook -> hook.clearHomes(worldName));
}
plugin.getCommands().stream()
.filter(command -> command instanceof ListCommand)
.map(command -> (ListCommand) command)
.forEach(ListCommand::invalidateCaches);
plugin.getManager().propagateCacheUpdate();
return deleted;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ public int deleteAllWarps() {
final int deleted = plugin.getDatabase().deleteAllWarps();
warps.clear();
plugin.getMapHook().ifPresent(MapHook::clearWarps);
plugin.getCommands().stream()
.filter(command -> command instanceof ListCommand)
.map(command -> (ListCommand) command)
.forEach(ListCommand::invalidateCaches);
plugin.getManager().propagateCacheUpdate();
return deleted;
}
Expand All @@ -168,6 +172,10 @@ public int deleteAllWarps(@NotNull String worldName, @NotNull String serverName)
if (plugin.getSettings().doCrossServer() && plugin.getServerName().equals(serverName)) {
plugin.getMapHook().ifPresent(hook -> hook.clearWarps(worldName));
}
plugin.getCommands().stream()
.filter(command -> command instanceof ListCommand)
.map(command -> (ListCommand) command)
.forEach(ListCommand::invalidateCaches);
plugin.getManager().propagateCacheUpdate();
return deleted;
}
Expand Down

0 comments on commit 63bfa21

Please sign in to comment.