问题
How to get an offline player by UUID? I can get an online player by UUID by iterating through all online players and return when an UUID matches, but I don't know how to do this for offline players.
回答1:
Beta build of CraftBukkit (1.7.9-R0.1) has the method you need in org.bukkit.Server
interface:
/**
* 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);
JavaDoc
Related issue: BUKKIT-5501
Related commit: 4bc86be4
来源:https://stackoverflow.com/questions/23788976/how-to-get-an-offline-player-by-uuid