use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.
the class Minidungeon method unloadWorld.
private void unloadWorld(Player player) {
try {
for (Player iteratedPlayer : Bukkit.getOnlinePlayers()) if (iteratedPlayer.getWorld().getName().equals(dungeonPackagerConfigFields.getWorldName())) {
player.sendMessage("[EliteMobs] Failed to unload Minidungeon because at least one player is in the world " + dungeonPackagerConfigFields.getWorldName());
return;
}
for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntitySet()) if (regionalBossEntity.getSpawnLocation().getWorld() == world)
regionalBossEntity.worldUnload();
MinidungeonWorldLoader.unloadWorld(this);
player.sendMessage("Minidugeon " + dungeonPackagerConfigFields.getWorldName() + " has been unloaded! The world is now unloaded. The world is now unloaded and the regional bosses are down.");
isInstalled = false;
if (wormholeWorld != null)
Bukkit.unloadWorld(wormholeWorld, true);
} catch (Exception exception) {
player.sendMessage("Warning: Failed to unload the " + dungeonPackagerConfigFields.getWorldName() + " world!");
}
regionalBossCount = 0;
}
use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.
the class DebugScreen method generateEntry.
private static TextComponent generateEntry(CustomBossEntity customBossEntity, String argument, Player player) {
if (!customBossEntity.getCustomBossesConfigFields().getFilename().contains(argument) && !customBossEntity.getCustomBossesConfigFields().getName().toLowerCase().contains(argument.toLowerCase()))
return null;
TextComponent page = new TextComponent();
page.addExtra(customBossEntity.getCustomBossesConfigFields().getFilename() + "\n");
page.addExtra("Name: " + ChatColorConverter.convert(customBossEntity.getCustomBossesConfigFields().getName()) + ChatColor.BLACK + "\n");
page.addExtra("Level: " + customBossEntity.getCustomBossesConfigFields().getLevel() + "\n");
if (customBossEntity.getLivingEntity() != null) {
page.addExtra("Is Alive (MC): " + !customBossEntity.getLivingEntity().isDead() + "\n");
page.addExtra(SpigotMessage.commandHoverMessage(ChatColor.BLUE + "XYZ: " + "\n", customBossEntity.getLocation().getBlockX() + ", " + customBossEntity.getLocation().getBlockY() + ", " + customBossEntity.getLocation().getBlockZ() + "\n" + ChatColor.BLUE + "Click to teleport! (if alive)", "/em debugtp " + customBossEntity.getEliteUUID().toString()));
page.addExtra("Has AI: " + !customBossEntity.getLivingEntity().hasAI() + "\n");
} else
page.addExtra("Is Alive (MC): false\n");
if (customBossEntity.getLocation() != null && player.getWorld().equals(customBossEntity.getLocation().getWorld()))
page.addExtra(SpigotMessage.hoverMessage(ChatColor.BLUE + "Spawn distance", "Spawn distance: X=" + (int) (player.getLocation().getX() - customBossEntity.getSpawnLocation().getX()) + " | Y=" + (int) (player.getLocation().getY() - customBossEntity.getSpawnLocation().getY()) + " | Z=" + (int) (player.getLocation().getZ() - customBossEntity.getSpawnLocation().getZ()) + "\n"));
page.addExtra("Is Persistent: " + customBossEntity.getCustomBossesConfigFields().isPersistent() + "\n");
if (customBossEntity instanceof RegionalBossEntity) {
page.addExtra("Is Respawning: " + ((RegionalBossEntity) customBossEntity).isRespawning() + "\n");
}
page.addExtra(SpigotMessage.commandHoverMessage(ChatColor.BLUE + "Boss trace!", "Remember, it requires debug mode to be on! This is used for advanced debugging, ask on discord if you want to know more about it.", "/elitemobs trace " + customBossEntity.getEliteUUID().toString()));
return page;
}
use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.
the class CustomSummonPower method summonReinforcement.
private void summonReinforcement(EliteEntity eliteEntity, CustomBossReinforcement customBossReinforcement) {
if (customBossReinforcement.summonChance != null && ThreadLocalRandom.current().nextDouble() > customBossReinforcement.summonChance)
return;
for (int i = 0; i < customBossReinforcement.amount; i++) {
Location spawnLocation = eliteEntity.getLocation();
if (customBossReinforcement.spawnLocationOffset != null)
spawnLocation = getFinalSpawnLocation(eliteEntity, customBossReinforcement.spawnLocationOffset);
if (customBossReinforcement.spawnNearby)
for (int loc = 0; loc < 30; loc++) {
Location randomLocation = spawnLocation.clone().add(new Vector(ThreadLocalRandom.current().nextInt(-15, 15), 0, ThreadLocalRandom.current().nextInt(-15, 15)));
randomLocation.setY(CustomSpawn.getHighestValidBlock(randomLocation, 256));
if (randomLocation.getY() == -100)
continue;
spawnLocation = randomLocation;
break;
}
if (CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName).isRegionalBoss()) {
RegionalBossEntity regionalBossEntity = RegionalBossEntity.createTemporaryRegionalBossEntity(customBossReinforcement.bossFileName, spawnLocation);
if (regionalBossEntity == null) {
new WarningMessage("Failed to spawn reinforcement for " + eliteEntity.getName() + " because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?");
return;
}
if (customBossReinforcement.inheritLevel)
regionalBossEntity.setLevel(eliteEntity.getLevel());
if (!customBossReinforcement.summonType.equals(SummonType.ON_DEATH))
eliteEntity.addReinforcement(regionalBossEntity);
customBossReinforcement.isSummoned = true;
regionalBossEntity.setSummoningEntity(eliteEntity);
regionalBossEntity.initialize();
} else {
CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(customBossReinforcement.bossFileName);
if (customBossEntity == null) {
new WarningMessage("Failed to spawn reinforcement for " + eliteEntity.getName() + " because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?");
return;
}
customBossEntity.setSpawnLocation(spawnLocation);
customBossEntity.setBypassesProtections(eliteEntity.getBypassesProtections());
if (customBossReinforcement.inheritLevel)
customBossEntity.setLevel(eliteEntity.getLevel());
customBossEntity.spawn(false);
if (customBossEntity.getLivingEntity() != null)
customBossEntity.getLivingEntity().setVelocity(new Vector(ThreadLocalRandom.current().nextDouble(0.2), 0.2, ThreadLocalRandom.current().nextDouble(0.2)));
if (!customBossReinforcement.summonType.equals(SummonType.ON_DEATH))
eliteEntity.addReinforcement(customBossEntity);
customBossReinforcement.isSummoned = true;
customBossEntity.setSummoningEntity(eliteEntity);
}
}
}
Aggregations