Player Class, UUID, Lists

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

  1. Offline


    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. Offline

    timtower Administrator Administrator Moderator

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


    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


    Will try getPlayerListName()
    Thanks for the help!
    If it doesn't work, I'll try getUniqueId

Share This Page