diff --git a/CraftBukkit-Patches/0022-Compensate-for-allow-nether-allow-end-as-false-BUKKI.patch b/CraftBukkit-Patches/0022-Compensate-for-allow-nether-allow-end-as-false-BUKKI.patch deleted file mode 100644 index 8d3489a81e..0000000000 --- a/CraftBukkit-Patches/0022-Compensate-for-allow-nether-allow-end-as-false-BUKKI.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 06e1d0e6a51ad056751c7e4ed6660b3692b49db9 Mon Sep 17 00:00:00 2001 -From: EdGruberman -Date: Sun, 20 Jan 2013 23:13:04 -0700 -Subject: [PATCH] Compensate for allow-nether/allow-end as false; 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. ---- - src/main/java/net/minecraft/server/PlayerList.java | 34 ++++++++++++++++------ - .../java/org/bukkit/craftbukkit/CraftServer.java | 2 +- - .../java/org/bukkit/craftbukkit/CraftWorld.java | 2 ++ - 3 files changed, 28 insertions(+), 10 deletions(-) - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index ced8cf0..642a4d9 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -424,24 +424,40 @@ public abstract class PlayerList { - - // CraftBukkit start - Replaced the standard handling of portals with a more customised method. - public void changeDimension(EntityPlayer entityplayer, int i, TeleportCause cause) { -- WorldServer exitWorld = this.server.getWorldServer(i); -+ WorldServer exitWorld = null; -+ if (entityplayer.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds -+ // only target existing worlds (compensate for allow-nether/allow-end as false) -+ for (WorldServer world : this.server.worlds) { -+ if (world.dimension == i) { -+ exitWorld = world; -+ } -+ } -+ } -+ - Location enter = entityplayer.getBukkitEntity().getLocation(); - Location exit = null; -- if ((cause == TeleportCause.END_PORTAL) && (i == 0)) { -- // THE_END -> NORMAL; use bed if available -- exit = ((CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); -- } -- if (exit == null) { -- exit = this.calculateTarget(enter, exitWorld); -+ if (exitWorld != null) { -+ if ((cause == TeleportCause.END_PORTAL) && (i == 0)) { -+ // THE_END -> NORMAL; use bed if available -+ exit = ((CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); -+ } -+ if (exit == null) { -+ exit = this.calculateTarget(enter, exitWorld); -+ } - } - -- TravelAgent agent = (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s(); -+ TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : null; - PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause); - Bukkit.getServer().getPluginManager().callEvent(event); - if (event.isCancelled() || event.getTo() == null) { - return; - } -- exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(exit) : event.getTo(); -+ -+ if (event.useTravelAgent() && event.getPortalTravelAgent() != null) { -+ exit = event.getPortalTravelAgent().findOrCreate(exit); -+ } else { -+ exit = event.getTo(); -+ } - exitWorld = ((CraftWorld) exit.getWorld()).getHandle(); - - Vector velocity = entityplayer.getBukkitEntity().getVelocity(); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index dac1cb7..e7a459b 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -719,7 +719,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/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 4861609..21bd64a 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/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(); --- -1.8.0.3 - diff --git a/CraftBukkit-Patches/0023-Reduce-number-of-LivingEntity-collision-checks.patch b/CraftBukkit-Patches/0022-Reduce-number-of-LivingEntity-collision-checks.patch similarity index 100% rename from CraftBukkit-Patches/0023-Reduce-number-of-LivingEntity-collision-checks.patch rename to CraftBukkit-Patches/0022-Reduce-number-of-LivingEntity-collision-checks.patch