Status: Resolved (View Workflow)
OC: Windows 10
This problem is absent in version 1.12.2.
I also made a video demonstration of it -http://https://youtu.be/QeBh7F6VFzM
CraftBukkit version 3227-Spigot-3c1fc60-a0a37f4 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT)
Any world-management plugin
First of all, it is worth mentioning that all actions are performed with the server always running.
The problem is that when you delete a folder of the world (after unloading this world), this folder is only partially deleted. The folders "entities" and "poi" remain, which contain ".mca" files.
They cannot be removed even manually(when server is running). I also noticed that the ".mca" files disappear on their own some time later(about 1 hour). So, since this cleanup method exists somewhere, I think it should be executed directly in the Bukkit # unloadWorld method.
And if u create a new world with same name BEFORE ".mca" files will be removed, this will give a huge(5000 lines) crash in the console "Failed to read chunk [x, z]", "java.nio.file.AccessDeniedException: world2\entities\r.-1.0.mca".
How do I get the error?
1. Create an additional world. And teleport into it. (With bukkit WorldCreator)
2. Summon any entity and wait for world-saving. (or use /save-all command)
3. Teleport into main world.
4. Unload the additional world. (Bukkit.unloadWorld("worldname", false);)
5. Using any method, delete the folder with the additional world and all the files it contains.
6. Done. See that the folder is not completely deleted. It contains the "entities" folder, which contains "r.0.-1.mca" (Or something like that).
7. Now, when creating and load a new world with the same name, you will get a huge error in the console.
I'm sure it shouldn't work that way, we should have free access to delete worlds like on 1.12.2.