From 90026906518ea79c2f143c959cb479e5e8200906 Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Sat, 17 Mar 2012 20:00:56 -0500 Subject: [PATCH] Implement asynchronous pre-login event; Addresses BUKKIT-1213 --- .../java/net/minecraft/server/ThreadLoginVerifier.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java index e6e2d7e809..52685c21ad 100644 --- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java +++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java @@ -7,6 +7,7 @@ import java.net.URLEncoder; // CraftBukkit start import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent; // CraftBukkit end @@ -41,7 +42,13 @@ class ThreadLoginVerifier extends Thread { return; } + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(this.loginPacket.name, this.netLoginHandler.getSocket().getInetAddress()); + this.server.getPluginManager().callEvent(asyncEvent); + PlayerPreLoginEvent event = new PlayerPreLoginEvent(this.loginPacket.name, this.netLoginHandler.getSocket().getInetAddress()); + if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { + event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); + } this.server.getPluginManager().callEvent(event); if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {