mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 10:27:55 +01:00
Fix up NPE's in EntityMinecart/CraftVehicle and removed a little un-needed code in EntityArrow
This commit is contained in:
parent
eabdc7ffa9
commit
e93061be48
@ -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);
|
||||
|
||||
|
@ -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()) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user