Search in sources :

Example 1 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class TeleportsPage method teleportsPage.

protected static TextComponent[] teleportsPage() {
    TextComponent configTextComponent = new TextComponent();
    // Fills the non-dungeon lines
    int textLineCounter = 0;
    for (String string : PlayerStatusMenuConfig.getTeleportTextLines()) {
        if (string == null || string.equals("null"))
            continue;
        TextComponent line = new TextComponent(string + "\n");
        if (PlayerStatusMenuConfig.getTeleportHoverLines()[textLineCounter] != null && !PlayerStatusMenuConfig.getTeleportHoverLines()[textLineCounter].isEmpty())
            PlayerStatusScreen.setHoverText(line, PlayerStatusMenuConfig.getTeleportHoverLines()[textLineCounter]);
        if (PlayerStatusMenuConfig.getTeleportCommandLines()[textLineCounter] != null && !PlayerStatusMenuConfig.getTeleportCommandLines()[textLineCounter].isEmpty())
            line.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, PlayerStatusMenuConfig.getTeleportCommandLines()[textLineCounter]));
        configTextComponent.addExtra(line);
        textLineCounter++;
    }
    // Fills the minidungeon components
    int counter = 0;
    ArrayList<TextComponent> textComponents = new ArrayList<>();
    for (Minidungeon minidungeon : Minidungeon.getMinidungeons().values()) {
        if (!minidungeon.isInstalled())
            continue;
        TextComponent message = new TextComponent(PlayerStatusScreen.convertLightColorsToBlack(minidungeon.getDungeonPackagerConfigFields().getName() + "\n"));
        String hoverMessage = ChatColorConverter.convert(PlayerStatusMenuConfig.getOnTeleportHover() + "\n" + minidungeon.getDungeonPackagerConfigFields().getPlayerInfo().replace("$bossCount", minidungeon.getRegionalBossCount() + "").replace("$lowestTier", minidungeon.getLowestTier() + "").replace("$highestTier", minidungeon.getHighestTier() + ""));
        message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(hoverMessage).create()));
        message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/elitemobs dungeontp " + minidungeon.getDungeonPackagerConfigFields().getFilename()));
        textComponents.add(message);
        counter++;
    }
    if (counter == 0) {
        TextComponent[] textComponent = new TextComponent[1];
        textComponent[0] = configTextComponent;
        return textComponent;
    } else {
        TextComponent[] textComponent = new TextComponent[(int) Math.floor(counter / 9D) + 1];
        int internalCounter = 0;
        textComponent[0] = configTextComponent;
        for (TextComponent text : textComponents) {
            int currentPage = (int) Math.floor(internalCounter / 9D);
            if (textComponent[currentPage] == null)
                textComponent[currentPage] = new TextComponent();
            textComponent[currentPage].addExtra(text);
            internalCounter++;
        }
        return textComponent;
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) ArrayList(java.util.ArrayList) ComponentBuilder(net.md_5.bungee.api.chat.ComponentBuilder)

Example 2 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class CustomBossCommandHandler method addRelativeSpawnLocation.

public static void addRelativeSpawnLocation(Player player, String customBossConfigFieldsString, String minidungeonString) {
    Minidungeon minidungeon = Minidungeon.getMinidungeons().get(minidungeonString);
    if (minidungeon == null) {
        player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Minidungeon is not valid!"));
        return;
    }
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
    if (customBossesConfigFields == null)
        player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Custom boss is not valid!"));
    else {
        Location safeSpawnLocation = autoSeekSafeSpawnLocation(player.getLocation());
        if (safeSpawnLocation == null)
            player.sendMessage("[EliteMobs] No safe spawn location found! Make sure the area is passable!");
        else
            minidungeon.initializeRelativeLocationAddition(customBossesConfigFields, safeSpawnLocation);
    }
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon) Location(org.bukkit.Location) DebugBlockLocation(com.magmaguy.elitemobs.utils.DebugBlockLocation)

Example 3 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class DungeonCommands method teleport.

public static void teleport(Player player, String minidungeonName) {
    Minidungeon minidungeon = Minidungeon.getMinidungeons().get(minidungeonName);
    if (minidungeon != null)
        if (minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType().equals(DungeonPackagerConfigFields.DungeonLocationType.SCHEMATIC))
            PlayerPreTeleportEvent.teleportPlayer(player, minidungeon.getTeleportLocation());
        else
            PlayerPreTeleportEvent.teleportPlayer(player, new Location(minidungeon.getTeleportLocation().getWorld(), minidungeon.getTeleportLocation().getX(), minidungeon.getTeleportLocation().getY(), minidungeon.getTeleportLocation().getZ(), Float.parseFloat("" + minidungeon.getDungeonPackagerConfigFields().getTeleportPointPitch()), Float.parseFloat("" + minidungeon.getDungeonPackagerConfigFields().getTeleportPointYaw())));
    else
        player.sendMessage("[EliteMobs] That dungeon isn't valid!");
}
Also used : Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon) Location(org.bukkit.Location)

Example 4 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class SetupHandler method setupMinidungeonNoPasteCommand.

public static void setupMinidungeonNoPasteCommand(Player player, String minidungeonName) {
    Minidungeon minidungeon = Minidungeon.getMinidungeons().get(minidungeonName);
    minidungeon.finalizeMinidungeonInstallation(player, false);
}
Also used : Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon)

Example 5 with Minidungeon

use of com.magmaguy.elitemobs.dungeons.Minidungeon in project EliteMobs by MagmaGuy.

the class SetupHandler method setupUnminidungeonNoPasteCommand.

public static void setupUnminidungeonNoPasteCommand(Player player, String minidungeonName) {
    Minidungeon minidungeon = Minidungeon.getMinidungeons().get(minidungeonName);
    minidungeon.finalizeMinidungeonInstallation(player, false);
}
Also used : Minidungeon(com.magmaguy.elitemobs.dungeons.Minidungeon)

Aggregations

Minidungeon (com.magmaguy.elitemobs.dungeons.Minidungeon)13 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)3 Location (org.bukkit.Location)3 InfoMessage (com.magmaguy.elitemobs.utils.InfoMessage)2 Vector (org.bukkit.util.Vector)2 CommandHandler (com.magmaguy.elitemobs.commands.CommandHandler)1 CustomBossesConfig (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)1 CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)1 CustomItemsConfig (com.magmaguy.elitemobs.config.customitems.CustomItemsConfig)1 CustomQuestsConfig (com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig)1 CustomSpawnConfig (com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig)1 CustomTreasureChestsConfig (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig)1 DungeonPackagerConfig (com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig)1 NPCsConfig (com.magmaguy.elitemobs.config.npcs.NPCsConfig)1 WormholeConfig (com.magmaguy.elitemobs.config.wormholes.WormholeConfig)1 CustomCharts (com.magmaguy.elitemobs.thirdparty.bstats.CustomCharts)1 Placeholders (com.magmaguy.elitemobs.thirdparty.placeholderapi.Placeholders)1 DebugBlockLocation (com.magmaguy.elitemobs.utils.DebugBlockLocation)1 File (java.io.File)1 IOException (java.io.IOException)1