/** * On Button click teleport to the colony.. * * @param button the clicked button. */ private void teleportToColony(@NotNull final Button button) { final int row = alliesList.getListElementIndexByPane(button); final ColonyView ally = allies.get(row); final ITextComponent teleport = new TextComponentString(LanguageHandler.format(DO_REALLY_WANNA_TP, ally.getName())) .setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, TELEPORT_COMMAND + ally.getID()) )); Minecraft.getMinecraft().player.sendMessage(teleport); }
/** * Draws the page switcher at the bottom. * * @param sender the sender. * @param page the page number. * @param count number of citizens. * @param halfPage the halfPage. * @param colonyId the colony id. */ private static void drawPageSwitcher(@NotNull final ICommandSender sender, final int page, final int count, final int halfPage, final int colonyId) { final int prevPage = Math.max(0, page - 1); final int nextPage = Math.min(page + 1, (count / CITIZENS_ON_PAGE) + halfPage); final ITextComponent prevButton = new TextComponentString(PREV_PAGE).setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format(LIST_COMMAND_SUGGESTED, colonyId, prevPage)) )); final ITextComponent nextButton = new TextComponentString(NEXT_PAGE).setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format(LIST_COMMAND_SUGGESTED, colonyId, nextPage)) )); final ITextComponent beginLine = new TextComponentString(PAGE_LINE); final ITextComponent endLine = new TextComponentString(PAGE_LINE); sender.sendMessage(beginLine.appendSibling(prevButton).appendSibling(new TextComponentString(PAGE_LINE_DIVIDER)).appendSibling(nextButton).appendSibling(endLine)); }
final ITextComponent deleteButton = new TextComponentString("[DELETE]").setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, COMMAND_CHECK_FOR_AUTODELETES) ));
if(isPlayerOpped(sender)) teleport.setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, TELEPORT_COMMAND + colony.getID()))); final ITextComponent prevButton = new TextComponentString(PREV_PAGE).setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, LIST_COMMAND_SUGGESTED + prevPage) )); final ITextComponent nextButton = new TextComponentString(NEXT_PAGE).setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, LIST_COMMAND_SUGGESTED + nextPage) ));
@Override public void dump(Collection<NoteEntry> notes, ICommandSender sender) { int count = 0; for (NoteEntry note : notes) { ITextComponent level = new TextComponentTranslation(note.category.translated); level.getStyle().setColor(note.category.color); sender.sendMessage(new TextComponentTranslation("openeye.chat.note", count++, level)); ITextComponent title = note.title(); title.getStyle().setBold(true); sender.sendMessage(title); sender.sendMessage(note.content()); String url = note.url(); if (!Strings.isNullOrEmpty(url)) sender.sendMessage(new TextComponentString(note.url())); } } }
.setStyle(new Style().setBold(true).setColor(TextFormatting.GOLD).setClickEvent( new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format(DELETE_COLONY_CONFIRM_DELETE_COMMAND_SUGGESTED,
switch (font) { case BOLD: style.setBold(!style.getBold()); break; case OBFUSCATED:
private static ITextComponent makeChat(boolean tag) { ITextComponent chat = new TextComponentString(tag ? "[test] " : ""); chat.getStyle().setBold(true); { ITextComponent colored = new TextComponentString("This should be green. "); colored.getStyle().setColor(TextFormatting.GREEN); chat.appendSibling(colored); } chat.appendText(" "); { ITextComponent link = new TextComponentString("This is a link."); link.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://google.com/")); chat.appendSibling(link); } return chat; } }
text.getStyle().setBold(true);