Add player unique ID to (Async)PlayerPreLoginEvent. Adds BUKKIT-5108

By: BlackHole <black-hole@live.com>
This commit is contained in:
Bukkit/Spigot
2013-12-09 02:41:17 +01:00
parent cf7171f968
commit 9476b86738
2 changed files with 34 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package org.bukkit.event.player;
import java.net.InetAddress;
import java.util.UUID;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -16,13 +17,20 @@ public class AsyncPlayerPreLoginEvent extends Event {
private String message;
private final String name;
private final InetAddress ipAddress;
private final UUID uniqueId;
@Deprecated
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);
this.result = Result.ALLOWED;
this.message = "";
this.name = name;
this.ipAddress = ipAddress;
this.uniqueId = uniqueId;
}
/**
@@ -140,6 +148,15 @@ public class AsyncPlayerPreLoginEvent extends Event {
return ipAddress;
}
/**
* Gets the player's unique ID.
*
* @return The unique ID
*/
public UUID getUniqueId() {
return uniqueId;
}
@Override
public HandlerList getHandlers() {
return handlers;

View File

@@ -1,6 +1,7 @@
package org.bukkit.event.player;
import java.net.InetAddress;
import java.util.UUID;
import org.bukkit.Warning;
import org.bukkit.event.Event;
@@ -21,12 +22,19 @@ public class PlayerPreLoginEvent extends Event {
private String message;
private final String name;
private final InetAddress ipAddress;
private final UUID uniqueId;
@Deprecated
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.message = "";
this.name = name;
this.ipAddress = ipAddress;
this.uniqueId = uniqueId;
}
/**
@@ -108,6 +116,15 @@ public class PlayerPreLoginEvent extends Event {
return handlers;
}
/**
* Gets the player's unique ID.
*
* @return The unique ID
*/
public UUID getUniqueId() {
return uniqueId;
}
public static HandlerList getHandlerList() {
return handlers;
}