diff options
author | md_5 <git@md-5.net> | 2017-01-04 10:52:59 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-01-04 10:52:59 +1100 |
commit | a17b015899fd9a82d63b61c5a37a52ecbfb89b9e (patch) | |
tree | f404b4e6684728c4c8ef59afac95827369950439 /src/main/java | |
parent | 0c3c33be49c10bb442d14bb4205e7d6df80f30b0 (diff) | |
download | bukkit-a17b015899fd9a82d63b61c5a37a52ecbfb89b9e.tar bukkit-a17b015899fd9a82d63b61c5a37a52ecbfb89b9e.tar.gz bukkit-a17b015899fd9a82d63b61c5a37a52ecbfb89b9e.tar.lz bukkit-a17b015899fd9a82d63b61c5a37a52ecbfb89b9e.tar.xz bukkit-a17b015899fd9a82d63b61c5a37a52ecbfb89b9e.zip |
SPIGOT-2640: API for multiple passengers per entity
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/entity/Entity.java | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java index 759e3f0d..b4a70518 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -179,30 +179,62 @@ public interface Entity extends Metadatable, CommandSender, Nameable { * multiple passengers, this will only return the primary passenger. * * @return an entity + * @deprecated entities may have multiple passengers, use + * {@link #getPassengers()} */ - public abstract Entity getPassenger(); + @Deprecated + public Entity getPassenger(); /** * Set the passenger of a vehicle. * * @param passenger The new passenger. * @return false if it could not be done for whatever reason + * @deprecated entities may have multiple passengers, use + * {@link #getPassengers()} */ - public abstract boolean setPassenger(Entity passenger); + @Deprecated + public boolean setPassenger(Entity passenger); + + /** + * Gets a list of passengers of this vehicle. + * <p> + * The returned list will not be directly linked to the entity's current + * passengers, and no guarantees are made as to its mutability. + * + * @return list of entities corresponding to current passengers. + */ + public List<Entity> getPassengers(); + + /** + * Add a passenger to the vehicle. + * + * @param passenger The passenger to add + * @return false if it could not be done for whatever reason + */ + public boolean addPassenger(Entity passenger); + + /** + * Remove a passenger from the vehicle. + * + * @param passenger The passenger to remove + * @return false if it could not be done for whatever reason + */ + public boolean removePassenger(Entity passenger); /** * Check if a vehicle has passengers. * * @return True if the vehicle has no passengers. */ - public abstract boolean isEmpty(); + public boolean isEmpty(); /** * Eject any passenger. * * @return True if there was a passenger. */ - public abstract boolean eject(); + public boolean eject(); /** * Returns the distance this entity has fallen |