diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-06-10 22:59:54 -0400 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-06-11 01:33:37 -0400 |
commit | 5b93f5565a1807f6aae771aae935a021409dba29 (patch) | |
tree | 65f15ec06b85b781aacd07b3a6f67196024e3a9a /src/main/java/net/minecraft/server/NetServerHandler.java | |
parent | cd12f057a75868ca3eb131413494c2ee0e182497 (diff) | |
download | craftbukkit-5b93f5565a1807f6aae771aae935a021409dba29.tar craftbukkit-5b93f5565a1807f6aae771aae935a021409dba29.tar.gz craftbukkit-5b93f5565a1807f6aae771aae935a021409dba29.tar.lz craftbukkit-5b93f5565a1807f6aae771aae935a021409dba29.tar.xz craftbukkit-5b93f5565a1807f6aae771aae935a021409dba29.zip |
Fixed from and to worlds being the same for a PlayerTeleportEvent for crossworld teleports. Thanks for the help Rigby and Verrier! Tahg is responsible for the mess.
Diffstat (limited to 'src/main/java/net/minecraft/server/NetServerHandler.java')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index b1aaab05..6a2eb2f7 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -358,30 +358,27 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public void a(double d0, double d1, double d2, float f, float f1) { // CraftBukkit start - Delegate to teleport(Location) - teleport(new Location(getPlayer().getWorld(), d0, d1, d2, f, f1)); - } - - public boolean teleport(Location dest) { - // Note: the world in location is used only for the event - // Inter-world teleportation is handled in CraftPlayer.teleport() - Player player = getPlayer(); Location from = player.getLocation(); - Location to = dest.clone(); + Location to = new Location(getPlayer().getWorld(), d0, d1, d2, f, f1); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); server.getPluginManager().callEvent(event); from = event.getFrom(); to = event.isCancelled() ? from : event.getTo(); + teleport(to); + } + + public void teleport(Location dest) { double d0, d1, d2; float f, f1; - d0 = to.getX(); - d1 = to.getY(); - d2 = to.getZ(); - f = to.getYaw(); - f1 = to.getPitch(); + d0 = dest.getX(); + d1 = dest.getY(); + d2 = dest.getZ(); + f = dest.getYaw(); + f1 = dest.getPitch(); // TODO: make sure this is the best way to address this. if (Float.isNaN(f)) { @@ -399,9 +396,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.z = d2; this.player.setLocation(d0, d1, d2, f, f1); this.player.netServerHandler.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false)); - - // CraftBukkit - Returns TRUE if the teleport was successful - return !event.isCancelled(); } public void a(Packet14BlockDig packet14blockdig) { |