Package net.md_5.bungee.api.chat

# Class SelectorComponent

java.lang.Object
net.md_5.bungee.api.chat.BaseComponent
net.md_5.bungee.api.chat.SelectorComponent

public final class SelectorComponent extends BaseComponent
This component processes a target selector into a pre-formatted set of discovered names.
Multiple targets may be obtained, and with commas separating each one and a final "and" for the last target. The resulting format cannot be overwritten. This includes all styling from team prefixes, insertions, click events, and hover events.
These values are filled in by the server-side implementation.
As of 1.12.2, a bug ( MC-56373 ) prevents full usage within hover events.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class net.md_5.bungee.api.chat.BaseComponent

  `BaseComponent.LimitedStringVisitor, BaseComponent.StringVisitor`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SelectorComponent(String selector)`
  Creates a selector component from the selector
  `SelectorComponent(String selector, BaseComponent separator)`
  Creates a new `SelectorComponent` instance.
  `SelectorComponent(SelectorComponent original)`
  Creates a selector component from the original to clone it.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `canEqual(Object other)`
  `SelectorComponent`
  `duplicate()`
  Clones the BaseComponent and returns the clone.
  `boolean`
  `equals(Object o)`
  `String`
  `getSelector()`
  An entity target selector (@p, @a, @r, @e, or @s) and, optionally, selector arguments (e.g.
  `BaseComponent`
  `getSeparator()`
  The separator of multiple selected entities.
  `int`
  `hashCode()`
  `void`
  `setSelector(String selector)`
  An entity target selector (@p, @a, @r, @e, or @s) and, optionally, selector arguments (e.g.
  `void`
  `setSeparator(BaseComponent separator)`
  The separator of multiple selected entities.
  `protected void`
  `toLegacyText(BaseComponent.StringVisitor builder)`
  `protected void`
  `toPlainText(BaseComponent.StringVisitor builder)`
  `String`
  `toString()`

  ### Methods inherited from class net.md_5.bungee.api.chat.BaseComponent

  `addExtra, addExtra, applyStyle, copyFormatting, copyFormatting, copyFormatting, duplicateWithoutFormatting, getClickEvent, getColor, getColorRaw, getExtra, getFont, getFontRaw, getHoverEvent, getInsertion, getShadowColor, getShadowColorRaw, getStyle, hasFormatting, hasStyle, isBold, isBoldRaw, isItalic, isItalicRaw, isObfuscated, isObfuscatedRaw, isReset, isStrikethrough, isStrikethroughRaw, isUnderlined, isUnderlinedRaw, retain, setBold, setClickEvent, setColor, setExtra, setFont, setHoverEvent, setInsertion, setItalic, setObfuscated, setReset, setShadowColor, setStrikethrough, setStyle, setUnderlined, toLegacyText, toLegacyText, toPlainText, toPlainText`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### SelectorComponent

    public SelectorComponent(SelectorComponent original)
    Creates a selector component from the original to clone it.
    Parameters:
      `original` - the original for the new selector component

  - ### SelectorComponent

    public SelectorComponent(String selector)
    Creates a selector component from the selector
    Parameters:
      `selector` - the selector as a String

  - ### SelectorComponent

    public SelectorComponent(String selector, BaseComponent separator)
    Creates a new `SelectorComponent` instance.
    Parameters:
      `selector` - An entity target selector (@p, @a, @r, @e, or @s) and, optionally, selector arguments (e.g. @e[r=10,type=Creeper]).
      `separator` - The separator of multiple selected entities.
      The default is `{"color": "gray", "text": ", "}`.

- ## Method Details

  - ### duplicate

    public SelectorComponent duplicate()
    Description copied from class: `BaseComponent`
    Clones the BaseComponent and returns the clone.
    Specified by:
      `duplicate` in class `BaseComponent`
    Returns:
      The duplicate of this BaseComponent

  - ### toPlainText

    protected void toPlainText(BaseComponent.StringVisitor builder)

  - ### toLegacyText

    protected void toLegacyText(BaseComponent.StringVisitor builder)

  - ### getSelector

    public String getSelector()
    An entity target selector (@p, @a, @r, @e, or @s) and, optionally, selector arguments (e.g. @e[r=10,type=Creeper]).

  - ### getSeparator

    public BaseComponent getSeparator()
    The separator of multiple selected entities.
    The default is `{"color": "gray", "text": ", "}`.

  - ### setSelector

    public void setSelector(String selector)
    An entity target selector (@p, @a, @r, @e, or @s) and, optionally, selector arguments (e.g. @e[r=10,type=Creeper]).

  - ### setSeparator

    public void setSeparator(BaseComponent separator)
    The separator of multiple selected entities.
    The default is `{"color": "gray", "text": ", "}`.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `BaseComponent`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `BaseComponent`

  - ### canEqual

    protected boolean canEqual(Object other)
    Overrides:
      `canEqual` in class `BaseComponent`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `BaseComponent`