Archiviert
13
0

Implemented VEHICLE_EXIT

Dieser Commit ist enthalten in:
Dinnerbone 2011-02-01 10:02:43 +00:00
Ursprung 6f13c9dc55
Commit 408ed37a01

Datei anzeigen

@ -12,9 +12,12 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.entity.CraftVehicle;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleCollisionEvent; import org.bukkit.event.vehicle.VehicleCollisionEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
public abstract class Entity { public abstract class Entity {
@ -992,12 +995,30 @@ public abstract class Entity {
this.e = 0.0D; this.e = 0.0D;
if (entity == null) { if (entity == null) {
if (this.vehicle != 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.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.passenger = null;
} }
this.vehicle = null; this.vehicle = null;
} else if (this.vehicle == entity) { } 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.passenger = null;
this.vehicle = null; this.vehicle = null;
this.c(entity.locX, entity.boundingBox.b + (double) entity.width, entity.locZ, this.yaw, this.pitch); this.c(entity.locX, entity.boundingBox.b + (double) entity.width, entity.locZ, this.yaw, this.pitch);