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.
-
-
Constructor Summary
Constructors Constructor Description SelectorComponent(String selector)Creates a selector component from the selectorSelectorComponent(String selector, BaseComponent separator)SelectorComponent(SelectorComponent original)Creates a selector component from the original to clone it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)SelectorComponentduplicate()Clones the BaseComponent and returns the clone.booleanequals(Object o)StringgetSelector()An entity target selector (@p, @a, @r, @e, or @s) and, optionally, selector arguments (e.g.BaseComponentgetSeparator()The separator of multiple selected entities.inthashCode()voidsetSelector(String selector)An entity target selector (@p, @a, @r, @e, or @s) and, optionally, selector arguments (e.g.voidsetSeparator(BaseComponent separator)The separator of multiple selected entities.protected voidtoLegacyText(StringBuilder builder)protected voidtoPlainText(StringBuilder builder)StringtoString()-
Methods inherited from class net.md_5.bungee.api.chat.BaseComponent
addExtra, addExtra, copyFormatting, copyFormatting, copyFormatting, duplicateWithoutFormatting, getClickEvent, getColor, getColorRaw, getExtra, getFont, getFontRaw, getHoverEvent, getInsertion, hasFormatting, isBold, isBoldRaw, isItalic, isItalicRaw, isObfuscated, isObfuscatedRaw, isReset, isStrikethrough, isStrikethroughRaw, isUnderlined, isUnderlinedRaw, retain, setBold, setClickEvent, setColor, setExtra, setFont, setHoverEvent, setInsertion, setItalic, setObfuscated, setReset, setStrikethrough, setUnderlined, toLegacyText, toLegacyText, toPlainText, toPlainText
-
-
-
-
Constructor Detail
-
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)
-
-
Method Detail
-
duplicate
public SelectorComponent duplicate()
Description copied from class:BaseComponentClones the BaseComponent and returns the clone.- Specified by:
duplicatein classBaseComponent- Returns:
- The duplicate of this BaseComponent
-
toPlainText
protected void toPlainText(StringBuilder builder)
-
toLegacyText
protected void toLegacyText(StringBuilder 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:
toStringin classBaseComponent
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classBaseComponent
-
canEqual
protected boolean canEqual(Object other)
- Overrides:
canEqualin classBaseComponent
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBaseComponent
-
-