use of net.md_5.bungee.api.chat.ClickEvent 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 net.md_5.bungee.api.chat.ClickEvent in project EliteMobs by MagmaGuy.
the class CoverPage method coverPage.
protected static TextComponent coverPage(int statsPage, int gearPage, int teleportsPage, int commandsPage, int questsPage, int bossTrackingPage) {
TextComponent textComponent = new TextComponent();
for (int i = 0; i < 13; i++) {
TextComponent line = new TextComponent(PlayerStatusMenuConfig.getIndexTextLines()[i].replace("$statsPage", statsPage + "").replace("$gearPage", gearPage + "").replace("$teleportsPage", teleportsPage + "").replace("$commandsPage", commandsPage + "").replace("$questsPage", questsPage + "").replace("$bossTrackingPage", bossTrackingPage + "") + "\n");
if (!PlayerStatusMenuConfig.getIndexHoverLines()[i].isEmpty())
PlayerStatusScreen.setHoverText(line, PlayerStatusMenuConfig.getIndexHoverLines()[i]);
if (PlayerStatusMenuConfig.getIndexCommandLines()[i].contains("$statsPage"))
line.setClickEvent(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, PlayerStatusMenuConfig.getIndexCommandLines()[i].replace("$statsPage", statsPage + "")));
else if (PlayerStatusMenuConfig.getIndexCommandLines()[i].contains("$gearPage"))
line.setClickEvent(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, PlayerStatusMenuConfig.getIndexCommandLines()[i].replace("$gearPage", gearPage + "")));
else if (PlayerStatusMenuConfig.getIndexCommandLines()[i].contains("$teleportsPage"))
line.setClickEvent(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, PlayerStatusMenuConfig.getIndexCommandLines()[i].replace("$teleportsPage", teleportsPage + "")));
else if (PlayerStatusMenuConfig.getIndexCommandLines()[i].contains("$commandsPage"))
line.setClickEvent(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, PlayerStatusMenuConfig.getIndexCommandLines()[i].replace("$commandsPage", commandsPage + "")));
else if (PlayerStatusMenuConfig.getIndexCommandLines()[i].contains("$questsPage"))
line.setClickEvent(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, PlayerStatusMenuConfig.getIndexCommandLines()[i].replace("$questsPage", questsPage + "")));
else if (PlayerStatusMenuConfig.getIndexCommandLines()[i].contains("$bossTrackingPage"))
line.setClickEvent(new ClickEvent(ClickEvent.Action.CHANGE_PAGE, PlayerStatusMenuConfig.getIndexCommandLines()[i].replace("$bossTrackingPage", bossTrackingPage + "")));
else
line.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, PlayerStatusMenuConfig.getIndexCommandLines()[i]));
textComponent.addExtra(line);
}
return textComponent;
}
use of net.md_5.bungee.api.chat.ClickEvent in project EliteMobs by MagmaGuy.
the class SpigotMessage method hoverLinkMessage.
public static TextComponent hoverLinkMessage(String message, String hoverMessage, String link) {
TextComponent textComponent = hoverMessage(message, hoverMessage);
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));
return textComponent;
}
use of net.md_5.bungee.api.chat.ClickEvent in project FireAPI by FireBlade-Serv.
the class FireFriends method sendFriendsMessageResquest.
public void sendFriendsMessageResquest(ProxiedPlayer pp, String name) {
TextComponent accept = new TextComponent("§a§l✔ Accepter§r ");
accept.setClickEvent(new ClickEvent(net.md_5.bungee.api.chat.ClickEvent.Action.RUN_COMMAND, "/amis accept " + name));
accept.setHoverEvent(new HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aCliquez ici pour accepter sa demande").create()));
TextComponent base = new TextComponent(this.pre + "§e" + name + "§r vous demande en ami ! ");
base.addExtra(accept);
pp.sendMessage(base);
}
use of net.md_5.bungee.api.chat.ClickEvent in project solinia3-core by mixxit.
the class SoliniaPlayer method setInteraction.
@Override
public void setInteraction(UUID interaction, ISoliniaNPC npc) {
if (interaction == null) {
this.interaction = interaction;
this.getBukkitPlayer().sendMessage(ChatColor.GRAY + "* You are no longer interacting");
return;
}
Entity e = Bukkit.getEntity(interaction);
if (e == null)
return;
if (!(e instanceof LivingEntity))
return;
if (((Creature) e).getTarget() != null) {
if (interaction != null) {
this.getBukkitPlayer().sendMessage(ChatColor.GRAY + "* You are no longer interacting");
interaction = null;
}
return;
}
if (Bukkit.getEntity(interaction) instanceof Wolf) {
Wolf w = (Wolf) Bukkit.getEntity(interaction);
if (w.getOwner() != null)
return;
}
this.interaction = interaction;
if (npc != null) {
this.getBukkitPlayer().sendMessage(ChatColor.GRAY + "* You are now interacting with " + Bukkit.getEntity(interaction).getName() + " [" + npc.getId() + "] - Anything you type will be heared by the NPC and possibly responded to. Words in pink are trigger words you can type");
if (npc.getMerchantid() > 0) {
try {
StateManager.getInstance().getEntityManager().getLivingEntity((LivingEntity) e).say("i have a [" + ChatColor.LIGHT_PURPLE + "SHOP" + ChatColor.AQUA + "] available if you are interested in buying or selling something", getBukkitPlayer());
} catch (CoreStateInitException cse) {
//
}
}
for (ISoliniaNPCEventHandler eventHandler : npc.getEventHandlers()) {
if (!eventHandler.getInteractiontype().equals(InteractionType.ITEM))
continue;
// See if player has any items that are wanted
int itemId = Integer.parseInt(eventHandler.getTriggerdata());
if (itemId == 0)
continue;
if (Utils.getPlayerTotalCountOfItemId(getBukkitPlayer(), itemId) < 1)
continue;
try {
ISoliniaItem item = StateManager.getInstance().getConfigurationManager().getItem(itemId);
TextComponent tc = new TextComponent();
tc.setText(ChatColor.YELLOW + "[QUEST] ");
TextComponent tc2 = new TextComponent();
tc2.setText(ChatColor.GRAY + "- Click here to give " + item.getDisplayname() + ChatColor.RESET);
tc2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/npcgive " + itemId));
tc.addExtra(tc2);
getBukkitPlayer().spigot().sendMessage(tc);
} catch (CoreStateInitException eNotInitialised) {
continue;
}
}
}
}
Aggregations