diff --git a/paper-api/src/main/java/org/bukkit/Vehicle.java b/paper-api/src/main/java/org/bukkit/Vehicle.java index 245c671fa7..6fb95b8ca2 100644 --- a/paper-api/src/main/java/org/bukkit/Vehicle.java +++ b/paper-api/src/main/java/org/bukkit/Vehicle.java @@ -24,9 +24,9 @@ public interface Vehicle extends Entity { * Gets the primary passenger of a vehicle. For vehicles that could have * multiple passengers, this will only return the primary passenger. * - * @return a living entity + * @return an entity */ - public LivingEntity getPassenger(); + public Entity getPassenger(); /** * Returns true if the vehicle has no passengers. diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java index efc7609447..a6279d4c41 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleCreateEvent.java @@ -1,5 +1,6 @@ package org.bukkit.event.vehicle; +import org.bukkit.Vector; import org.bukkit.Vehicle; /** @@ -8,8 +9,41 @@ import org.bukkit.Vehicle; * @author sk89q */ public class VehicleCreateEvent extends VehicleEvent { - public VehicleCreateEvent(Type type, Vehicle vehicle) { + private boolean slowWhenEmpty; + private Vector derailedVelocityFactor; + private Vector flyingVelocityFactor; + + public VehicleCreateEvent(Type type, Vehicle vehicle, + boolean slowWhenEmpty, Vector derailedVelocityFactor, + Vector flyingVelocityFactor) { + super(type, vehicle); + this.slowWhenEmpty = slowWhenEmpty; + this.derailedVelocityFactor = derailedVelocityFactor; + this.flyingVelocityFactor = flyingVelocityFactor; + } + + public void setSlowWhenEmpty(boolean setting) { + slowWhenEmpty = setting; + } + + public boolean shouldSlowWhenEmpty() { + return slowWhenEmpty; + } + + public void setDerailedVelocityFactor(Vector setting) { + derailedVelocityFactor = setting.clone(); + } + + public Vector getDerailedVelocityFactor() { + return derailedVelocityFactor.clone(); + } + + public void setFlyingVelocityFactor(Vector setting) { + flyingVelocityFactor = setting.clone(); + } + + public Vector getFlyingVelocityFactor() { + return flyingVelocityFactor.clone(); } - } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java index da8fc30c3c..5ac6242822 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEnterEvent.java @@ -1,30 +1,30 @@ package org.bukkit.event.vehicle; -import org.bukkit.LivingEntity; +import org.bukkit.Entity; import org.bukkit.Vehicle; import org.bukkit.event.Cancellable; /** - * Raised when a living entity enters a vehicle. + * Raised when an entity enters a vehicle. * * @author sk89q */ public class VehicleEnterEvent extends VehicleEvent implements Cancellable { private boolean cancelled; - private LivingEntity entered; + private Entity entered; - public VehicleEnterEvent(Type type, Vehicle vehicle, LivingEntity entered) { + public VehicleEnterEvent(Type type, Vehicle vehicle, Entity entered) { super(type, vehicle); this.entered = entered; } /** - * Get the living entity that entered the vehicle. + * Get the entity that entered the vehicle. * * @return */ - public LivingEntity getEntered() { + public Entity getEntered() { return entered; } diff --git a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java index fe2c3b71c6..514c569767 100644 --- a/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java @@ -2,14 +2,18 @@ package org.bukkit.event.vehicle; import org.bukkit.Entity; import org.bukkit.Vehicle; +import org.bukkit.event.Cancellable; /** * Raised when a vehicle collides with an entity. * * @author sk89q */ -public class VehicleEntityCollisionEvent extends VehicleCollisionEvent { +public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implements Cancellable { private Entity entity; + private boolean cancelled = false; + private boolean cancelledPickup = false; + private boolean cancelledCollision = false; public VehicleEntityCollisionEvent(Type type, Vehicle vehicle, Entity entity) { super(type, vehicle); @@ -19,4 +23,28 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent { public Entity getEntity() { return entity; } + + public boolean isCancelled() { + return cancelled; + } + + public void setCancelled(boolean cancel) { + this.cancelled = cancel; + } + + public boolean isPickupCancelled() { + return cancelledPickup; + } + + public void setPickupCancelled(boolean cancel) { + cancelledPickup = cancel; + } + + public boolean isCollisionCancelled() { + return cancelledCollision; + } + + public void setCollisionCancelled(boolean cancel) { + cancelledCollision = cancel; + } }