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

View File

@ -168,10 +168,15 @@ public void unregisterAllListeners() {
} }
@Override @Override
public UUID getUUIDForWorld(File worldFolder) throws IOException { public UUID getUUIDForWorld(final File worldPath) throws IOException {
//if it is a dimension folder //if it is a dimension folder
if (!new File(worldFolder, "level.dat").exists()) { File worldFolder = worldPath;
worldFolder = worldFolder.getParentFile(); 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(); final File normalizedWorldFolder = worldFolder.getCanonicalFile();