Fix resourcepack worlds not being detected on spigot

This commit is contained in:
Blue (Lukas Rieger) 2021-09-17 17:14:40 +02:00
parent 34d89ae0fe
commit 93ae59708e
No known key found for this signature in database
GPG Key ID: 904C4995F9E1F800
1 changed files with 8 additions and 3 deletions

View File

@ -168,10 +168,15 @@ public class BukkitPlugin extends JavaPlugin implements ServerInterface, Listene
}
@Override
public UUID getUUIDForWorld(File worldFolder) throws IOException {
public UUID getUUIDForWorld(final File worldPath) throws IOException {
//if it is a dimension folder
if (!new File(worldFolder, "level.dat").exists()) {
worldFolder = worldFolder.getParentFile();
File worldFolder = worldPath;
while (!new File(worldFolder, "level.dat").exists()) {
File parent = worldFolder.getParentFile();
if (parent != null)
worldFolder = parent;
else
throw new IOException("Unable to find a level.dat for world: '" + worldPath + "'");
}
final File normalizedWorldFolder = worldFolder.getCanonicalFile();