Solved Getting a string from a config without knowing the path

Discussion in 'Plugin Development' started by Levy03, Aug 22, 2014.

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

    Levy03

    So I want to get a players name from a config but its sorted under their UUID like this:
    blah.{UUID}.name
    so how do I search through the config to get their name without needing the UUID
    I cant use the getUniqueId() method because I want to be able to get it while the player is offline
     
  2. Offline

    Onlineids

    Levy03 OfflinePlayer pl = Bukkit.getOfflinePlayer(NAME)
    UUID id = pl.getUniqueId()
     
  3. Offline

    DevSock

    Levy03
    Code:java
    1. Bukkit.getOfflinePlayer("Levy03").getUniqueId().toString();


    Is this what you're looking for? It gets an offline player by their name and then gets that player's UUID and sets it to a string. You'd obviously have to do your own null conditionals and such.

    Onlineids
    Dang, you ninja'd me! His code is the exact same as mine just mine is done on one line.

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

    Levy03

    Gah I feel so stupid, I didnt even know there was a getOfflinePlayer method. Thanks guys!
     
  5. Offline

    DevSock

    Levy03 No problem, be sure to set the prefix of the thread to solved in case others come to see the thread as well!
     
Thread Status:
Not open for further replies.

Share This Page