Solved Config UUID to Bukkit.getPlayer(UUID)

Discussion in 'Plugin Development' started by AsapRocky, Jan 28, 2017.

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

    AsapRocky

    Hello.
    I'm having a problem and it's really bugging me.
    Basically I set UUID's to a config file.
    When I do
    Code:
    Bukkit.broadCastMessage(CONFIG UUID)
    I get a UUID in the chat.
    However just under that I have a
    Code:
    Player p = Bukkit.getPlayer(CONFIG UUID);
    And it doesn't work.I just get a nullpointer..
    I need help :)
    upload_2017-1-28_14-54-10.png
     
  2. Offline

    timtower Administrator Administrator Moderator

    @AsapRocky What kind of UUID do you get? How do you save it?
     
    JanTuck likes this.
  3. Offline

    AsapRocky

    I get this in chat, which is the same as in the config.It gets saved in the config properly so that's not where the problem is.The problem is that it broadcasts the UUID yet I can't get Player out of that UUID><
    upload_2017-1-28_15-2-21.png
     
  4. Offline

    timtower Administrator Administrator Moderator

    @AsapRocky I honestly don't think that the UUID.fromString throws an NPE,
    p.sendMessage is high likely to throw one though as you never check if the player exists.
     
    I Al Istannen likes this.
  5. Offline

    I Al Istannen

    @AsapRocky
    The Bukkit.getPlayer method returns null if the player was not found.

    Can you post the stacktrace you get? The error in the console, that is.
     
  6. Offline

    AsapRocky

    SOLVED.
    Sorry, I looked at the wrong class in the nullpointer....
     
Thread Status:
Not open for further replies.

Share This Page