Example #1
0
 public JSONMessage style(final ChatColor... styles) {
   for (final ChatColor style : styles) {
     if (!style.isFormat()) {
       throw new IllegalArgumentException(style.name() + " is not a style");
     }
   }
   latest().styles = styles;
   return this;
 }
 /**
  * Sets the stylization of the current editing component.
  *
  * @param styles The array of styles to apply to the editing component.
  * @return This builder instance.
  * @exception 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;
 }
Example #3
0
  static {
    ImmutableBiMap.Builder<ChatColor, String> builder = ImmutableBiMap.builder();
    for (ChatColor style : ChatColor.values()) {
      if (!style.isFormat()) {
        continue;
      }

      String styleName;
      switch (style) {
        case MAGIC:
          styleName = "obfuscated";
          break;
        case UNDERLINE:
          styleName = "underlined";
          break;
        default:
          styleName = style.name().toLowerCase();
          break;
      }

      builder.put(style, styleName);
    }
    stylesToNames = builder.build();
  }