mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 21:17:00 +01:00
Implemented VEHICLE_EXIT
This commit is contained in:
parent
6f13c9dc55
commit
408ed37a01
1 changed files with 21 additions and 0 deletions
|
@ -12,9 +12,12 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.entity.CraftVehicle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
|
||||
public abstract class Entity {
|
||||
|
||||
|
@ -992,12 +995,30 @@ public abstract class Entity {
|
|||
this.e = 0.0D;
|
||||
if (entity == null) {
|
||||
if (this.vehicle != null) {
|
||||
// Craftbukkit start
|
||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
|
||||
CraftVehicle cvehicle = (CraftVehicle)vehicle.getBukkitEntity();
|
||||
LivingEntity living = (LivingEntity)getBukkitEntity();
|
||||
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living);
|
||||
((WorldServer)world).getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
this.c(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.width, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
this.vehicle.passenger = null;
|
||||
}
|
||||
|
||||
this.vehicle = null;
|
||||
} else if (this.vehicle == entity) {
|
||||
// Craftbukkit start
|
||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
|
||||
CraftVehicle cvehicle = (CraftVehicle)vehicle.getBukkitEntity();
|
||||
LivingEntity living = (LivingEntity)getBukkitEntity();
|
||||
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living);
|
||||
((WorldServer)world).getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// Craftbukkit end
|
||||
|
||||
this.vehicle.passenger = null;
|
||||
this.vehicle = null;
|
||||
this.c(entity.locX, entity.boundingBox.b + (double) entity.width, entity.locZ, this.yaw, this.pitch);
|
||||
|
|
Loading…
Reference in a new issue