Fixed the PLAYER_TELEPORT event so event.getTo().getWorld() is correct. (#451)

This commit is contained in:
Byron Shelden
2011-03-22 23:50:14 -07:00
committed by Erik Broes
parent d08ee17352
commit 376ac51cea
3 changed files with 56 additions and 19 deletions

View File

@@ -107,13 +107,23 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return ((WorldServer)entity.world).getWorld();
}
public void teleportTo(Location location) {
public boolean teleport(Location location) {
entity.world = ((CraftWorld)location.getWorld()).getHandle();
entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// entity.b() throws no event, and so cannot be cancelled
return true;
}
public boolean teleport(org.bukkit.entity.Entity destination) {
return teleport(destination.getLocation());
}
public void teleportTo(Location location) {
teleport(location);
}
public void teleportTo(org.bukkit.entity.Entity destination) {
teleportTo(destination.getLocation());
teleport(destination);
}
public int getEntityId() {