From 78e16bd8deebb66acf94f3229f33a971882c4c55 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 22 Jan 2013 18:36:03 -0700 Subject: [PATCH] Compensate for allow-nether/allow-end as false; Fixes BUKKIT-3466 When either of those settings are false, the worlds are not loaded and therefore will not be targeted for portal exits. Existing worlds are iterated directly to avoid defaulting to the first world if a direct dimension match is not found. Plugins must also specify exit from custom Bukkit worlds to comply with original commit: https://github.com/Bukkit/CraftBukkit/commit/2dc2af0 This commit introduces a constant to clarify the dependency on the CraftBukkit implementation of custom worlds having a dimension offset. By: EdGruberman --- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 2 +- .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 eecededea..e7c0760fd 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -694,7 +694,7 @@ public final class CraftServer implements Server { converter.convert(name, new ConvertProgressUpdater(console)); } - int dimension = 10 + console.worlds.size(); + int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worlds.size(); boolean used = false; do { for (WorldServer server : console.worlds) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index cb200667c..6e364b1a8 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -49,6 +49,8 @@ import org.bukkit.plugin.messaging.StandardMessenger; import org.bukkit.craftbukkit.util.LongHash; public class CraftWorld implements World { + public static final int CUSTOM_DIMENSION_OFFSET = 10; + private final WorldServer world; private Environment environment; private final CraftServer server = (CraftServer) Bukkit.getServer();