diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-24 20:00:55 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-24 20:00:55 +0000 |
commit | 47b4406b7e7c183b69bf47222f7cc36e5c696845 (patch) | |
tree | 05dcf7c999402c84e6549aa236527c282608c7cc /src/main/java/net/minecraft/server/ServerConfigurationManager.java | |
parent | 61edd3637825ed68784a47caafe7ed947ecc4fb6 (diff) | |
download | craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar.gz craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar.lz craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar.xz craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.zip |
I've either fixed going to The End, or made it worse. I'm sure we'll find out soon!
Diffstat (limited to 'src/main/java/net/minecraft/server/ServerConfigurationManager.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ServerConfigurationManager.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index f1a66bfc..1ff21bde 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -305,7 +305,7 @@ public class ServerConfigurationManager { public void a(EntityPlayer entityplayer, int i) { // CraftBukkit start -- Replaced the standard handling of portals with a more customised method. - int dimension = entityplayer.dimension; + int dimension = i; WorldServer fromWorld = this.server.getWorldServer(dimension); WorldServer toWorld = null; if (dimension < 10) { @@ -315,13 +315,28 @@ public class ServerConfigurationManager { } } } - 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 = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch); + Location toLocation = null; + + if (toWorld != null) { + if ((dimension == -1) || (dimension == 0)) { + double blockRatio = dimension == 0 ? 8 : 0.125; + + toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch); + } else { + ChunkCoordinates coords = toWorld.d(); + toLocation = new Location(toWorld.getWorld(), coords.x, coords.y, coords.z, 90, 0); + } + } org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent(); PlayerPortalEvent event = new PlayerPortalEvent((Player) entityplayer.getBukkitEntity(), fromLocation, toLocation, pta); + + if (entityplayer.dimension == 1) { + event.useTravelAgent(false); + } + Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled() || event.getTo() == null) { return; |