@Override public void sendInColor(ChatColor color, CommandSender recipient, Object... args) { recipient.sendMessage(color.toString() + get(args)); } }
/** * Gets the ChatColors used at the end of the given input string. * * @param input Input string to retrieve the colors from. * @return Any remaining ChatColors to pass onto the next line. */ public static String getLastColors(String input) { String result = ""; int length = input.length(); // Search backwards from the end as it is faster for (int index = length - 1; index > -1; index--) { char section = input.charAt(index); if (section == COLOR_CHAR && index < length - 1) { char c = input.charAt(index + 1); ChatColor color = getByChar(c); if (color != null) { result = color.toString() + result; // Once we find a color or reset we can stop searching if (color.isColor() || color.equals(RESET)) { break; } } } } return result; }
/** * Hex value to ChatColor * * @param hexValue * @return */ public static String toColor(String hexValue) { if (hexValue == null) { return ""; } return ChatColor.getByChar(hexValue).toString(); }
public String replacePlaceholders(String string) { string = ChatColor.translateAlternateColorCodes('&', string); String permissableName = nicename.substring(0, 1).toUpperCase() + nicename.substring(1); string = string.replace("{relation-color}", ChatColor.GREEN.toString()); string = string.replace("{relation}", permissableName); return string; }
@Override public void onInformMany(CommandSender sender, int affected) { sender.sendMessage(ChatColor.YELLOW.toString() + affected + " teleported."); } }
@Override public void onInformMany(CommandSender sender, int affected) { sender.sendMessage(ChatColor.YELLOW.toString() + affected + " returned."); } }).iterate(Lists.newArrayList(player));
@Override public void onInformMany(CommandSender sender, int affected) { sender.sendMessage(ChatColor.YELLOW.toString() + affected + " teleported to spawn."); }
private static String chatColorChoose() { StringBuilder ret = new StringBuilder(ALL_CHAT_COLORS.get(Misc.getRandom().nextInt(ALL_CHAT_COLORS.size())).toString()); for (ChatColor chatFormat : CHAT_FORMATS) { if (Misc.getRandom().nextInt(CHAT_FORMATS.size()) == 0) { ret.append(chatFormat); } } return ret.toString(); }
@Override public LuaValue call(LuaValue c) { // Convert ChatColors to string to be usable by lua List<String> colors = new ArrayList<>(); for (ChatColor clr : ChatColor.values()) colors.add(clr.toString()); return CoerceJavaToLua.coerce(colors.toArray()); } });
private void showHelp(CommandSender sender) { sender.sendMessage(ChatColor.DARK_AQUA + ChatColor.BOLD.toString() + plugin.getI18n().get("usage")); for (Map.Entry<String, Subcommand> entry : subcommandMap.entrySet()) { sender.sendMessage(ChatColor.GREEN + "/buycraft " + entry.getKey() + ChatColor.GRAY + ": " + entry.getValue().getDescription()); } } }
@Override public boolean handle(CommandSender sender, String[] args) { sender.sendMessage(ChatColor.YELLOW.toString() + ProtocolSupport.getInstance().getBuildInfo()); return true; }
public String getTag(Faction otherFaction) { if (otherFaction == null) { return getTag(); } return this.getTag(this.getColorTo(otherFaction).toString()); }
public String getTag(FPlayer otherFplayer) { if (otherFplayer == null) { return getTag(); } return this.getTag(this.getColorTo(otherFplayer).toString()); }
@Override public LuaValue call(LuaValue c) { // Needs to be a string so that it can be concatenated with a string in lua with ease return CoerceJavaToLua.coerce(ChatColor.valueOf(c.checkjstring()).toString()); } });
public void addTeam(String name, TeamColor color, int maxPlayers) { org.bukkit.scoreboard.Team newTeam = this.scoreboard.registerNewTeam(name); newTeam.setDisplayName(name); newTeam.setPrefix(color.getChatColor().toString()); Team theTeam = new Team(name, color, maxPlayers, newTeam); this.teams.put(name, theTeam); }
public void addTeam(Team team) { org.bukkit.scoreboard.Team newTeam = this.scoreboard.registerNewTeam(team.getName()); newTeam.setDisplayName(team.getName()); newTeam.setPrefix(team.getChatColor().toString()); team.setScoreboardTeam(newTeam); this.teams.put(team.getName(), team); }
public void addTeam(Team team) { org.bukkit.scoreboard.Team newTeam = this.scoreboard.registerNewTeam(team.getName()); newTeam.setDisplayName(team.getName()); newTeam.setPrefix(team.getChatColor().toString()); team.setScoreboardTeam(newTeam); this.teams.put(team.getName(), team); }