mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Add player unique ID to (Async)PlayerPreLoginEvent. Adds BUKKIT-5108
This commit is contained in:
parent
8d77687e7a
commit
903575ff2e
1 changed files with 3 additions and 2 deletions
|
@ -33,13 +33,14 @@ class ThreadPlayerLookupUUID extends Thread {
|
||||||
|
|
||||||
String playerName = LoginListener.d(this.a).getName();
|
String playerName = LoginListener.d(this.a).getName();
|
||||||
java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
|
java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
|
||||||
|
java.util.UUID uniqueId = UtilUUID.b(LoginListener.d(this.a).getId());
|
||||||
final org.bukkit.craftbukkit.CraftServer server = LoginListener.b(this.a).server;
|
final org.bukkit.craftbukkit.CraftServer server = LoginListener.b(this.a).server;
|
||||||
|
|
||||||
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address);
|
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
|
||||||
server.getPluginManager().callEvent(asyncEvent);
|
server.getPluginManager().callEvent(asyncEvent);
|
||||||
|
|
||||||
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
|
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
|
||||||
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address);
|
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
|
||||||
if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
|
if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
|
||||||
event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
|
event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue