mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Implement asynchronous pre-login event; Addresses BUKKIT-1213
This commit is contained in:
parent
ed6d4c7759
commit
9002690651
1 changed files with 7 additions and 0 deletions
|
@ -7,6 +7,7 @@ import java.net.URLEncoder;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerPreLoginEvent;
|
import org.bukkit.event.player.PlayerPreLoginEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@ -41,7 +42,13 @@ class ThreadLoginVerifier extends Thread {
|
||||||
return;
|
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());
|
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);
|
this.server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
|
if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
|
||||||
|
|
Loading…
Reference in a new issue