Added ability to disable mob spawning inside of arenas.

This commit is contained in:
2022-06-04 14:26:52 -04:00
parent 4c9a5b2282
commit cd569b9914
5 changed files with 55 additions and 2 deletions

View File

@@ -575,13 +575,16 @@ public class ArenaManager implements Listener {
}
/**
* Not implemented.
* Prevents entities from spawning inside of arenas with mob spawning set to disabled.
*
* @param event The event.
*/
@EventHandler(ignoreCancelled = true)
public void onEntitySpawn(final EntitySpawnEvent event){
// TODO: Add configurable option for preventing entity spawns in arenas.
final Arena arena = this.getArenaByLocation(event.getEntity().getLocation());
if (arena != null && !arena.isMobSpawningAllowed()){
event.setCancelled(true);
}
}
/**
@@ -902,6 +905,7 @@ public class ArenaManager implements Listener {
logger.info(" - Grace Time: " + arena.getGraceTime() + "s");
logger.info(" - Match Time: " + arena.getMatchTime() + "s");
logger.info(" - Damage: " + arena.getDamage() + " HP");
logger.info(" - Mob Spawning Allowed: " + arena.isMobSpawningAllowed());
logger.info(" - World: " + arena.getWorld().getName());
Location pos1 = arena.getPos1(), pos2 = arena.getPos2();