Solved Player from UUID returning null?

Discussion in 'Plugin Development' started by excusemyluck, Sep 2, 2014.

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

    excusemyluck

    Code:java
    1. for (String listPlayerUUID : friendsList) {
    2. Player playerName = Bukkit.getPlayer(UUID
    3. .fromString(listPlayerUUID));
    4. returnList.add(ChatColor.GREEN + "" + playerName
    5. + ChatColor.RESET);
    6. }


    This part of code is returning null, well the player variable at least. I have tried many of things to get the uuid from the string, but no matter what, the player still returns null. Any help is greatly appreciated!
     
  2. Offline

    Skionz

  3. Offline

    excusemyluck

    Skionz Yes because I reloaded the server and the file remained the same before and after the reload
     
  4. Offline

    Skionz

    excusemyluck Try getting rid of the part where it gets the players name from their uuid and see if that works so that it just sends the player a message with their friends uuid instead of their name. Just to debug and such.
     
  5. Offline

    excusemyluck

    Skionz Still returning empty, oh and the path is correct (just trying to solve any questions I can)
     
  6. Offline

    Totom3

    excusemyluck Then your config isn't saving. Check you code again, lines 23 & 24. That will print the hashCode() of your list. I noticed also a few other errors :

    - Line 11 : you're calling toString()... on a String! :p
    - Line 13 : you forgot to make sure the player isn't null (if he's offline or doesn't exist, getPlayer() will return null).
    - Line 14 : not an error, but you don't need the "== true".
     
  7. Offline

    excusemyluck


    Well line 24 was for debugging and line 23 worked in the other version of the plugin. It's still sending the list, but there is nothing in the list.

    Also, line 11 is because I've been writing the ".toString()" WAYYYYYYY too much lol
    and line 14 is just a habit

    OP UPDATED INSTEAD OF MAKING A NEW POST!

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

    BillyGalbreath

  9. Offline

    excusemyluck

  10. Offline

    BillyGalbreath

    Then your server is in offline mode and none of this is going to work for you.
     
  11. Offline

    excusemyluck

    Holy shit I didn't think that would have an effect! Thank you~
     
  12. Offline

    BillyGalbreath

    I was just as shocked when I found out too. But it makes sense. The server has to communicate with the Mojang servers to convert uuid to player/names.
     
  13. Offline

    JaguarJo

    Locked. We don't support offline mode servers.
     
Thread Status:
Not open for further replies.

Share This Page