summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 89979c72..a3bd30d9 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -258,30 +258,47 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
- public void a(double d0, double d1, double d2, float f, float f1) {
- // CraftBukkit start
+ // CraftBukkit start -- Delegate for a(double, double, double, float, float)
+ 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 = new Location(player.getWorld(), d0, d1, d2, f, f1);
+ Location to = dest.clone();
PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_TELEPORT, player, from, to);
server.getPluginManager().callEvent(event);
from = event.getFrom();
to = event.isCancelled() ? from : event.getTo();
+ double d0, d1, d2;
+ float f, f1;
+
d0 = to.getX();
d1 = to.getY();
d2 = to.getZ();
f = to.getYaw();
f1 = to.getPitch();
- // CraftBukkit end
+ // net.minecraft.server start
this.l = false;
this.i = d0;
this.j = d1;
this.k = d2;
this.e.b(d0, d1, d2, f, f1);
this.e.a.b((Packet) (new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false)));
+ // net.minecraft.server end
+
+ // Returns TRUE if the teleport was successful
+ return !event.isCancelled();
+ }
+ // CraftBukkit end
+
+ 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));
+ // CraftBukkit end
}
public void a(Packet14BlockDig packet14blockdig) {