/**
   * Set the behavior of the current editing component to display the specified lines of formatted
   * text when the client hovers over the text.
   *
   * <p>Tooltips do not inherit display characteristics, such as color and styles, from the message
   * component on which they are applied.
   *
   * @param lines The lines of formatted text which will be displayed to the client upon hovering.
   * @return This builder instance.
   */
  public FancyMessage formattedTooltip(FancyMessage... lines) {
    if (lines.length < 1) {
      onHover(null, null); // Clear tooltip
      return this;
    }

    FancyMessage result = new FancyMessage();
    result.messageParts
        .clear(); // Remove the one existing text component that exists by default, which
    // destabilizes the object

    for (int i = 0; i < lines.length; i++) {
      try {
        for (MessagePart component : lines[i]) {
          if (component.clickActionData != null && component.clickActionName != null) {
            throw new IllegalArgumentException("The tooltip text cannot have click data.");
          } else if (component.hoverActionData != null && component.hoverActionName != null) {
            throw new IllegalArgumentException("The tooltip text cannot have a tooltip.");
          }
          if (component.hasText()) {
            result.messageParts.add(component.clone());
          }
        }
        if (i != lines.length - 1) {
          result.messageParts.add(new MessagePart(rawText("\n")));
        }
      } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return this;
      }
    }
    return formattedTooltip(
        result.messageParts.size() == 0 ? null : result); // Throws NPE if size is 0, intended
  }
 public FancyMessage text(TextualComponent text) {
   MessagePart latest = latest();
   if (latest.hasText()) {
     throw new IllegalStateException("text for this message part is already set");
   }
   latest.text = text;
   dirty = true;
   return this;
 }
 /**
  * Sets the text of the current editing component to a value.
  *
  * @param text The new text of the current editing component.
  * @return This builder instance.
  * @exception IllegalStateException If the text for the current editing component has already been
  *     set.
  */
 public FancyMessage text(String text) {
   MessagePart latest = latest();
   if (latest.hasText()) {
     throw new IllegalStateException("text for this message part is already set");
   }
   latest.text = rawText(text);
   dirty = true;
   return this;
 }