Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 21:40:06 +01:00
Fix up NPE's in EntityMinecart/CraftVehicle and removed a little un-needed code in EntityArrow
Dieser Commit ist enthalten in:
Ursprung
eabdc7ffa9
Commit
e93061be48
@ -178,9 +178,7 @@ public class EntityArrow extends Entity {
|
|||||||
// or leave as DamageCause.ENTITY_ATTACK
|
// or leave as DamageCause.ENTITY_ATTACK
|
||||||
org.bukkit.entity.Entity shooter = null;
|
org.bukkit.entity.Entity shooter = null;
|
||||||
if ((EntityLiving)b != null) {
|
if ((EntityLiving)b != null) {
|
||||||
shooter = new org.bukkit.craftbukkit.entity.CraftLivingEntity(server, b);
|
shooter = b.getBukkitEntity();
|
||||||
} else if ((Entity)b != null) {
|
|
||||||
shooter = (org.bukkit.entity.Entity) b.getBukkitEntity();
|
|
||||||
}
|
}
|
||||||
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, entity.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.ENTITY_ATTACK, 4);
|
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) {
|
public boolean a(Entity entity, int i) {
|
||||||
// CraftBukkit start
|
// 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);
|
((WorldServer)l).getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
@ -16,7 +16,7 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Entity getPassenger() {
|
public Entity getPassenger() {
|
||||||
return (getHandle().j.getBukkitEntity());
|
return isEmpty()?null:(getHandle().j.getBukkitEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setPassenger(Entity passenger) {
|
public boolean setPassenger(Entity passenger) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren