mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-27 21:29:47 +01:00
Invalidate active context cache when a player changes world - closes #288
This commit is contained in:
parent
abc1c164cf
commit
ca1dacf2b6
@ -255,8 +255,9 @@ public class BukkitListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onWorldChange(PlayerChangedWorldEvent e) {
|
||||
plugin.getContextManager().invalidateCache(e.getPlayer());
|
||||
plugin.refreshAutoOp(e.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,10 @@ public class ContextManager<T> {
|
||||
return cache.get(subject);
|
||||
}
|
||||
|
||||
public void invalidateCache(T subject){
|
||||
cache.invalidate(subject);
|
||||
}
|
||||
|
||||
public void registerCalculator(ContextCalculator<T> calculator) {
|
||||
// calculators registered first should have priority (and be checked last.)
|
||||
calculators.add(0, calculator);
|
||||
|
Loading…
Reference in New Issue
Block a user