Sponge identifies world by internal NBT world name

Created on 30 Nov 2016  路  6Comments  路  Source: SpongePowered/Sponge

If you load a world with Server#loadWorld(String) or get its name with World#getName()
the expected/returned world name is the one from the internal NBT data, not the name of the world folder.
So if you rename the world folder like you were easily able to do with Bukkit, the world won't load with the new name. If you have tens of worlds which got renamed a long time ago and whose internal names differ from the folder names or even if you just want to rename the world today, you can't load it anymore.

Would it be possible to change the standard behaviour so that Sponge finds worlds by it's folder name or add a config option to change the behaviour?

Thanks in advance.

world bug

All 6 comments

@kashike @gravityfox
Why was this fix chosen over fetching worlds with a sane identifier, like the directory?
Isn't the name inside that file literally just a display name for singleplayer / servers / plugins?

I'm pretty sure single player allows duplicates here, and adds hypens to the directory when copying if the name isn't changed.

the expected/returned world name is the one from the internal NBT data, not the name of the world folder.

No! the expected world is the one with the directory name. if you are loading a world you arn't even yet aware of the internal aliases / names.

If you need a method that loads via the name, you need to deal with multiple matches, you should prompt the user to disambiguate with directory details listed.

The most common use case as a server admin is taking a copy of the world, renaming the directory without changing the names / uuids, then attempting to load it to test something.

If both worlds are loaded simultaneously, the load should fail due to duplicate UUID and prompt the user to allow changing one of them (i.e. plugins are going to lose association with one of these worlds) maybe even create an event for this.

Okay... due to the bad wording of the original issue, i'm going to make a few assumptions that i want corrected if needed.
This is what i read the issue as:

  • Server#loadWorld(String) currently expects the NBT name for its parameter
  • World#getName() currently returns the NBT name of the world.
  • Server#loadWorld(String) SHOULD expect a directory name.
  • World#getName() SHOULD return the directory name.

Is this correct? I honestly have no idea what anyone is talking about... so I want for this to be clarified.

loadWorld -> Directory name
getName -> Directory name (??)
setName -> NBT name

See the issue with the API?...in that the name is being used as both NBT and directory when...

A. NBT name should be changeable and is the display name
B. Directory name isn't changeable (beyond our copy function)

This will be resolved by me very soon in API 7.

Name might even be text to legacy

Okay this fell off of my radar (need to do up my own issue list..). It'll have to go into API 8 now.

Someone create an API issue, and assign me to it (staff) and target API 8.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Xemiru picture Xemiru  路  3Comments

XakepSDK picture XakepSDK  路  5Comments

Grinch picture Grinch  路  4Comments

gabizou picture gabizou  路  5Comments

PurpleIsEverything picture PurpleIsEverything  路  4Comments