How to get a offline player uuid?

Discussion in 'Plugin Development' started by Eskillu, Jan 30, 2015.

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

    Eskillu

    How i get a offline player uuid and get uuid from player never logged in the server?
     
  2. Offline

    teej107

    @Eskillu Have you tried looking in the Bukkit Documentation?
     
  3. Offline

    Eskillu

    Yes, but i don't know get a uuid from a player never logged in server
     
  4. Offline

    teej107

    Do you know how to get an OfflinePlayer?
     
    Eskillu likes this.
  5. Offline

    nverdier

    @Eskillu Every seen this? Right on the documentation... Clearly you haven't read it very clearly...
     
    Eskillu likes this.
  6. Offline

    sirrus86

    If you need the UUID of an OfflinePlayer who's never been on a given server, the only thing left to work with is their name... which is no longer a stable method to get a player.

    Out of curiosity, why would you need the UUID of a player who's never been on the server your plugin is made for?
     
    Eskillu likes this.
  7. Offline

    nverdier

    There's a few days left, don't rush it :p
     
    Eskillu likes this.
  8. Offline

    Eskillu

    Server support nickname change for 1.8.

    Thanks for all, i don't see the getUniqueId() in OfflinePlayer(). '-'
     
  9. Offline

    nverdier

    @Eskillu But if you get the UUID from the username (the 'nickname') just to support name changing, then isn't that... counter-intuitive and pointless?
     
  10. Offline

    FerusGrim

    You're all missing the point. There are plenty of valid reasons to attempt to get the UUID of a player who's never played on the server, before. Whitelist plugins, for instance.

    You cannot get the real UUID of a player who's never played before. An OfflinePlayer object for a non-existing player in storage is just a placeholder. The method will never return null, but that doesn't make the values valid.

    However, there are plenty of tools in which you can use to get the UUID from the Mojang servers. All of which are considered blocking calls and should be done asynchronously.

    Check out this resource.
     
    sirrus86 likes this.
  11. Offline

    teej107

    @FerusGrim You can get the real UUID for an OfflinePlayer. Your server has to be in online mode to get the real UUID else it does get a invalid UUID.
     
    Konato_K likes this.
  12. Offline

    FerusGrim

    @teej107 We're referring to players who've never joined the server before. Server#getOfflinePlayer(String) does not perform a UUID lookup, and therefore cannot produce a valid ID for non-existing players.
     
  13. Offline

    nverdier

    @Eskillu @teej107 I've seen a method somewhere in Github to do this... Maybe try searching for 'UUID Fetcher'?
     
  14. Offline

    sirrus86

    You mean the link @FerusGrim posted a few posts up? :p
     
    FerusGrim likes this.
  15. Offline

    nverdier

    @sirrus86 haha didn't look at that too closely, but yeah, that's it :D
     
    FerusGrim likes this.
  16. Offline

    CubieX

    Nor can the query tool for the mojang server.
    Problem was already mentioned:
    You can't say if a given name (however you got it) does belong to the player you have in your mind at the moment you are querying him.
    Even if the player was online at a time, there is a small but always present chance he has chosen another name in the meantime.
    However, there is no better way to do this. So querying the Mojang server is the only option.

    That's also the reason for me to see the UUID system as "broken".
    Because it's against the human mind to make an abstract number the only unique identification for a player.
    It works fine for backend systems, but as soon as it comes to human interaction (mainly player commands that use a reference to an offline player), this system fails miserably. And yeah, my ranting is totally offtopic... :rolleyes:
     
  17. Offline

    FerusGrim

    @CubieX

    This is just nonsense. The UUID lookup protocol by Mojang's sole purpose is for UUID lookups.

    Unless you're accepting a whitelist request that's over a month old, yes you can. Read the Mojang blog sometime, yeah?

    Again, this is pure nonsense. It's been stated by every official source several times that a player cannot change their name while they're online. Not to mention that you wouldn't even do a lookup for an online player, when you could just get the UUID of the online player.

    Of course it is... This doesn't even make sense to comment about. How else would you get the UUID of a player without having them on your server? Magic, do you suppose?

    You realize that every game, forum, website, cms, or piece of software on the planet that allows for name-changes has some form of unique identification, right? The UUID system isn't broken, just your understanding of a blatantly obvious concept.

    Not only are UUIDs not numbers, but rather a collection of characters, but it's totally not against the human mind to use IDs for other people. Look at your own Library Card, or Driver's License, or Social Security Number. People in real life can change their name and therefore need a form of unique identification.

    Of course it works in the back-end. No one is expecting to type a command with a UUID. That's what we have the UUID Lookup System for! So we can convert names into UUIDs. Which all happens on the backend. IMAGINE THAT!
     
  18. Offline

    CubieX

    I don't want to abuse this thread any further.
    So my last statement is this:
    Off topic (open)

    I referenced your last sentence of you post where you said:
    The same is true for the query service in this case. That was what I meant here.

    No you can't. You don't know when the player changed his name the last time if he does not tell you.
    It could be only 1 hour after you queried him the last time. So next time you are screwed if you do not use his UUID instead to issue a player-related command for him.

    I refered to an offline player who has been online at least once. So you know he exists, but he is not currently online. Maybe I did not use the correct english tense here.

    Yes. But you never have to refer to a user by his ID when managing or messaging him in any way.
    You can always use his current name.
    Why? Because in a forum or other site at least the administrator knows if someone changed his name, because I have never seen a forum or any other site that allows user-namechanges (other than aliases) without admin intervention.
    And if it does, there is usually a log file to record this. It's possible to log it, because the change is done on-site.
    Not on some other server of another company.
    So you never run into a situation where no one hosting a site knows if someone has chosen a new name.
    But in MC you have to record a user name and his UUID at least once to have a future reference if he is still him.
    And if he changes his name, you have no way to tell his current name, because we can only query UUIDs by name, but not names by UUID. (At least the last time I checket, there was no such method. I filed a JIIRA ticket at mojang because of that.) and therefore have no way to refer to him with his current name. You would have to use his UUID in commands from this moment on.
    But players can't handle UUIDs for referencing other players in normal gameplay. It's not natural.
    Which makes my point valid.

    I meant you can manage players just fine by using UUIDs. That's what we do in plugins now.
    But in-game its not practical to use a UUID for referencing offline players. As already said.
    But you frickin' have to, once someone changed his name and didn't tell you his new name.
    That's what I meant here.
     
  19. Offline

    sirrus86

    All of this aside, I think we can agree that the UUID fetcher will accomplish what the OP is trying to do... so, solved?
     
    FerusGrim likes this.
Thread Status:
Not open for further replies.

Share This Page