From dc4f50aef4334a2d25c3d4681c7f241039753f6d Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 12 Aug 2012 15:28:37 +0200 Subject: [PATCH] Setting the net server handler at the earliest possible point. --- src/fr/neatmonster/nocheatplus/NoCheatPlus.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/NoCheatPlus.java b/src/fr/neatmonster/nocheatplus/NoCheatPlus.java index aad02e80..daa3edec 100644 --- a/src/fr/neatmonster/nocheatplus/NoCheatPlus.java +++ b/src/fr/neatmonster/nocheatplus/NoCheatPlus.java @@ -17,6 +17,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; @@ -121,6 +122,17 @@ public class NoCheatPlus extends JavaPlugin implements Listener { final void onExecuteActions(final ExecuteActionsEvent event) { event.executeActions(); } + + /** + * Setting the net server handler at the earliest possible point. + * @param event + */ + @EventHandler( + priority = EventPriority.LOWEST) + public void onPlayerLogin(final PlayerLoginEvent event) { + // Set the NetServerHandler of the player. + setCustomNetServerHandler(event.getPlayer()); + } /** * This event handler is used to send all the disabling messages to the client. @@ -133,9 +145,6 @@ public class NoCheatPlus extends JavaPlugin implements Listener { public void onPlayerJoin(final PlayerJoinEvent event) { final Player player = event.getPlayer(); - // Set the NetServerHandler of the player. - setCustomNetServerHandler(player); - // Check if we allow all the client mods. final boolean allowAll = ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS); String message = "";