Setting the net server handler at the earliest possible point.

This commit is contained in:
asofold 2012-08-12 15:28:37 +02:00
parent 83804c7059
commit dc4f50aef4

View File

@ -17,6 +17,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -122,6 +123,17 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
event.executeActions(); 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. * 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) { public void onPlayerJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
// Set the NetServerHandler of the player.
setCustomNetServerHandler(player);
// Check if we allow all the client mods. // Check if we allow all the client mods.
final boolean allowAll = ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS); final boolean allowAll = ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS);
String message = ""; String message = "";