summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index fe0f2006..b8a9a148 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -201,10 +201,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public boolean teleport(Location location, TeleportCause cause) {
- if (entity.vehicle != null || entity.passenger != null || entity.dead) {
+ if (entity.passenger != null || entity.dead) {
return false;
}
+ // If this entity is riding another entity, we must dismount before teleporting.
+ entity.mount(null);
+
entity.world = ((CraftWorld) location.getWorld()).getHandle();
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// entity.setLocation() throws no event, and so cannot be cancelled
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9760f8f9..bbf310b0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -458,7 +458,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return false;
}
- if (entity.vehicle != null || entity.passenger != null) {
+ if (entity.passenger != null) {
return false;
}
@@ -475,6 +475,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return false;
}
+ // If this player is riding another entity, we must dismount before teleporting.
+ entity.mount(null);
+
// Update the From Location
from = event.getFrom();
// Grab the new To Location dependent on whether the event was cancelled.