TeamJM / journeymap

JourneyMap mod for Minecraft
http://journeymap.info
121 stars 10 forks source link

[Bug]: Renaming a Server causes all Waypoints to vanish #715

Open pumpkinhasapatch opened 3 weeks ago

pumpkinhasapatch commented 3 weeks ago

What happened?

Minecraft version: Fabric 1.20.6 Mod version: 5.9.32 (This has also happened on every other version of JourneyMap I've tried)

Description: When a server name is changed in the Multiplayer Menu, a new folder for that server is created in .minecraft/journeymap/data/mp and all previous data including Waypoints is kept in a folder with the old Server Name and ignored by the JourneyMap mod.

This is frustrating because I have to manually go into that folder in my Minecraft install, rename the folder Minecraft-Server to match the new name and change spaces to dashes (-).

Possible fix: When a Server is edited in the Multiplayer Menu and name change is detected, rename the appropriate folder in .minecraft/journeymap/data/mp.

Mod Loader

Fabric

Minecraft Version

other (please list)

Version

other (please list)

Relevant log output

A log does not seem to be relevant here. You can easily reproduce the bug yourself with the instructions above. I am using default JourneyMap settings and will upload if needed.

mysticdrew commented 3 weeks ago

This is not a bug. This is how saving server data works. There is no good solution to saving multiplayer data. IPs can change, users can change the name of the server on the client. I do plan on adding an import/export option to make it a bit easier so you don't need to manually move the files.

I thought about adding a hook to the multiplayer screen to detect a name change. However, this scenario is also problematic. Example. User creates a server with the default name "Minecraft Server" connects to the server, JourneyMap is on the server so it sends the worldId, it creates a folder named Minecraft~Server_worldidvalue, they play it for a bit, then leave. Then they add a new server and also name it "Minecraft Server" (this is extremely common) log into the server, it does not have journeymap on it. So, we use the seedId that is sent from the server by vanilla. It creates a folder named Minecraft~Server_id-12341234. This scenario is why we use worldId or seedId(which can be 0 on many public bukkit/spigot servers)

They exit back to the multiplayer menu and edit the name of one of the servers that displays in the menu as "Minecraft Server" to "CoolServer". Okay, so which one did they edit?

The ID is sent from the server, in the menu we don't know which one is which.

This is an issue I have been thinking about for a long long time to solve. I am going to close this as it is not a but, just an annoyance and I do plan to add more solutions. It is well known issue. However, we can still discuss it here if you wish.

mysticdrew commented 3 weeks ago

Okay, so just wanted to give you an update. I think we may have a solution that is near perfect in theory. I have yet to implement or test it yet, but I think it will work.

Update : Okay that didn't pan out, I was looking into using the public auth token the server sends in the handshake to clients since it is unique, but that changes every time the server starts up.

What I am considering: Is instead of going with "WorldName_ID" for the folder name. We go with "WorldName_IP_PORT" at the base folder level, I can monitor those fields if a user updates them and then update the folder name when it changes. Then inside that folder will contain the "WorldID" or separate "IP:PORT" folders. So when a user connects to a server with multiple servers like bungeecord servers. All the world folders are contained inside the base folder.

I have also thought about adding a hash to the servers.dat folder for each server entry, and that maps to the path where the data folder is for that server. However, then if a user wants to share the data files with other users on the server, that can be a bit complex and some launchers overwrite the file and that may erase our entries.

So, this is not something that will come soon as I am in the middle of the waypoint rewrite, which is my priority and needs to be done asap so we can get v6 out the door. After that I will make this a priority.

pumpkinhasapatch commented 2 weeks ago

Thanks for the quick reply, it seems this is a well-known issue and you have tried a lot of things to solve it already.

I tried to look into the mod myself to search for solutions, but I realised this repo is empty and all code is under a "ARR license" (I guess this means All Rights Reserved) and I'm not that experienced with Java. Oh well...

It might not be completely possible to fix this, but you could add the Menu Hook and move folders around anyway, just so it doesn't wipe player's Waypoint data every time a Server Name is changed. If there is ever a conflict where two Minecraft Servers or folders have the same name, tell the user and open the journeymap folder for them to manually sort it themselves.

We just have to do this carefully in a way that won't corrupt map data or show Waypoints on the wrong server (which has happened to me on a few Bungee servers with custom worlds).