Fixing WorldUtil (wrong constant usage)

This commit is contained in:
Marc Baloup 2024-01-21 00:45:19 +01:00
parent a39f3d8143
commit 90009b8703

View File

@ -32,10 +32,10 @@ public class WorldUtil {
if (new File(worldFolder, "region").isDirectory()) if (new File(worldFolder, "region").isDirectory())
return Environment.NORMAL; return Environment.NORMAL;
if (new File(worldFolder, "DIM-1" + File.pathSeparator + "region").isDirectory()) if (new File(worldFolder, "DIM-1" + File.separator + "region").isDirectory())
return Environment.NETHER; return Environment.NETHER;
if (new File(worldFolder, "DIM1" + File.pathSeparator + "region").isDirectory()) if (new File(worldFolder, "DIM1" + File.separator + "region").isDirectory())
return Environment.THE_END; return Environment.THE_END;
throw new IllegalStateException("Unable to determine the type of the world " + world + "."); throw new IllegalStateException("Unable to determine the type of the world " + world + ".");
@ -48,8 +48,8 @@ public class WorldUtil {
File file = switch (env) { File file = switch (env) {
case NORMAL -> new File(worldFolder, "region"); case NORMAL -> new File(worldFolder, "region");
case NETHER -> new File(worldFolder, "DIM-1" + File.pathSeparator + "region"); case NETHER -> new File(worldFolder, "DIM-1" + File.separator + "region");
case THE_END -> new File(worldFolder, "DIM1" + File.pathSeparator + "region"); case THE_END -> new File(worldFolder, "DIM1" + File.separator + "region");
case CUSTOM -> throw new IllegalStateException("The provided world '" + world + "' has a custom Environment type. Unable to tell where the region are stored."); case CUSTOM -> throw new IllegalStateException("The provided world '" + world + "' has a custom Environment type. Unable to tell where the region are stored.");
}; };