From 1e72f9d8fe2f865e99a8cf753425b1372b269cfd Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 20 Sep 2016 21:04:53 +0100 Subject: [PATCH] Listen on lowest priority, may fix issues with plugins checking for permissions on login events --- .../main/java/me/lucko/luckperms/BukkitListener.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java b/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java index 7e7a5d7b..e7b149f6 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java +++ b/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java @@ -30,6 +30,7 @@ import me.lucko.luckperms.users.User; import me.lucko.luckperms.utils.AbstractListener; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.*; @@ -43,7 +44,7 @@ class BukkitListener extends AbstractListener implements Listener { this.plugin = plugin; } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) { if (!plugin.getDatastore().isAcceptingLogins()) { // The datastore is disabled, prevent players from joining the server @@ -54,7 +55,7 @@ class BukkitListener extends AbstractListener implements Listener { onAsyncLogin(e.getUniqueId(), e.getName()); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerLogin(PlayerLoginEvent e) { final Player player = e.getPlayer(); final User user = plugin.getUserManager().get(plugin.getUuidCache().getUUID(player.getUniqueId())); @@ -79,7 +80,7 @@ class BukkitListener extends AbstractListener implements Listener { plugin.doAsync(user::refreshPermissions); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerJoin(PlayerJoinEvent e) { // Refresh permissions again UUID internal = plugin.getUuidCache().getUUID(e.getPlayer().getUniqueId()); @@ -87,7 +88,7 @@ class BukkitListener extends AbstractListener implements Listener { plugin.doAsync(() -> refreshPlayer(internal)); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerChangedWorld(PlayerChangedWorldEvent e) { UUID internal = plugin.getUuidCache().getUUID(e.getPlayer().getUniqueId()); plugin.getUserManager().getWorldCache().put(internal, e.getPlayer().getWorld().getName()); @@ -95,7 +96,7 @@ class BukkitListener extends AbstractListener implements Listener { } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerQuit(PlayerQuitEvent e) { plugin.getUserManager().getWorldCache().remove(plugin.getUuidCache().getUUID(e.getPlayer().getUniqueId())); onLeave(e.getPlayer().getUniqueId());