Invalidate home/warp list caches when deleting all homes/warps

This commit is contained in:
William committed 2023-10-10 19:47:21 +01:00
1 parent 0c66893602
commit 63bfa2119e
2 files changed
+16

No files matched your search

@@ -255,6 +255,10 @@ public class HomesManager {
});
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;
}
@@ -268,6 +272,10 @@ public class HomesManager {
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;
}
@@ -158,6 +158,10 @@ public class WarpsManager {
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;
}
@@ -168,6 +172,10 @@ public class WarpsManager {
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;
}