mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 04:55:37 +01:00
Handle null block attacker.
Fixes WORLDGUARD-3350.
This commit is contained in:
parent
dfe536a2d2
commit
deddcf8dd2
@ -619,7 +619,13 @@ public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (event instanceof EntityDamageByBlockEvent) {
|
||||
Events.fireToCancel(event, new DamageEntityEvent(event, create(((EntityDamageByBlockEvent) event).getDamager()), event.getEntity()));
|
||||
@Nullable Block attacker = ((EntityDamageByBlockEvent) event).getDamager();
|
||||
|
||||
// The attacker should NOT be null, but sometimes it is
|
||||
// See WORLDGUARD-3350
|
||||
if (attacker != null) {
|
||||
Events.fireToCancel(event, new DamageEntityEvent(event, create(attacker), event.getEntity()));
|
||||
}
|
||||
|
||||
} else if (event instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent entityEvent = (EntityDamageByEntityEvent) event;
|
||||
|
Loading…
Reference in New Issue
Block a user