From 880f2c11a512f34afdc50442dda16b918f17b65b Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Fri, 7 Jan 2011 16:25:52 -0800 Subject: [PATCH] Added passenger methods to Vehicle/LivingEntity. By: sk89q --- .../main/java/org/bukkit/LivingEntity.java | 24 +++++++++++++++++++ .../src/main/java/org/bukkit/Vehicle.java | 15 ++++++++++++ 2 files changed, 39 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/LivingEntity.java b/paper-api/src/main/java/org/bukkit/LivingEntity.java index d1bd9180db..f0987ba28a 100644 --- a/paper-api/src/main/java/org/bukkit/LivingEntity.java +++ b/paper-api/src/main/java/org/bukkit/LivingEntity.java @@ -35,4 +35,28 @@ public interface LivingEntity extends Entity { * @return */ public Arrow shootArrow(); + + /** + * Returns whether this entity is inside a vehicle. + * + * @return + */ + public boolean isInsideVehicle(); + + /** + * Leave the current vehicle. If the entity is currently in a vehicle + * (and is removed from it), true will be returned, otherwise false will + * be returned. + * + * @return + */ + public boolean leaveVehicle(); + + /** + * Get the vehicle that this player is inside. If there is no vehicle, + * null will be returned. + * + * @return + */ + public Vehicle getVehicle(); } diff --git a/paper-api/src/main/java/org/bukkit/Vehicle.java b/paper-api/src/main/java/org/bukkit/Vehicle.java index 6fb95b8ca2..76b7267be4 100644 --- a/paper-api/src/main/java/org/bukkit/Vehicle.java +++ b/paper-api/src/main/java/org/bukkit/Vehicle.java @@ -28,10 +28,25 @@ public interface Vehicle extends Entity { */ public Entity getPassenger(); + /** + * Set the passenger of a vehicle. + * + * @param passenger + * @return false if it could not be done for whatever reason + */ + public boolean setPassenger(Entity passenger); + /** * Returns true if the vehicle has no passengers. * * @return */ public boolean isEmpty(); + + /** + * Eject any passenger. True if there was a passenger. + * + * @return + */ + public boolean eject(); }