Search in sources :

Example 1 with RegionalBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.

the class CustomBossCommandHandler method setLeashRadius.

public static void setLeashRadius(String customBossConfigFieldsString, CommandSender commandSender, int leashRadius) {
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
    if (customBossesConfigFields == null) {
        commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed set the leash radius! Was the boss a valid regional boss?"));
        return;
    }
    customBossesConfigFields.runtimeSetLeashRadius(leashRadius);
    for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntitySet()) if (customBossesConfigFields.getFilename().equals(regionalBossEntity.getCustomBossesConfigFields().getFilename()))
        regionalBossEntity.setLeashRadius(leashRadius);
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)

Example 2 with RegionalBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.

the class DebugScreen method openBossScreen.

private static void openBossScreen(Player player, String argument) {
    TextComponent[] pages = new TextComponent[100];
    int counter = 0;
    for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values()) if (!(eliteEntity instanceof RegionalBossEntity))
        if (eliteEntity instanceof CustomBossEntity) {
            TextComponent textComponent = generateEntry((CustomBossEntity) eliteEntity, argument, player);
            if (textComponent == null)
                continue;
            pages[counter] = textComponent;
            counter++;
        }
    for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntities()) {
        TextComponent textComponent = generateEntry(regionalBossEntity, argument, player);
        if (textComponent == null)
            continue;
        pages[counter] = textComponent;
        counter++;
    }
    BookMaker.generateBook(player, pages);
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)

Example 3 with RegionalBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.

the class StatsCommand method statsHandler.

public static void statsHandler(CommandSender commandSender) {
    int aggressiveCount = 0;
    int passiveCount = 0;
    HashMap<EntityType, Integer> entitiesCounted = new HashMap<>();
    for (World world : EliteMobs.validWorldList) for (LivingEntity livingEntity : world.getLivingEntities()) if (EntityTracker.isEliteMob(livingEntity)) {
        aggressiveCount++;
        if (!entitiesCounted.containsKey(livingEntity.getType()))
            entitiesCounted.put(livingEntity.getType(), 1);
        else
            entitiesCounted.put(livingEntity.getType(), entitiesCounted.get(livingEntity.getType()) + 1);
    } else if (EntityTracker.isSuperMob(livingEntity)) {
        passiveCount++;
        if (!entitiesCounted.containsKey(livingEntity.getType()))
            entitiesCounted.put(livingEntity.getType(), 1);
        else
            entitiesCounted.put(livingEntity.getType(), entitiesCounted.get(livingEntity.getType()) + 1);
    }
    StringBuilder breakdownString = new StringBuilder("&2Breakdown: &a");
    for (EntityType entityType : entitiesCounted.keySet()) {
        breakdownString.append(entitiesCounted.get(entityType)).append(" ").append(entityType).append("&2, &a");
    }
    double highestThreat = 0;
    String highestThreatUser = "";
    double threatAverage = 0;
    int highestGuildRank = 0;
    String highestGuildUser = "";
    double guildRankAverage = 0;
    Player highestGuildRankPlayer = null;
    for (Player player : Bukkit.getOnlinePlayers()) {
        double currentTier = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(true);
        threatAverage += currentTier;
        int currentGuildRank = GuildRank.getActiveGuildRank(player);
        guildRankAverage += currentGuildRank;
        if (currentTier > highestThreat) {
            highestThreat = currentTier;
            highestThreatUser = player.getDisplayName();
        }
        if (currentGuildRank > highestGuildRank) {
            highestGuildRankPlayer = player;
            highestGuildRank = currentGuildRank;
            highestGuildUser = player.getDisplayName();
        }
    }
    threatAverage /= Bukkit.getOnlinePlayers().size();
    guildRankAverage /= Bukkit.getOnlinePlayers().size();
    commandSender.sendMessage(ChatColorConverter.convert("§5§m-----------------------------------------------------"));
    commandSender.sendMessage(ChatColorConverter.convert("&7[EM] §a§lEliteMobs v. " + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion() + " stats:"));
    commandSender.sendMessage(ChatColorConverter.convert("&7[EM] &2There are currently §l§6" + (aggressiveCount + passiveCount) + " §f§2EliteMobs mobs entities in the world, of which &a" + aggressiveCount + " &2are Elite Mobs and &a" + passiveCount + " &2are Super Mobs."));
    commandSender.sendMessage(ChatColorConverter.convert(breakdownString.toString()));
    if (highestGuildRankPlayer == null)
        return;
    commandSender.sendMessage(ChatColorConverter.convert("&7[EM] &2Highest online threat tier: &a" + highestThreatUser + " &2at total threat tier &a" + highestThreat));
    commandSender.sendMessage(ChatColorConverter.convert("&7[EM] &2Average threat tier: &a" + Round.twoDecimalPlaces(threatAverage)));
    commandSender.sendMessage(ChatColorConverter.convert("&7[EM] &2Highest adventurer's guild tier: &a" + highestGuildUser + " &2at guild rank &a" + GuildRank.getRankName(GuildRank.getGuildPrestigeRank(highestGuildRankPlayer), highestGuildRank) + " &2(&a" + highestGuildRank + "&2)"));
    commandSender.sendMessage(ChatColorConverter.convert("&7[EM] &2Average guild rank: &a" + Round.twoDecimalPlaces(guildRankAverage)));
    commandSender.sendMessage(ChatColorConverter.convert("§5§m-----------------------------------------------------"));
    commandSender.sendMessage("Tracked boss count: " + EntityTracker.getEliteMobEntities().size());
    commandSender.sendMessage("Tracked NPC count: " + EntityTracker.getNpcEntities().size());
    commandSender.sendMessage("Tracked visual item count: " + EntityTracker.getItemVisualEffects().size());
    int loadedCounter = 0;
    for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntities()) if (regionalBossEntity.isValid())
        loadedCounter++;
    commandSender.sendMessage(ChatColorConverter.convert("&7[EM] &2There are &c" + RegionalBossEntity.getRegionalBossEntities().size() + " &2Regional Bosses installed, of which &c" + loadedCounter + " &2are currently loaded."));
}
Also used : EntityType(org.bukkit.entity.EntityType) LivingEntity(org.bukkit.entity.LivingEntity) Player(org.bukkit.entity.Player) HashMap(java.util.HashMap) World(org.bukkit.World) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)

Example 4 with RegionalBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.

the class CustomSummonPower method getFinalSpawnLocation.

private Location getFinalSpawnLocation(EliteEntity summoningEntity, Vector spawnLocationOffset) {
    Location finalSpawnLocation;
    if (summoningEntity instanceof RegionalBossEntity)
        finalSpawnLocation = ((RegionalBossEntity) summoningEntity).getSpawnLocation().clone().add(spawnLocationOffset);
    else if (summoningEntity == null)
        finalSpawnLocation = null;
    else
        finalSpawnLocation = summoningEntity.getLocation().add(spawnLocationOffset);
    if (summoningEntity instanceof CustomBossEntity && ((CustomBossEntity) summoningEntity).getMinidungeon() != null)
        if (summoningEntity instanceof RegionalBossEntity)
            return ((CustomBossEntity) summoningEntity).getMinidungeon().getRotatedFinalLocation(((RegionalBossEntity) summoningEntity).getSpawnLocation(), spawnLocationOffset);
        else
            return ((CustomBossEntity) summoningEntity).getMinidungeon().getRotatedFinalLocation((summoningEntity).getLocation(), spawnLocationOffset);
    else
        return finalSpawnLocation;
}
Also used : CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity) Location(org.bukkit.Location)

Example 5 with RegionalBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity in project EliteMobs by MagmaGuy.

the class Minidungeon method quantifySchematicBosses.

public void quantifySchematicBosses(boolean freshInstall) {
    if (!isInstalled)
        return;
    if (!freshInstall) {
        this.relativeBossLocations = new RelativeDungeonLocations(dungeonPackagerConfigFields.getRelativeBossLocations(), true);
        this.relativeTreasureChestLocations = new RelativeDungeonLocations(dungeonPackagerConfigFields.getRelativeTreasureChestLocations(), false);
        this.realDungeonLocations = new RealDungeonLocations();
    }
    this.teleportLocation = getRotatedFinalLocation(dungeonPackagerConfigFields.getAnchorPoint(), dungeonPackagerConfigFields.getTeleportPoint());
    for (String regionalBossLocations : dungeonPackagerConfigFields.getRelativeBossLocations()) {
        String bossFileName = regionalBossLocations.split(":")[0];
        CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(bossFileName);
        quantificationFilter(customBossesConfigFields);
        RegionalBossEntity.getRegionalBossEntities(customBossesConfigFields).forEach((regionalBossEntity -> regionalBossEntity.setMinidungeon(this)));
        if (customBossesConfigFields != null && customBossesConfigFields.isRegionalBoss())
            regionalBossCount++;
    }
}
Also used : TreasureChest(com.magmaguy.elitemobs.treasurechest.TreasureChest) Setter(lombok.Setter) java.util(java.util) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) Getter(lombok.Getter) CustomBossesConfig(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig) Text(net.md_5.bungee.api.chat.hover.content.Text) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) EventCaller(com.magmaguy.elitemobs.utils.EventCaller) CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) Player(org.bukkit.entity.Player) TextComponent(net.md_5.bungee.api.chat.TextComponent) DungeonPackagerConfigFields(com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields) CustomTreasureChestsConfig(com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig) MinidungeonWorldLoader(com.magmaguy.elitemobs.dungeons.worlds.MinidungeonWorldLoader) Location(org.bukkit.Location) NewMinidungeonRelativeBossLocationEvent(com.magmaguy.elitemobs.api.internal.NewMinidungeonRelativeBossLocationEvent) World(org.bukkit.World) MetadataHandler(com.magmaguy.elitemobs.MetadataHandler) GenericRotationMatrixMath(com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) Bukkit(org.bukkit.Bukkit) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) RemovalReason(com.magmaguy.elitemobs.api.internal.RemovalReason) Files(java.nio.file.Files) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) CustomTreasureChestConfigFields(com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields) EntityTracker(com.magmaguy.elitemobs.entitytracker.EntityTracker) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) File(java.io.File) Vector(org.bukkit.util.Vector) Paths(java.nio.file.Paths) WorldGuardCompatibility(com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility) SpigotMessage(com.magmaguy.elitemobs.utils.SpigotMessage) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity) ChatColorConverter(com.magmaguy.elitemobs.ChatColorConverter) CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)

Aggregations

RegionalBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)8 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)4 TextComponent (net.md_5.bungee.api.chat.TextComponent)3 Location (org.bukkit.Location)3 Player (org.bukkit.entity.Player)3 CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)2 EliteEntity (com.magmaguy.elitemobs.mobconstructor.EliteEntity)2 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)2 World (org.bukkit.World)2 Vector (org.bukkit.util.Vector)2 ChatColorConverter (com.magmaguy.elitemobs.ChatColorConverter)1 MetadataHandler (com.magmaguy.elitemobs.MetadataHandler)1 NewMinidungeonRelativeBossLocationEvent (com.magmaguy.elitemobs.api.internal.NewMinidungeonRelativeBossLocationEvent)1 RemovalReason (com.magmaguy.elitemobs.api.internal.RemovalReason)1 CustomBossesConfig (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)1 CustomTreasureChestConfigFields (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields)1 CustomTreasureChestsConfig (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig)1 DungeonPackagerConfigFields (com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields)1 MinidungeonWorldLoader (com.magmaguy.elitemobs.dungeons.worlds.MinidungeonWorldLoader)1 EntityTracker (com.magmaguy.elitemobs.entitytracker.EntityTracker)1