@Override public void execute(CommandSender sender, String[] args) { if ( args.length != 1 ) { sender.sendMessage( new ComponentBuilder( "Please follow this command by a user name" ).color( ChatColor.RED ).create() ); } else { ProxiedPlayer player = ProxyServer.getInstance().getPlayer( args[0] ); if ( player == null || player.getServer() == null ) { sender.sendMessage( new ComponentBuilder( "That user is not online" ).color( ChatColor.RED ).create() ); } else { sender.sendMessage( new ComponentBuilder( args[0] ).color( ChatColor.GREEN ).append( " is online at " ).append( player.getServer().getInfo().getName() ).create() ); } } } }
bungee.getConsole().sendMessage( new ComponentBuilder( "Command not found" ).color( ChatColor.RED ).create() );
public static void sendHoverTip(Player player) { player.sendMessage(""); player.spigot().sendMessage(new ComponentBuilder("TIP").color(ChatColor.YELLOW).bold(true) .append(" Try to ", FormatRetention.NONE).color(ChatColor.GRAY) .append("hover").color(ChatColor.WHITE).italic(true).underlined(true) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(ChatColor.LIGHT_PURPLE + "Hover on the commands to get info about them."))) .append(" or ", FormatRetention.NONE).color(ChatColor.GRAY) .append("click").color(ChatColor.WHITE).italic(true).underlined(true) .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(ChatColor.LIGHT_PURPLE + "Click on the commands to insert them in the chat."))) .append(" on the commands!", FormatRetention.NONE).color(ChatColor.GRAY) .create()); }
public static BaseComponent getAuthorComponent(OfflinePlayer authorPlayer, String authorName) { if (authorName == null) { authorName = authorPlayer.getUniqueId().toString(); } BaseComponent authorComponent = new TextComponent(authorName); authorComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ENTITY, new ComponentBuilder(Message.getPlayerJson(authorPlayer)).create() )); return authorComponent; }
componentBuilder.append("\n").bold(false); componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader")); componentBuilder.color(ccDescriptionHeader); componentBuilder.append("\n"); componentBuilder.append(subSkillType.getLocaleDescription()); componentBuilder.color(ccDescription); return componentBuilder.create();
private static ComponentBuilder getNewComponentBuilder(String skillName) { ComponentBuilder componentBuilder = new ComponentBuilder(skillName); componentBuilder.append("\n"); return componentBuilder; }
private static void addLocked(ChatColor ccLocked, ChatColor ccLevelRequirement, ComponentBuilder componentBuilder) { componentBuilder.append(LocaleLoader.getString("JSON.Locked")).color(ccLocked).bold(true); componentBuilder.append("\n").append("\n").bold(false); componentBuilder.append(LocaleLoader.getString("JSON.LevelRequirement") + ": ").color(ccLevelRequirement); }
private static void addRanked(ChatColor ccRank, ChatColor ccCurRank, ChatColor ccPossessive, ChatColor ccNumRanks, ComponentBuilder componentBuilder, int numRanks, int rank, int nextRank) { if (numRanks > 0) { //Rank: x componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n") .bold(false).italic(false).strikethrough(false).underlined(false); //Next Rank: x if(nextRank > rank) componentBuilder.append(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n") .bold(false).italic(false).strikethrough(false).underlined(false); /*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive); componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/ } }
/** * Appends the text to the builder and makes it the current target for * formatting. The text will have all the formatting from previous part. * * @param text the text to append * @return this ComponentBuilder for chaining */ public ComponentBuilder append(String text) { return append( text, FormatRetention.ALL ); }
public BugeeCordAPIBuilder() throws LinkageError { builder = new net.md_5.bungee.api.chat.ComponentBuilder(""); }
@Override public void send(CommandSender sender) { sender.spigot().sendMessage(builder.create()); }
@Override public ComponentBuilder hover(String hoverText) { builder.event(new net.md_5.bungee.api.chat.HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, net.md_5.bungee.api.chat.TextComponent.fromLegacyText(hoverText))); return this; }
String proxy = args.length >= 1 ? args[0] : RedisBungee.getConfiguration().getServerId(); if (!plugin.getServerIds().contains(proxy)) { sender.sendMessage(new ComponentBuilder(proxy + " is not a valid proxy. See /serverids for valid proxies.").color(ChatColor.RED).create()); return; BaseComponent[] playersOnline = new ComponentBuilder("").color(ChatColor.YELLOW) .append(playerPlural(players.size()) + " currently on proxy " + proxy + ".").create(); if (args.length >= 2 && args[1].equals("showall")) { Multimap<String, UUID> serverToPlayers = RedisBungee.getApi().getServerToPlayers(); } else { sender.sendMessage(playersOnline); sender.sendMessage(new ComponentBuilder("To see all players online, use /plist " + proxy + " showall.").color(ChatColor.YELLOW).create());
String reply = invokeDiagnosticCommand(HEAP_COMMAND, ArrayUtils.EMPTY_STRING_ARRAY); for (String line : reply.split("\n")) { paginatedLines.add(new ComponentBuilder(line).create());
private static void addLocked(SubSkillType subSkillType, ChatColor ccLocked, ChatColor ccLevelRequirement, ChatColor ccLevelRequired, ComponentBuilder componentBuilder) { addLocked(ccLocked, ccLevelRequirement, componentBuilder); componentBuilder.append(String.valueOf(RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, 1))).color(ccLevelRequired); //componentBuilder.append("\n"); }
private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill, ComponentBuilder componentBuilder) { if(abstractSubSkill.isSuperAbility()) { componentBuilder.append(LocaleLoader.getString("JSON.Type.SuperAbility")).color(ChatColor.LIGHT_PURPLE); componentBuilder.bold(true); } else if(abstractSubSkill.isActiveUse()) { componentBuilder.append(LocaleLoader.getString("JSON.Type.Active")).color(ChatColor.DARK_RED); componentBuilder.bold(true); } else { componentBuilder.append(LocaleLoader.getString("JSON.Type.Passive")).color(ChatColor.GREEN); componentBuilder.bold(true); } componentBuilder.append("\n"); }
/** * Appends a component to the builder and makes it the current target for * formatting. The component will have all the formatting from previous * part. * * @param component the component to append * @return this ComponentBuilder for chaining */ public ComponentBuilder append(BaseComponent component) { return append( component, FormatRetention.ALL ); }