Solved Getting an OfflinePlayer's Name From UUID

Discussion in 'Plugin Development' started by Freelix2000, May 20, 2014.

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

    Freelix2000

    I am creating a pretty large mini-game plugin that does store lots of player data, and although the update that allows player name changes is not yet out, I have already begun making the plugin write player UUIDs in the data instead of names to prepare for name change support. While the plugin does seem to write the player UUIDs to data fine using the toString() method, I have found that retrieving an OfflinePlayer's UUID, either by using the Bukkit class's getOfflinePlayer(UUID uuid) method or by looping through the OfflinePlayers and comparing each one with the data, it always throws a NoSuchMethodException. I have done some tests and found that it always throws this error when I try to link a UUID to an OfflinePlayer. My method of storing and using UUIDs was writing them to data with the toString() method, then parsing them back into UUIDs with the static method in the UUID object for parsing. After looking at the stacktraces, I have found that the error is not an issue with parsing the UUID, and I am beginning to suspect that it is a problem with Bukkit's API. Is there a fix or another alternative method of getting an OfflinePlayer from a UUID?
     
  2. Offline

    techboy291

    My only guess is the version of the Bukkit API jar you're using is newer than the CraftBukkit jar on your server - in other words, the CraftBukkit jar on your server doesn't have the method Bukkit.getOfflinePlayer(UUID uuid).
     
    Freelix2000 likes this.
  3. Offline

    Freelix2000

    I think you might be right... My test server is still in craftbukkit 1.72. Now I feel stupid. =P I'll update it, test again, and mark this as solved if it works. Thank you for the response. =)

    techboy291
    Yep, that did it. Just another one of my incredibly stupid mistakes. Thanks again for the help.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
Thread Status:
Not open for further replies.

Share This Page