Rename Player

Rename Player

Postby JCB » Fri Apr 05, 2019 12:46 am

Hello,

I see in 5.0 the players are in and SQL database.

How can one rename a player and maintain all inventory etc...

Thank you

JC
JCB
Member
 
Posts: 10
Joined: Thu Mar 21, 2019 8:12 pm

Re: Rename Player

Postby sofar » Fri Apr 05, 2019 6:35 am

you'd have to update the sqlite tables while MT is shut down. For information on that, look up the sqlite3 online documentation, it has almost everything you need to know.
sofar
Developer
 
Posts: 2034
Joined: Fri Jan 16, 2015 7:31 am
GitHub: sofar
In-game: sofar

Re: Rename Player

Postby Linuxdirk » Fri Apr 05, 2019 8:48 am

Wow, I thought about the exact same thing this morning ...

What happens with locked chests, iron doors, etc. when renaming the player? Do we need to manually replace all "oldplayer" with "newplayer" in all databases or are the players handled via IDs?
Linuxdirk
Member
 
Posts: 1901
Joined: Wed Sep 17, 2014 11:21 am
In-game: Linuxdirk

Re: Rename Player

Postby sofar » Fri Apr 05, 2019 3:45 pm

Linuxdirk wrote:Wow, I thought about the exact same thing this morning ...

What happens with locked chests, iron doors, etc. when renaming the player? Do we need to manually replace all "oldplayer" with "newplayer" in all databases or are the players handled via IDs?


Owner names are stored in nodemeta, so, you'd have to run lua code to convert ownerships.
sofar
Developer
 
Posts: 2034
Joined: Fri Jan 16, 2015 7:31 am
GitHub: sofar
In-game: sofar

Re: Rename Player

Postby micheal65536 » Fri Apr 05, 2019 5:23 pm

Linuxdirk wrote:What happens with locked chests, iron doors, etc. when renaming the player? Do we need to manually replace all "oldplayer" with "newplayer" in all databases or are the players handled via IDs?

Neither. Locked chests, doors, etc. would keep the old name of the player, but there's no practical way to update them to use the new name of the player because this information is stored separately for every single locked/owned node. For this reason, renaming Minetest players is pretty much impossible in real-world situations and is normally avoided.

Some time I might write a tool to read through an entire Minetest map and update the metadata on every locked node owned by the player, however running such a tool on a moderately-sized Minetest map would be a time-consuming exercise that would have to be carried out while the server is offline. An alternative could be to use an LBM however every player that has ever been renamed would have to be handled forever after by the LBM on every chunk load, unless you had some way of ensuring that there are no remaining locked/owned nodes in the map with the player's old name - in other words, this is pretty much impossible in real-world situations.
micheal65536
Member
 
Posts: 114
Joined: Mon May 22, 2017 8:27 pm

Re: Rename Player

Postby Linuxdirk » Fri Apr 05, 2019 7:11 pm

micheal65536 wrote:Some time I might write a tool to read through an entire Minetest map and update the metadata on every locked node owned by the player, […]

Shouldn’t this be possible to do by directly accessing the world database while the server is offline? Just checked the map.sqlite. Looks like you just need to somehow decode the blob for each node, replace the name, encode it, and write the changed blob to the database.
Linuxdirk
Member
 
Posts: 1901
Joined: Wed Sep 17, 2014 11:21 am
In-game: Linuxdirk

Re: Rename Player

Postby sofar » Fri Apr 05, 2019 8:21 pm

Linuxdirk wrote:Looks like you just need to somehow decode the blob for each node, replace the name, encode it, and write the changed blob to the database.


certainly possible, but you could do something like this in a mod and do it on demand, which is generally much more efficient.

But really, why do you want to rename a player? Did someone threaten you with a GDPR?
sofar
Developer
 
Posts: 2034
Joined: Fri Jan 16, 2015 7:31 am
GitHub: sofar
In-game: sofar

Re: Rename Player

Postby Linuxdirk » Fri Apr 05, 2019 11:37 pm

Just curious.
Linuxdirk
Member
 
Posts: 1901
Joined: Wed Sep 17, 2014 11:21 am
In-game: Linuxdirk



Return to Problems



Who is online

Users browsing this forum: Yandex Bot [Bot] and 0 guests