mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-13 19:25:49 -07:00
Add player unique ID to (Async)PlayerPreLoginEvent. Adds BUKKIT-5108
By: BlackHole <black-hole@live.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.bukkit.event.player;
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -16,13 +17,20 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
|||||||
private String message;
|
private String message;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final InetAddress ipAddress;
|
private final InetAddress ipAddress;
|
||||||
|
private final UUID uniqueId;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public AsyncPlayerPreLoginEvent(final String name, final InetAddress ipAddress) {
|
public AsyncPlayerPreLoginEvent(final String name, final InetAddress ipAddress) {
|
||||||
|
this(name, ipAddress, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AsyncPlayerPreLoginEvent(final String name, final InetAddress ipAddress, final UUID uniqueId) {
|
||||||
super(true);
|
super(true);
|
||||||
this.result = Result.ALLOWED;
|
this.result = Result.ALLOWED;
|
||||||
this.message = "";
|
this.message = "";
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.ipAddress = ipAddress;
|
this.ipAddress = ipAddress;
|
||||||
|
this.uniqueId = uniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,6 +148,15 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
|||||||
return ipAddress;
|
return ipAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the player's unique ID.
|
||||||
|
*
|
||||||
|
* @return The unique ID
|
||||||
|
*/
|
||||||
|
public UUID getUniqueId() {
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package org.bukkit.event.player;
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Warning;
|
import org.bukkit.Warning;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
@@ -21,12 +22,19 @@ public class PlayerPreLoginEvent extends Event {
|
|||||||
private String message;
|
private String message;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final InetAddress ipAddress;
|
private final InetAddress ipAddress;
|
||||||
|
private final UUID uniqueId;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public PlayerPreLoginEvent(final String name, final InetAddress ipAddress) {
|
public PlayerPreLoginEvent(final String name, final InetAddress ipAddress) {
|
||||||
|
this(name, ipAddress, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerPreLoginEvent(final String name, final InetAddress ipAddress, final UUID uniqueId) {
|
||||||
this.result = Result.ALLOWED;
|
this.result = Result.ALLOWED;
|
||||||
this.message = "";
|
this.message = "";
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.ipAddress = ipAddress;
|
this.ipAddress = ipAddress;
|
||||||
|
this.uniqueId = uniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,6 +116,15 @@ public class PlayerPreLoginEvent extends Event {
|
|||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the player's unique ID.
|
||||||
|
*
|
||||||
|
* @return The unique ID
|
||||||
|
*/
|
||||||
|
public UUID getUniqueId() {
|
||||||
|
return uniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user