From 7a89ffdf351c5dd9e0ab350b30ec2425ccb17a07 Mon Sep 17 00:00:00 2001 From: William Date: Sat, 22 Jan 2022 22:32:44 +0000 Subject: [PATCH] Make event priority LOWEST --- .../bukkit/listener/BukkitEventListener.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/me/william278/husksync/bukkit/listener/BukkitEventListener.java b/bukkit/src/main/java/me/william278/husksync/bukkit/listener/BukkitEventListener.java index 89a56923..b34ca3f3 100644 --- a/bukkit/src/main/java/me/william278/husksync/bukkit/listener/BukkitEventListener.java +++ b/bukkit/src/main/java/me/william278/husksync/bukkit/listener/BukkitEventListener.java @@ -22,7 +22,7 @@ public class BukkitEventListener implements Listener { private static final HuskSyncBukkit plugin = HuskSyncBukkit.getInstance(); - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerQuit(PlayerQuitEvent event) { // When a player leaves a Bukkit server final Player player = event.getPlayer(); @@ -33,13 +33,14 @@ public class BukkitEventListener implements Listener { return; } - if (!plugin.isEnabled() || !HuskSyncBukkit.handshakeCompleted || HuskSyncBukkit.isMySqlPlayerDataBridgeInstalled) return; // If the plugin has not been initialized correctly + if (!plugin.isEnabled() || !HuskSyncBukkit.handshakeCompleted || HuskSyncBukkit.isMySqlPlayerDataBridgeInstalled) + return; // If the plugin has not been initialized correctly // Update the player's data PlayerSetter.updatePlayerData(player); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerJoin(PlayerJoinEvent event) { if (!plugin.isEnabled()) return; // If the plugin has not been initialized correctly @@ -49,7 +50,8 @@ public class BukkitEventListener implements Listener { // Mark the player as awaiting data fetch HuskSyncBukkit.bukkitCache.setAwaitingDataFetch(player.getUniqueId()); - if (!HuskSyncBukkit.handshakeCompleted || HuskSyncBukkit.isMySqlPlayerDataBridgeInstalled) return; // If the data handshake has not been completed yet (or MySqlPlayerDataBridge is installed) + if (!HuskSyncBukkit.handshakeCompleted || HuskSyncBukkit.isMySqlPlayerDataBridgeInstalled) + return; // If the data handshake has not been completed yet (or MySqlPlayerDataBridge is installed) // Send a redis message requesting the player data (if they need to) if (HuskSyncBukkit.bukkitCache.isPlayerRequestingOnJoin(player.getUniqueId())) { @@ -76,7 +78,8 @@ public class BukkitEventListener implements Listener { @EventHandler public void onInventoryClose(InventoryCloseEvent event) { - if (!plugin.isEnabled() || !HuskSyncBukkit.handshakeCompleted || HuskSyncBukkit.bukkitCache.isAwaitingDataFetch(event.getPlayer().getUniqueId())) return; // If the plugin has not been initialized correctly + if (!plugin.isEnabled() || !HuskSyncBukkit.handshakeCompleted || HuskSyncBukkit.bukkitCache.isAwaitingDataFetch(event.getPlayer().getUniqueId())) + return; // If the plugin has not been initialized correctly // When a player closes an Inventory final Player player = (Player) event.getPlayer();