Solved How can i get the uuid from a string name?

Discussion in 'Plugin Development' started by stink123456, Apr 26, 2014.

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

    stink123456

    Hello everyone,
    i need to get the player from a string (something like /add <player>), but i noticed the Bukkit.getOfflinePlayer method is deprecated so is there another way to get the uuid or something?
    Thank you!
     
  2. Offline

    JWhy

    You may still use getOfflinePlayer(String name) where you only know a player's name, the deprecation annotation is only a hint to use UUIDs rather than player names. But the only case I can think of is user interaction, e.g. when a player used the command "/tp stink123456" and a plugin had to get the UUID from the player's name
     
  3. Offline

    Heirteir

  4. Offline

    stink123456

    Aah allright, i thought so. It would be weird of bukkit to remove that.

    Hmm well thats nice but as you can read from the post above the deprecation is just to notify developers.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  5. Offline

    Vastrix

    If you wanna see whether a player is still online by using:
    Code:java
    1. getServer().getPlayer(args[0]) //args0 being a username (string)

    then how can one get the UUID from that string? (Without using any special libraries :p)

    the way i see it this is pretty much the only way, no?
    which makes me wonder if the @deprecated tag is really necessary? :s
     
  6. Offline

    Dealyise

    Check the String with your snippet above and then simply check with getUniqueID().
     
  7. Offline

    Vastrix

    Dealyise
    Yes i'm aware :p
    but now with the UUID's there must be another way like:
    Code:java
    1. getServer().getPlayer(args[0].getUUID()) //ofc won't work but this should give you the idea :p
     
Thread Status:
Not open for further replies.

Share This Page