13
0
geforkt von Mirrors/Paper

Add API for dealing with player UUIDs. Adds BUKKIT-5071, BUKKIT-5501

By: Travis Watkins <amaranth@ubuntu.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2014-03-28 21:12:42 -05:00
Ursprung a742349b87
Commit 43e2fb9739
3 geänderte Dateien mit 61 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -182,6 +182,7 @@ public final class Bukkit {
/** /**
* @see Server#getPlayer(String name) * @see Server#getPlayer(String name)
*/ */
@Deprecated
public static Player getPlayer(String name) { public static Player getPlayer(String name) {
return server.getPlayer(name); return server.getPlayer(name);
} }
@ -189,10 +190,18 @@ public final class Bukkit {
/** /**
* @see Server#matchPlayer(String name) * @see Server#matchPlayer(String name)
*/ */
@Deprecated
public static List<Player> matchPlayer(String name) { public static List<Player> matchPlayer(String name) {
return server.matchPlayer(name); return server.matchPlayer(name);
} }
/**
* @see Server#getPlayer(java.util.UUID)
*/
public static Player getPlayer(UUID id) {
return server.getPlayer(id);
}
/** /**
* @see Server#getPluginManager() * @see Server#getPluginManager()
*/ */
@ -408,13 +417,22 @@ public final class Bukkit {
/** /**
* @see Server#getOfflinePlayer(String name) * @see Server#getOfflinePlayer(String name)
*/ */
@Deprecated
public static OfflinePlayer getOfflinePlayer(String name) { public static OfflinePlayer getOfflinePlayer(String name) {
return server.getOfflinePlayer(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) * @see Server#getPlayerExact(String name)
*/ */
@Deprecated
public static Player getPlayerExact(String name) { public static Player getPlayerExact(String name) {
return server.getPlayerExact(name); return server.getPlayerExact(name);
} }

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit; package org.bukkit;
import java.util.Date; import java.util.Date;
import java.util.UUID;
import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
@ -19,10 +20,20 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
/** /**
* Returns the name of this player * Returns the name of this player
* *
* @deprecated Use {@link #getUniqueId()} as player names are no longer
* guaranteed to be unique
* @return Player name * @return Player name
*/ */
@Deprecated
public String getName(); public String getName();
/**
* Returns the UUID of this player
*
* @return Player UUID
*/
public UUID getUniqueId();
/** /**
* Checks if this player is banned or not * Checks if this player is banned or not
* *

Datei anzeigen

@ -268,17 +268,23 @@ public interface Server extends PluginMessageRecipient {
* <p> * <p>
* This method may not return objects for offline players. * 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 * @param name the name to look up
* @return a player if one was found, null otherwise * @return a player if one was found, null otherwise
*/ */
@Deprecated
public Player getPlayer(String name); public Player getPlayer(String name);
/** /**
* Gets the player with the exact given name, case insensitive. * 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 * @param name Exact name of the player to retrieve
* @return a player object if one was found, null otherwise * @return a player object if one was found, null otherwise
*/ */
@Deprecated
public Player getPlayerExact(String name); public Player getPlayerExact(String name);
/** /**
@ -288,11 +294,22 @@ public interface Server extends PluginMessageRecipient {
* This list is not sorted in any particular order. If an exact match is * This list is not sorted in any particular order. If an exact match is
* found, the returned list will only contain a single result. * 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 * @param name the (partial) name to match
* @return list of all possible players * @return list of all possible players
*/ */
@Deprecated
public List<Player> matchPlayer(String name); 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. * Gets the plugin manager for interfacing with plugins.
* *
@ -544,11 +561,26 @@ public interface Server extends PluginMessageRecipient {
* This will return an object even if the player does not exist. To this * This will return an object even if the player does not exist. To this
* method, all players will exist. * 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 * @param name the name the player to retrieve
* @return an offline player * @return an offline player
*/ */
@Deprecated
public OfflinePlayer getOfflinePlayer(String name); 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. * Gets a set containing all current IPs that are banned.
* *