mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-17 04:41:40 +01:00
Fix TNTListener tests
This commit is contained in:
parent
823bc5ceed
commit
5573e9f329
@ -43,10 +43,13 @@ public class TNTListener extends FlagListener {
|
|||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onTNTDamage(EntityChangeBlockEvent e) {
|
public void onTNTDamageEvent(EntityChangeBlockEvent e) {
|
||||||
|
onTNTDamage(e);
|
||||||
|
}
|
||||||
|
boolean onTNTDamage(EntityChangeBlockEvent e) {
|
||||||
// Check world
|
// Check world
|
||||||
if (!e.getBlock().getType().equals(Material.TNT) || !getIWM().inWorld(e.getBlock().getLocation())) {
|
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
|
// Stop TNT from being damaged if it is being caused by a visitor with a flaming arrow
|
||||||
if (e.getEntity() instanceof Projectile projectile) {
|
if (e.getEntity() instanceof Projectile projectile) {
|
||||||
@ -56,9 +59,10 @@ public class TNTListener extends FlagListener {
|
|||||||
// Remove the arrow
|
// Remove the arrow
|
||||||
projectile.remove();
|
projectile.remove();
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user