use of net.md_5.bungee.api.chat.TextComponent in project EliteMobs by MagmaGuy.
the class Minidungeon method installSchematicMinidungeon.
private void installSchematicMinidungeon(Player player) {
player.performCommand("schematic load " + dungeonPackagerConfigFields.getSchematicName());
new BukkitRunnable() {
@Override
public void run() {
for (int i = 0; i < 20; i++) player.sendMessage("");
player.sendMessage(ChatColorConverter.convert("&2-------------------------------------------------"));
player.sendMessage(ChatColorConverter.convert("&7[EliteMobs] &2Ready to install " + dungeonPackagerConfigFields.getDungeonSizeCategory().toString().toLowerCase() + "!"));
TextComponent pasteString = new TextComponent(ChatColorConverter.convert("&aClick here to place the &lbuilding and bosses &awhere you're standing!"));
pasteString.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/em setup minidungeon " + dungeonPackagerConfigFields.getFilename()));
pasteString.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(ChatColorConverter.convert("&2Click me!"))));
TextComponent noPasteString = new TextComponent(ChatColorConverter.convert("&4&lOr &4click here to &lonly set the bosses with no building&4!"));
noPasteString.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/em setup minidungeonNoPaste " + dungeonPackagerConfigFields.getFilename()));
noPasteString.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(ChatColorConverter.convert("&cOnly click if you're already standing at the bulding's anchor point!"))));
player.spigot().sendMessage(pasteString);
player.spigot().sendMessage(noPasteString);
player.sendMessage(ChatColorConverter.convert("&2-------------------------------------------------"));
}
}.runTaskLater(MetadataHandler.PLUGIN, 20);
initializeWormholeWorld();
}
use of net.md_5.bungee.api.chat.TextComponent in project EliteMobs by MagmaGuy.
the class Minidungeon method finalizeMinidungeonInstallation.
public void finalizeMinidungeonInstallation(Player player, boolean pastedSchematic) {
dungeonPackagerConfigFields.setEnabled(true, player.getLocation());
this.relativeBossLocations = new RelativeDungeonLocations(dungeonPackagerConfigFields.getRelativeBossLocations(), true);
this.relativeTreasureChestLocations = new RelativeDungeonLocations(dungeonPackagerConfigFields.getRelativeTreasureChestLocations(), false);
this.realDungeonLocations = new RealDungeonLocations();
commitLocations();
this.isInstalled = true;
if (dungeonPackagerConfigFields.isProtect()) {
Location realCorner1 = getRotatedFinalLocation(dungeonPackagerConfigFields.getAnchorPoint(), dungeonPackagerConfigFields.getCorner1());
Location realCorner2 = getRotatedFinalLocation(dungeonPackagerConfigFields.getAnchorPoint(), dungeonPackagerConfigFields.getCorner2());
WorldGuardCompatibility.defineMinidungeon(realCorner1, realCorner2, dungeonPackagerConfigFields.getAnchorPoint(), dungeonPackagerConfigFields.getSchematicName(), this);
}
teleportLocation = getRotatedFinalLocation(dungeonPackagerConfigFields.getAnchorPoint(), dungeonPackagerConfigFields.getTeleportPoint());
for (int i = 0; i < 20; i++) player.sendMessage("");
player.sendMessage(ChatColorConverter.convert("&2" + dungeonPackagerConfigFields.getName() + " installed!"));
TextComponent setupOptions = new TextComponent(ChatColorConverter.convert("&4Click here to uninstall!"));
if (pastedSchematic)
setupOptions.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/em setup unminidungeon " + dungeonPackagerConfigFields.getFilename()));
else
setupOptions.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/em setup unminidungeonNoPaste " + dungeonPackagerConfigFields.getFilename()));
player.spigot().sendMessage(setupOptions);
quantifySchematicBosses(true);
}
use of net.md_5.bungee.api.chat.TextComponent in project EliteMobs by MagmaGuy.
the class ShareItem method setItemHoverEvent.
public static void setItemHoverEvent(TextComponent textComponent, ItemStack itemStack) {
if (!EliteMobsItemDetector.isEliteMobsItem(itemStack))
return;
String stringList = itemStack.getItemMeta().getDisplayName();
if (itemStack.getItemMeta().hasLore())
for (String loreString : itemStack.getItemMeta().getLore()) stringList += "\n" + ChatColor.DARK_PURPLE + ChatColor.ITALIC + loreString;
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(stringList).create()));
}
use of net.md_5.bungee.api.chat.TextComponent in project EliteMobs by MagmaGuy.
the class BossTrackingPage method bossTrackingPage.
protected static TextComponent[] bossTrackingPage(Player player) {
TextComponent configTextComponent = new TextComponent();
for (int i = 0; i < 3; i++) {
TextComponent line = new TextComponent(PlayerStatusMenuConfig.getBossTrackerTextLines()[i] + "\n");
if (!PlayerStatusMenuConfig.getBossTrackerHoverLines()[i].isEmpty())
PlayerStatusScreen.setHoverText(line, PlayerStatusMenuConfig.getBossTrackerHoverLines()[i]);
if (!PlayerStatusMenuConfig.getBossTrackerCommandLines()[i].isEmpty())
line.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, PlayerStatusMenuConfig.getBossTrackerCommandLines()[i]));
configTextComponent.addExtra(line);
}
ArrayList<TextComponent> textComponents = new ArrayList<>();
int counter = 0;
for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) {
try {
textComponents.add(SpigotMessage.commandHoverMessage(customBossEntity.getCustomBossBossBar().bossBarMessage(player, customBossEntity.getCustomBossesConfigFields().getLocationMessage()) + "\n", PlayerStatusMenuConfig.getOnBossTrackHover(), "/elitemobs trackcustomboss " + customBossEntity.getEliteUUID()));
counter++;
} catch (Exception ex) {
new WarningMessage("Failed to correctly get elements for boss tracking page!");
ex.printStackTrace();
}
}
TextComponent[] textComponent;
if (counter == 0) {
textComponent = new TextComponent[1];
textComponent[0] = configTextComponent;
} else {
textComponent = new TextComponent[(int) Math.floor(counter / 6D) + 1];
int internalCounter = 0;
textComponent[0] = configTextComponent;
for (TextComponent text : textComponents) {
int currentPage = (int) Math.floor(internalCounter / 6D);
if (textComponent[currentPage] == null)
textComponent[currentPage] = new TextComponent();
textComponent[currentPage].addExtra(text);
internalCounter++;
}
}
return textComponent;
}
use of net.md_5.bungee.api.chat.TextComponent in project EliteMobs by MagmaGuy.
the class PlayerStatusScreen method generateBook.
private ItemStack generateBook(Player requestingPlayer, Player targetPlayer) {
TextComponent[] pages = new TextComponent[50];
int pageCounter = 1;
pageCounter++;
int statsPage = -1;
int gearPage = -1;
int teleportsPage = -1;
int commandsPage = -1;
int questsPage = -1;
int bossTrackingPage = -1;
if (PlayerStatusMenuConfig.isDoStatsPage()) {
statsPage = pageCounter;
pages[pageCounter] = StatsPage.statsPage(targetPlayer);
pageCounter++;
}
if (PlayerStatusMenuConfig.isDoGearPage()) {
gearPage = pageCounter;
pages[pageCounter] = GearPage.gearPage(targetPlayer);
pageCounter++;
}
if (PlayerStatusMenuConfig.isDoTeleportsPage()) {
teleportsPage = pageCounter;
for (TextComponent textComponent : TeleportsPage.teleportsPage()) {
pages[pageCounter] = textComponent;
pageCounter++;
}
}
if (PlayerStatusMenuConfig.isDoCommandsPage()) {
commandsPage = pageCounter;
pages[pageCounter] = CommandsPage.commandsPage();
pageCounter++;
}
if (PlayerStatusMenuConfig.isDoQuestTrackingPage()) {
questsPage = pageCounter;
for (TextComponent textComponent : QuestsPage.questsPage(targetPlayer)) {
pages[pageCounter] = textComponent;
pageCounter++;
}
}
if (PlayerStatusMenuConfig.isDoBossTrackingPage()) {
bossTrackingPage = pageCounter;
for (TextComponent textComponent : BossTrackingPage.bossTrackingPage(targetPlayer)) {
pages[pageCounter] = textComponent;
pageCounter++;
}
}
pages[0] = CoverPage.coverPage(statsPage, gearPage, teleportsPage, commandsPage, questsPage, bossTrackingPage);
int counter = 0;
for (TextComponent textComponent : pages) {
if (textComponent != null)
counter++;
}
TextComponent[] finalPages = new TextComponent[counter];
int secondCounter = 0;
for (TextComponent textComponent : pages) {
if (textComponent != null) {
finalPages[secondCounter] = textComponent;
secondCounter++;
}
}
return BookMaker.generateBook(requestingPlayer, finalPages);
}
Aggregations