Player Class, UUID, Lists

Discussion in 'Plugin Development' started by JCW2016, May 11, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    JCW2016

    Hello everyone!
    I've been working on making a plugin which checks if all players are ready
    However, I have just found out that using player.getDisplayName does not return the username, and instead returns the username in some tags and brackets, e.g. [CraftPlayer{name=FrutBerreyz}], and the only workaround I can think of is splicing.

    Is there a better way to find a unique player identifier, like username or uuid? If not, what methods do you recommend?
     
  2. Online

    timtower Administrator Administrator Moderator

    @JCW2016 I suggest UUID, can't change
     
  3. Offline

    davidclue

    If you want to get a players name you use player.getName() and if you are trying to get a player for an instance then use Bukkit.getPlayer(UUID);
     
  4. Offline

    JCW2016

    Will try getPlayerListName()
    Thanks for the help!
    If it doesn't work, I'll try getUniqueId
     
Thread Status:
Not open for further replies.

Share This Page