From cb5f403043bc6e41c9378f3d19ead2aa01c26ab2 Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 16 Feb 2021 17:38:45 +0000 Subject: [PATCH] Invalidate context cache on Bukkit PlayerJoinEvent The players world is first defined just before this event, so we need to invalidate here as well as on world change --- .../luckperms/bukkit/context/BukkitPlayerCalculator.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/context/BukkitPlayerCalculator.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/context/BukkitPlayerCalculator.java index 34bbab78b..ca8eecf9b 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/context/BukkitPlayerCalculator.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/context/BukkitPlayerCalculator.java @@ -48,6 +48,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.checkerframework.checker.nullness.qual.NonNull; public class BukkitPlayerCalculator implements ContextCalculator, Listener { @@ -113,6 +114,11 @@ public class BukkitPlayerCalculator implements ContextCalculator, Listen this.plugin.getContextManager().signalContextUpdate(e.getPlayer()); } + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerJoinWorld(PlayerJoinEvent e) { + this.plugin.getContextManager().signalContextUpdate(e.getPlayer()); + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onGameModeChange(PlayerGameModeChangeEvent e) { this.plugin.getContextManager().signalContextUpdate(e.getPlayer());