From 53e4a034f4cb1171d22821da5f4a398d125f6576 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Tue, 25 Oct 2011 15:53:43 +0200 Subject: [PATCH] Moved getVehicle, leaveVehicle and isInsideVehicle from CraftLivingEntity to CraftEntity. Addresses BUKKIT-811 --- .../craftbukkit/entity/CraftEntity.java | 22 ++++++++++++++++ .../craftbukkit/entity/CraftLivingEntity.java | 26 ------------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 6252884ab9..1efc870dc5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -9,6 +9,7 @@ import org.bukkit.Server; import org.bukkit.World; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.entity.Vehicle; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; @@ -342,4 +343,25 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public void removeMetadata(String metadataKey, Plugin owningPlugin) { server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin); } + + public boolean isInsideVehicle() { + return getHandle().vehicle != null; + } + + public boolean leaveVehicle() { + if (getHandle().vehicle == null) { + return false; + } + + getHandle().setPassengerOf(null); + return true; + } + + public org.bukkit.entity.Entity getVehicle() { + if (getHandle().vehicle == null) { + return null; + } + + return getHandle().vehicle.getBukkitEntity(); + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 9f69d74f15..c8a413a45d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -128,32 +128,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return launchProjectile(Arrow.class); } - public boolean isInsideVehicle() { - return getHandle().vehicle != null; - } - - public boolean leaveVehicle() { - if (getHandle().vehicle == null) { - return false; - } - - getHandle().setPassengerOf(null); - return true; - } - - public Vehicle getVehicle() { - if (getHandle().vehicle == null) { - return null; - } - - org.bukkit.entity.Entity vehicle = (getHandle().vehicle.getBukkitEntity()); - if (vehicle instanceof Vehicle) { - return (Vehicle) vehicle; - } - - return null; - } - public int getRemainingAir() { return getHandle().getAirTicks(); }