Prevent re-use of internal world dimension IDs. This fixes BUKKIT-448. Thanks to snowleo for the PR.

This commit is contained in:
Nathan Adams 2012-01-19 16:09:24 +00:00
parent b0f29b1755
commit 28fcbec3b1

View File

@ -540,6 +540,16 @@ public final class CraftServer implements Server {
} }
int dimension = 10 + console.worlds.size(); int dimension = 10 + console.worlds.size();
boolean used = false;
do {
for (WorldServer server : console.worlds) {
used = server.dimension == dimension;
if (used) {
dimension++;
break;
}
}
} while(used);
boolean hardcore = false; boolean hardcore = false;
WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), true, hardcore, type), creator.environment(), generator); WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), true, hardcore, type), creator.environment(), generator);