Fix damage from exploding beds being cancelled (#3874)

This commit is contained in:
antiPerson 2021-06-11 16:06:12 +01:00 committed by GitHub
parent eacc748b09
commit 8142da608c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.protect;
import com.earth2me.essentials.User;
import net.ess3.api.IEssentials;
import org.bukkit.Material;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EnderDragon;
@ -69,7 +70,8 @@ public class EssentialsProtectEntityListener implements Listener {
event.setCancelled(true);
return;
}
if (prot.getSettingBool(ProtectConfig.prevent_tnt_explosion) && cause == DamageCause.BLOCK_EXPLOSION && !(target instanceof Player && shouldBeDamaged(user, "tnt"))) {
final EntityDamageByBlockEvent edbEvent = (EntityDamageByBlockEvent) event;
if (prot.getSettingBool(ProtectConfig.prevent_tnt_explosion) && edbEvent.getDamager() != null && edbEvent.getDamager().getType() == Material.TNT && cause == DamageCause.BLOCK_EXPLOSION && !(target instanceof Player && shouldBeDamaged(user, "tnt"))) {
event.setCancelled(true);
return;
}