use of net.md_5.bungee.api.chat.TextComponent 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);
}
}
use of net.md_5.bungee.api.chat.TextComponent in project EliteMobs by MagmaGuy.
the class QuestInventoryMenu method generateInventoryQuestEntry.
public static void generateInventoryQuestEntry(Quest quest, Player player, NPCEntity npcEntity) {
QuestMenu.QuestText questText = new QuestMenu.QuestText(quest, npcEntity, player);
String title = "";
if (questText.getHeader().getText() != null)
title = questText.getHeader().getText();
Inventory questInventory = Bukkit.createInventory(player, 27, title);
int titleEntry = 4;
List<Integer> loreEntries = new ArrayList<>(Arrays.asList(13, 14, 12, 15, 11, 16, 10, 17, 9));
List<Integer> objectivesEntries = new ArrayList<>(Arrays.asList(21, 20, 19, 18));
List<Integer> rewardEntries = new ArrayList<>(Arrays.asList(23, 24, 25));
Material titleMaterial = Material.PAINTING;
Material trackingMaterial = Material.TARGET;
Material loreMaterial = Material.BOOK;
Material objectivesMaterial = Material.ITEM_FRAME;
Material rewardsMaterial = Material.GOLD_INGOT;
Material acceptMaterial = Material.EMERALD;
questInventory.setItem(titleEntry, generateItemStackEntry(questText.getHeader(), new TextComponent(), titleMaterial).get(0));
if (quest instanceof CustomQuest && quest.isAccepted())
questInventory.setItem(trackEntry, generateItemStackEntry(questText.getTrack(), new TextComponent(), trackingMaterial).get(0));
questInventory.setItem(acceptEntry, generateItemStackEntry(questText.getAccept(), new TextComponent(), acceptMaterial).get(0));
if (quest instanceof CustomQuest)
fillItemSlotLists(questInventory, loreEntries, new TextComponent(" "), questText.getBody(), loreMaterial);
fillItemSlotLists(questInventory, objectivesEntries, questText.getFixedSummary(), questText.getSummary(), objectivesMaterial);
fillItemSlotLists(questInventory, rewardEntries, questText.getFixedRewards(), questText.getRewards(), rewardsMaterial);
new QuestInventory(player, quest, questInventory, npcEntity);
player.openInventory(questInventory);
}
use of net.md_5.bungee.api.chat.TextComponent in project EliteMobs by MagmaGuy.
the class QuestMenu method generateBookQuestEntries.
public static void generateBookQuestEntries(List<? extends Quest> quests, Player player, NPCEntity npcEntity) {
List<TextComponent[]> textComponents = new ArrayList<>();
int counter = 0;
for (Quest quest : quests) {
TextComponent[] iteratedTextComponent = QuestBookMenu.generateQuestEntry(quest, player, npcEntity);
counter += iteratedTextComponent.length;
textComponents.add(iteratedTextComponent);
}
TextComponent[] allQuests = new TextComponent[counter];
int counter2 = 0;
for (TextComponent[] textComponentsArray : textComponents) for (TextComponent textComponent : textComponentsArray) {
allQuests[counter2] = textComponent;
counter2++;
}
BookMaker.generateBook(player, allQuests);
}
use of net.md_5.bungee.api.chat.TextComponent in project Ublisk by Derkades.
the class TownCommand method onCommand.
@Override
protected void onCommand(UPlayer player, String[] args) {
List<BaseComponent> list = new ArrayList<BaseComponent>();
for (Town town : Town.values()) {
TextComponent component = new TextComponent(town.getName() + " ");
double x = town.getSpawnLocation().getX();
double y = town.getSpawnLocation().getY();
double z = town.getSpawnLocation().getZ();
component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp @p " + x + " " + y + " " + z));
list.add(component);
}
BaseComponent[] components = list.toArray(new BaseComponent[] {});
player.sendMessage(components);
}
use of net.md_5.bungee.api.chat.TextComponent in project Ublisk by Derkades.
the class V1_12_R1 method sendActionBarMessage.
@Override
public void sendActionBarMessage(Player player, String message) {
IChatBaseComponent dummyComponent = ChatSerializer.a("{\"text\":\"herobrine1337\"}");
PacketPlayOutChat packet = new PacketPlayOutChat(dummyComponent, ChatMessageType.GAME_INFO);
packet.components = new BaseComponent[] { new TextComponent(message) };
CraftPlayer craftPlayer = (CraftPlayer) player;
craftPlayer.getHandle().playerConnection.sendPacket(packet);
}
Aggregations