From 5573e9f32923b63bcdc664c8e84a44176a30a110 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 22 Jan 2022 11:57:11 -0800 Subject: [PATCH] Fix TNTListener tests --- .../listeners/flags/protection/TNTListener.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/TNTListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/TNTListener.java index d3a3e1e1c..a9d0b569a 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/TNTListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/TNTListener.java @@ -43,10 +43,13 @@ public class TNTListener extends FlagListener { * @param e - event */ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onTNTDamage(EntityChangeBlockEvent e) { + public void onTNTDamageEvent(EntityChangeBlockEvent e) { + onTNTDamage(e); + } + boolean onTNTDamage(EntityChangeBlockEvent e) { // Check world if (!e.getBlock().getType().equals(Material.TNT) || !getIWM().inWorld(e.getBlock().getLocation())) { - return; + return false; } // Stop TNT from being damaged if it is being caused by a visitor with a flaming arrow if (e.getEntity() instanceof Projectile projectile) { @@ -56,9 +59,10 @@ public class TNTListener extends FlagListener { // Remove the arrow projectile.remove(); e.setCancelled(true); - return; + return true; } } + return false; } /**