@Override public void setColor(ChatColor color) throws IllegalArgumentException { if (color.isFormat()) { throw new IllegalArgumentException("Formatting codes cannot be used as a team color!"); } this.color = color; }
color = null; formatting.clear(); } else if (code.isFormat()) { formatting.add(code); } else {
/** * Sets the stylization of the current editing component. * * @param styles The array of styles to apply to the editing component. * @return This builder instance. * @throws IllegalArgumentException If any of the enumeration values in the array do not represent formatters. */ public FancyMessage style(ChatColor... styles) { for (final ChatColor style : styles) { if (!style.isFormat()) { throw new IllegalArgumentException(style.name() + " is not a style"); } } latest().styles.addAll(Arrays.asList(styles)); dirty = true; return this; }
public FancyMessage style(final ChatColor... styles) { for (final ChatColor style : styles) { if (!style.isFormat()) { throw new IllegalArgumentException(style.name() + " is not a style"); } } latest().setStyles(styles); return this; }
@Deprecated private static String getLastFormat(String str) { String format = null; int length = str.length(); for (int index = length - 2; index > -1; index--) { char chr = str.charAt(index); if (chr == ChatColor.COLOR_CHAR) { char c = str.charAt(index + 1); ChatColor style = ChatColor.getByChar(c); if (style == null) continue; if (style.isColor()) return style.toString() + (format == null ? "" : format); if (style.isFormat() && format == null) format = style.toString(); } } return (format == null ? "" : format); }
if (color.isFormat() && !lastFormats.contains(color)) { lastFormats.add(color);
} else if (color.isFormat()) { switch (color) { case BOLD: {