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;
}
}
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);
}
}
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!");
}
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);
}
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);
}
Aggregations