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
This commit is contained in:
Luck 2021-02-16 17:38:45 +00:00
parent 997e3c7ef7
commit cb5f403043
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -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<Player>, Listener {
@ -113,6 +114,11 @@ public class BukkitPlayerCalculator implements ContextCalculator<Player>, 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());