Search in sources :

Example 31 with ClickEvent

use of net.md_5.bungee.api.chat.ClickEvent in project EliteMobs by MagmaGuy.

the class CommandsPage method commandsPage.

protected static TextComponent commandsPage() {
    TextComponent textComponent = new TextComponent();
    for (int i = 0; i < 13; i++) {
        TextComponent line = new TextComponent(PlayerStatusMenuConfig.getCommandsTextLines()[i] + "\n");
        if (!PlayerStatusMenuConfig.getCommandsHoverLines()[i].isEmpty())
            PlayerStatusScreen.setHoverText(line, PlayerStatusMenuConfig.getCommandsHoverLines()[i]);
        if (!PlayerStatusMenuConfig.getCommandsCommandLines()[i].isEmpty())
            line.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, PlayerStatusMenuConfig.getCommandsCommandLines()[i]));
        textComponent.addExtra(line);
    }
    return textComponent;
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) ClickEvent(net.md_5.bungee.api.chat.ClickEvent)

Example 32 with ClickEvent

use of net.md_5.bungee.api.chat.ClickEvent in project EliteMobs by MagmaGuy.

the class CustomBossBossBar method sendLocation.

private void sendLocation() {
    for (Player player : Bukkit.getOnlinePlayers()) {
        if (!player.getWorld().equals(customBossEntity.getLocation().getWorld()))
            continue;
        TextComponent interactiveMessage = new TextComponent(MobCombatSettingsConfig.getBossLocationMessage());
        interactiveMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/elitemobs trackcustomboss " + customBossEntity.getEliteUUID()));
        interactiveMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(TranslationConfig.getTrackMessage().replace("$name", customBossEntity.getName())).create()));
        player.spigot().sendMessage(interactiveMessage);
    }
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) Player(org.bukkit.entity.Player) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) ComponentBuilder(net.md_5.bungee.api.chat.ComponentBuilder)

Aggregations

ClickEvent (net.md_5.bungee.api.chat.ClickEvent)30 TextComponent (net.md_5.bungee.api.chat.TextComponent)21 ComponentBuilder (net.md_5.bungee.api.chat.ComponentBuilder)15 HoverEvent (net.md_5.bungee.api.chat.HoverEvent)10 BaseComponent (net.md_5.bungee.api.chat.BaseComponent)7 Player (org.bukkit.entity.Player)7 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)4 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)3 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)3 UPlayer (xyz.derkades.ublisk.utils.UPlayer)3 OwnedLand (biz.princeps.landlord.util.OwnedLand)2 ConfirmationGUI (biz.princeps.lib.gui.ConfirmationGUI)2 ArrayList (java.util.ArrayList)2 ChatColor (net.md_5.bungee.api.ChatColor)2 Material (org.bukkit.Material)2 OfflinePlayer (org.bukkit.OfflinePlayer)2 World (org.bukkit.World)2 Landlord (biz.princeps.landlord.Landlord)1 Options (biz.princeps.landlord.api.Options)1 LandPostClaimEvent (biz.princeps.landlord.api.events.LandPostClaimEvent)1