// Grab a spawnpoint
Location spawnpoint = spawnpoints.get(index % totalSpawnpoints);
// Spawn the monster
LivingEntity e = entry.getKey().spawn(arena, world, spawnpoint);
// Add it to the arena.
monsterManager.addMonster(e);
// Set the health.
e.resetMaxHealth(); // Avoid conflicts/enormous multiplications from other plugins handling Mob health
int health = (int) Math.max(1D, e.getMaxHealth() * mul);
e.setMaxHealth(health);
e.setHealth(health);
// Switch on the type.
switch (w.getType()){
case BOSS:
BossWave bw = (BossWave) w;
double maxHealth = bw.getMaxHealth(playerCount);
MABoss boss = monsterManager.addBoss(e, maxHealth);
boss.setReward(bw.getReward());
boss.setDrops(bw.getDrops());
bw.addMABoss(boss);
bw.activateAbilities(arena);
if (bw.getBossName() != null) {
e.setCustomName(bw.getBossName());
e.setCustomNameVisible(true);
}
break;
case SWARM:
health = (int) (mul < 1D ? e.getMaxHealth() * mul : 1);
health = Math.max(1, health);
e.setHealth(Math.min(health, e.getMaxHealth()));
break;
case SUPPLY:
SupplyWave sw = (SupplyWave) w;
monsterManager.addSupplier(e, sw.getDropList());
break;