Archiviert
13
0

Fix up NPE's in EntityMinecart/CraftVehicle and removed a little un-needed code in EntityArrow

Dieser Commit ist enthalten in:
speakeasy 2011-01-20 05:41:02 +08:00 committet von tahg
Ursprung eabdc7ffa9
Commit e93061be48
3 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -178,9 +178,7 @@ public class EntityArrow extends Entity {
// or leave as DamageCause.ENTITY_ATTACK
org.bukkit.entity.Entity shooter = null;
if ((EntityLiving)b != null) {
shooter = new org.bukkit.craftbukkit.entity.CraftLivingEntity(server, b);
} else if ((Entity)b != null) {
shooter = (org.bukkit.entity.Entity) b.getBukkitEntity();
shooter = b.getBukkitEntity();
}
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, entity.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 4);

Datei anzeigen

@ -183,7 +183,11 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
public boolean a(Entity entity, int i) {
// CraftBukkit start
VehicleDamageEvent event = new VehicleDamageEvent(Type.VEHICLE_DAMAGE, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity(), i);
org.bukkit.entity.Entity passenger = null;
if ((EntityLiving)entity != null) {
passenger = entity.getBukkitEntity();
}
VehicleDamageEvent event = new VehicleDamageEvent(Type.VEHICLE_DAMAGE, (Vehicle) this.getBukkitEntity(), passenger, i);
((WorldServer)l).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -16,7 +16,7 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
}
public Entity getPassenger() {
return (getHandle().j.getBukkitEntity());
return isEmpty()?null:(getHandle().j.getBukkitEntity());
}
public boolean setPassenger(Entity passenger) {