mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
Fix warp and home list caches not being invalidated when homes updated
This commit is contained in:
3 files changed
+23
No files matched your search
@@ -18,4 +18,8 @@ public abstract class ListCommand extends Command {
|
|||||||
this.cachedLists = new HashMap<>();
|
this.cachedLists = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void invalidateCaches() {
|
||||||
|
cachedLists.clear();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.william278.huskhomes.manager;
|
package net.william278.huskhomes.manager;
|
||||||
|
|
||||||
import net.william278.huskhomes.HuskHomes;
|
import net.william278.huskhomes.HuskHomes;
|
||||||
|
import net.william278.huskhomes.command.ListCommand;
|
||||||
import net.william278.huskhomes.hook.EconomyHook;
|
import net.william278.huskhomes.hook.EconomyHook;
|
||||||
import net.william278.huskhomes.network.Message;
|
import net.william278.huskhomes.network.Message;
|
||||||
import net.william278.huskhomes.network.Payload;
|
import net.william278.huskhomes.network.Payload;
|
||||||
@@ -59,6 +60,10 @@ public class HomesManager {
|
|||||||
plugin.getMapHook().ifPresent(hook -> hook.updateHome(home));
|
plugin.getMapHook().ifPresent(hook -> hook.updateHome(home));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugin.getCommands().stream()
|
||||||
|
.filter(command -> command instanceof ListCommand)
|
||||||
|
.map(command -> (ListCommand) command)
|
||||||
|
.forEach(ListCommand::invalidateCaches);
|
||||||
if (propagate) {
|
if (propagate) {
|
||||||
propagateCacheUpdate(home.getUuid());
|
propagateCacheUpdate(home.getUuid());
|
||||||
}
|
}
|
||||||
@@ -74,6 +79,10 @@ public class HomesManager {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
plugin.getCommands().stream()
|
||||||
|
.filter(command -> command instanceof ListCommand)
|
||||||
|
.map(command -> (ListCommand) command)
|
||||||
|
.forEach(ListCommand::invalidateCaches);
|
||||||
if (propagate) {
|
if (propagate) {
|
||||||
this.propagateCacheUpdate(homeId);
|
this.propagateCacheUpdate(homeId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.william278.huskhomes.manager;
|
package net.william278.huskhomes.manager;
|
||||||
|
|
||||||
import net.william278.huskhomes.HuskHomes;
|
import net.william278.huskhomes.HuskHomes;
|
||||||
|
import net.william278.huskhomes.command.ListCommand;
|
||||||
import net.william278.huskhomes.hook.MapHook;
|
import net.william278.huskhomes.hook.MapHook;
|
||||||
import net.william278.huskhomes.network.Message;
|
import net.william278.huskhomes.network.Message;
|
||||||
import net.william278.huskhomes.network.Payload;
|
import net.william278.huskhomes.network.Payload;
|
||||||
@@ -29,6 +30,11 @@ public class WarpsManager {
|
|||||||
warps.remove(warp);
|
warps.remove(warp);
|
||||||
warps.add(warp);
|
warps.add(warp);
|
||||||
plugin.getMapHook().ifPresent(hook -> hook.updateWarp(warp));
|
plugin.getMapHook().ifPresent(hook -> hook.updateWarp(warp));
|
||||||
|
|
||||||
|
plugin.getCommands().stream()
|
||||||
|
.filter(command -> command instanceof ListCommand)
|
||||||
|
.map(command -> (ListCommand) command)
|
||||||
|
.forEach(ListCommand::invalidateCaches);
|
||||||
if (propagate) {
|
if (propagate) {
|
||||||
this.propagateCacheUpdate(warp.getUuid());
|
this.propagateCacheUpdate(warp.getUuid());
|
||||||
}
|
}
|
||||||
@@ -43,6 +49,10 @@ public class WarpsManager {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
plugin.getCommands().stream()
|
||||||
|
.filter(command -> command instanceof ListCommand)
|
||||||
|
.map(command -> (ListCommand) command)
|
||||||
|
.forEach(ListCommand::invalidateCaches);
|
||||||
if (propagate) {
|
if (propagate) {
|
||||||
this.propagateCacheUpdate(warpId);
|
this.propagateCacheUpdate(warpId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user