From 7f9357bd63f026f760687e3e55bd19612db46b81 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 19 Jan 2012 16:09:24 +0000 Subject: [PATCH] Prevent re-use of internal world dimension IDs. This fixes BUKKIT-448. Thanks to snowleo for the PR. By: Nathan Adams --- .../main/java/org/bukkit/craftbukkit/CraftServer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index c4846097f7..f3ed843b22 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -540,6 +540,16 @@ public final class CraftServer implements Server { } 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; WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), true, hardcore, type), creator.environment(), generator);