Jump to content

Recommended Posts

Posted

I am having difficulty with my mod in getting the UUID of an offline player from their name. How can I do this? I am using forge version 1.12.2 - 14.23.1.2555.

•Fact: Updating a mod to a new version of minecraft takes time. Especially if the original mod was never open source.

•Fact: The more users pester people who make mods to update their mods to a new version of minecraft, the less likely it is that it will be quickly updated.

•Fact: The more you comment about it, the more likely you are to be ignored.

•Fact: The more recent the last post about updating a mod is, the more annoying yours will be.

•Fact: Using all caps does not reverse any of the above effects

Posted

I don't know if it's possible to get from UUID from offline player (I haven't tried it before) but you can save player uuid to configuration file when he logged in server first time, and you can check his nickname from configuration file. If I remember correct, playerLoginEvent or LoggedIn event could be suitable for this.

Posted (edited)
11 hours ago, diesieben07 said:

An offline player by definition has no real UUID. There is code to create some fake UUID based on the name, but this is terrible, since the UUID will then change once they are online again (this will make the player's pets forget their owner, etc.).

 

You should not play offline :P

Maybe the OP is talking about player's that are not present on the world or players that are not really logged on?

Edited by Differentiation
  • 2 weeks later...
Posted (edited)

I mean the UUID that is used to keep stuff like inventory when you change your username and track previous names.

 

By  offline I mean they are not on the server. Not that they pirated the game or something.

 

I figured it out. Make an HTTP GET request to https://api.mojang.com/users/profiles/minecraft/username?at=time, but replacing the username and time with the actual username and time. the ?at= portion is not required. It returns the UUID and the name they had at the given time, in JSON format. You can go there with your own name to check this. 

Edited by DaComputerNerd

•Fact: Updating a mod to a new version of minecraft takes time. Especially if the original mod was never open source.

•Fact: The more users pester people who make mods to update their mods to a new version of minecraft, the less likely it is that it will be quickly updated.

•Fact: The more you comment about it, the more likely you are to be ignored.

•Fact: The more recent the last post about updating a mod is, the more annoying yours will be.

•Fact: Using all caps does not reverse any of the above effects

  • 3 weeks later...
Posted
On 1/28/2018 at 7:35 AM, diesieben07 said:

You should use PlayerProfileCache::getGameProfileForUsername instead, which will only make a request to the API if needed and cache results.

Good to know. Finding documentation was difficult.

My mod stores the data during runtime anyways, and makes the request when the command is run and the player is not found in the hashmap. 

•Fact: Updating a mod to a new version of minecraft takes time. Especially if the original mod was never open source.

•Fact: The more users pester people who make mods to update their mods to a new version of minecraft, the less likely it is that it will be quickly updated.

•Fact: The more you comment about it, the more likely you are to be ignored.

•Fact: The more recent the last post about updating a mod is, the more annoying yours will be.

•Fact: Using all caps does not reverse any of the above effects

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.