How to get an offline player by UUID?

我们两清 提交于 2019-12-25 06:29:23

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!