Fixed explosions causing block damage inside of arenas.

This commit is contained in:
2022-06-17 18:46:14 -04:00
parent 26b0efaa9a
commit 6b85b99a4b

View File

@@ -481,6 +481,22 @@ public class ArenaManager implements Listener {
} }
} }
/**
* Prevents exploding entities from destroying blocks inside of arenas.
*
* @param event The event.
*/
@EventHandler(ignoreCancelled = true)
public void onEntityExplode(final EntityExplodeEvent event){
final Entity entity = event.getEntity();
final Arena arena = this.getArenaByLocation(entity.getLocation());
if (arena != null){
event.setCancelled(true); // Cancel the explosion this entity was about to create.
event.getEntity().getWorld().createExplosion(entity.getLocation(), 3f, false, false, entity); // Make a new one in the entity's place, but don't break blocks or create fire.
}
}
/** /**
* Prevents entities from interacting with blocks inside of arenas. * Prevents entities from interacting with blocks inside of arenas.
* *