diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java index a3f7d84d..1318022e 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java @@ -143,7 +143,8 @@ class BukkitListener extends AbstractListener implements Listener { } } - @EventHandler(priority = EventPriority.MONITOR) // Allow other plugins to see data when this event gets called. + // Wait until the last priority to unload, so plugins can still perform permission checks on this event + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerQuit(PlayerQuitEvent e) { final Player player = e.getPlayer(); diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java index 04da854e..94abaa49 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java @@ -54,7 +54,7 @@ public class BungeeListener extends AbstractListener implements Listener { this.plugin = plugin; } - @EventHandler + @EventHandler(priority = EventPriority.HIGH) public void onPlayerPermissionCheck(PermissionCheckEvent e) { if (!(e.getSender() instanceof ProxiedPlayer)) { e.setHasPermission(true); @@ -158,7 +158,8 @@ public class BungeeListener extends AbstractListener implements Listener { } } - @EventHandler + // Wait until the last priority to unload, so plugins can still perform permission checks on this event + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerQuit(PlayerDisconnectEvent e) { onLeave(e.getPlayer().getUniqueId()); } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java index 41bd55a4..b3ba259a 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java @@ -113,10 +113,13 @@ public class SpongeListener extends AbstractListener { @Listener(order = Order.LAST) public void onClientLeave(ClientConnectionEvent.Disconnect e) { + /* We don't actually remove the user instance here, as Sponge likes to keep performing checks + on players when they disconnect. The instance gets cleared up on a housekeeping task + after a period of inactivity. */ try (Timing ignored = plugin.getTimings().time(LPTiming.ON_CLIENT_LEAVE)) { final UuidCache cache = plugin.getUuidCache(); - // Unload the user from memory when they disconnect; + // Unload the user from memory when they disconnect cache.clearCache(e.getTargetEntity().getUniqueId()); } }