diff options
author | Rigby <rigby@onarandombox.com> | 2011-07-26 21:14:52 +0100 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-08-05 16:01:27 -0400 |
commit | ae43b837b026f2afec55558f83b2a854857270e9 (patch) | |
tree | 586d4515f0a47fcc323246ce31f40696bc5b0ba0 /src/main/java | |
parent | a7f2798862620dc7886dbe91a59755e2cee3d937 (diff) | |
download | craftbukkit-ae43b837b026f2afec55558f83b2a854857270e9.tar craftbukkit-ae43b837b026f2afec55558f83b2a854857270e9.tar.gz craftbukkit-ae43b837b026f2afec55558f83b2a854857270e9.tar.lz craftbukkit-ae43b837b026f2afec55558f83b2a854857270e9.tar.xz craftbukkit-ae43b837b026f2afec55558f83b2a854857270e9.zip |
Prevent Nether Portals from teleporting the player from Bukkit worlds to the Nether.
Plugins would need to provide a To Location for Nether Portals to work in Bukkit Worlds.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/minecraft/server/ServerConfigurationManager.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 0d8d6219..c7bb9f07 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -276,16 +276,24 @@ public class ServerConfigurationManager { // CraftBukkit start -- Replaced the standard handling of portals with a more customised method. int dimension = entityplayer.dimension; WorldServer fromWorld = this.server.getWorldServer(dimension); - WorldServer toWorld = this.server.getWorldServer(dimension == -1 ? 0 : -1); + WorldServer toWorld = null; + if (dimension < 10) { + int toDimension = dimension == -1 ? 0 : -1; + for (WorldServer world : this.server.worlds) { + if (world.dimension == toDimension) { + toWorld = world; + } + } + } double blockRatio = dimension == -1 ? 8 : 0.125; Location fromLocation = new Location(fromWorld.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); - Location toLocation = new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch); + Location toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch); org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent(); PlayerPortalEvent event = new PlayerPortalEvent((Player) entityplayer.getBukkitEntity(), fromLocation, toLocation, pta); Bukkit.getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { + if (event.isCancelled() || event.getTo() == null) { return; } |