diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2014-03-28 21:12:42 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-03-29 16:49:09 -0500 |
commit | ee4a919469235eff1ace9c4559b860c4184ea35e (patch) | |
tree | 8d27c0151c170ef111e2d1b4b1f9db37385f7579 /src/main/java/org | |
parent | 7c4a4dc3b2b26d0ee4fd0d52f50f2d699963aa04 (diff) | |
download | bukkit-ee4a919469235eff1ace9c4559b860c4184ea35e.tar bukkit-ee4a919469235eff1ace9c4559b860c4184ea35e.tar.gz bukkit-ee4a919469235eff1ace9c4559b860c4184ea35e.tar.lz bukkit-ee4a919469235eff1ace9c4559b860c4184ea35e.tar.xz bukkit-ee4a919469235eff1ace9c4559b860c4184ea35e.zip |
Add API for dealing with player UUIDs. Adds BUKKIT-5071, BUKKIT-5501
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/Bukkit.java | 18 | ||||
-rw-r--r-- | src/main/java/org/bukkit/OfflinePlayer.java | 11 | ||||
-rw-r--r-- | src/main/java/org/bukkit/Server.java | 32 |
3 files changed, 61 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index 53f8a372..6b9c9f3a 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -182,6 +182,7 @@ public final class Bukkit { /** * @see Server#getPlayer(String name) */ + @Deprecated public static Player getPlayer(String name) { return server.getPlayer(name); } @@ -189,11 +190,19 @@ public final class Bukkit { /** * @see Server#matchPlayer(String name) */ + @Deprecated public static List<Player> matchPlayer(String name) { return server.matchPlayer(name); } /** + * @see Server#getPlayer(java.util.UUID) + */ + public static Player getPlayer(UUID id) { + return server.getPlayer(id); + } + + /** * @see Server#getPluginManager() */ public static PluginManager getPluginManager() { @@ -408,13 +417,22 @@ public final class Bukkit { /** * @see Server#getOfflinePlayer(String name) */ + @Deprecated public static OfflinePlayer getOfflinePlayer(String name) { return server.getOfflinePlayer(name); } /** + * @see Server#getOfflinePlayer(java.util.UUID) + */ + public static OfflinePlayer getOfflinePlayer(UUID id) { + return server.getOfflinePlayer(id); + } + + /** * @see Server#getPlayerExact(String name) */ + @Deprecated public static Player getPlayerExact(String name) { return server.getPlayerExact(name); } diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java index 48a50a30..cbf87462 100644 --- a/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java @@ -1,6 +1,7 @@ package org.bukkit; import java.util.Date; +import java.util.UUID; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.entity.AnimalTamer; @@ -19,11 +20,21 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio /** * Returns the name of this player * + * @deprecated Use {@link #getUniqueId()} as player names are no longer + * guaranteed to be unique * @return Player name */ + @Deprecated public String getName(); /** + * Returns the UUID of this player + * + * @return Player UUID + */ + public UUID getUniqueId(); + + /** * Checks if this player is banned or not * * @return true if banned, otherwise false diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index b51b924e..d2cb5175 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -268,17 +268,23 @@ public interface Server extends PluginMessageRecipient { * <p> * This method may not return objects for offline players. * + * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer + * guaranteed to be unique * @param name the name to look up * @return a player if one was found, null otherwise */ + @Deprecated public Player getPlayer(String name); /** * Gets the player with the exact given name, case insensitive. * + * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer + * guaranteed to be unique * @param name Exact name of the player to retrieve * @return a player object if one was found, null otherwise */ + @Deprecated public Player getPlayerExact(String name); /** @@ -288,12 +294,23 @@ public interface Server extends PluginMessageRecipient { * This list is not sorted in any particular order. If an exact match is * found, the returned list will only contain a single result. * + * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer + * guaranteed to be unique * @param name the (partial) name to match * @return list of all possible players */ + @Deprecated public List<Player> matchPlayer(String name); /** + * Gets the player with the given UUID. + * + * @param id UUID of the player to retrieve + * @return a player object if one was found, null otherwise + */ + public Player getPlayer(UUID id); + + /** * Gets the plugin manager for interfacing with plugins. * * @return a plugin manager for this Server instance @@ -544,12 +561,27 @@ public interface Server extends PluginMessageRecipient { * This will return an object even if the player does not exist. To this * method, all players will exist. * + * @deprecated Use {@link #getOfflinePlayer(UUID)} as player names are no + * longer guaranteed to be unique * @param name the name the player to retrieve * @return an offline player */ + @Deprecated public OfflinePlayer getOfflinePlayer(String name); /** + * Gets the player by the given UUID, regardless if they are offline or + * online. + * <p> + * This will return an object even if the player does not exist. To this + * method, all players will exist. + * + * @param id the UUID of the player to retrieve + * @return an offline player + */ + public OfflinePlayer getOfflinePlayer(UUID id); + + /** * Gets a set containing all current IPs that are banned. * * @return a set containing banned IP addresses |