/** * Handles mob spawning.<br> * Checks if an arena allows mob spawning before letting a mob spawn inside it. */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onCreatureSpawn(CreatureSpawnEvent event) { if (event.getSpawnReason() == SpawnReason.NATURAL) { Arena arena = ultimateGames.getArenaManager().getLocationArena(event.getLocation()); if (arena != null && !arena.allowMobSpawning()) { event.setCancelled(true); } } }