Package net.md_5.bungee.api.chat
Class TranslatableComponent
- java.lang.Object
-
- net.md_5.bungee.api.chat.BaseComponent
-
- net.md_5.bungee.api.chat.TranslatableComponent
-
public final class TranslatableComponent extends BaseComponent
-
-
Constructor Summary
Constructors Constructor Description TranslatableComponent()TranslatableComponent(String translate, Object... with)Creates a translatable component with the passed substitutionsTranslatableComponent(TranslatableComponent original)Creates a translatable component from the original to clone it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWith(String text)Adds a text substitution to the component.voidaddWith(BaseComponent component)Adds a component substitution to the component.protected booleancanEqual(Object other)TranslatableComponentduplicate()Creates a duplicate of this TranslatableComponent.booleanequals(Object o)StringgetFallback()The fallback, if the translation is not foundPatterngetFormat()StringgetTranslate()The key into the Minecraft locale files to use for the translation.List<BaseComponent>getWith()The components to substitute into the translationinthashCode()voidsetFallback(String fallback)The fallback, if the translation is not foundvoidsetTranslate(String translate)The key into the Minecraft locale files to use for the translation.voidsetWith(List<BaseComponent> components)Sets the translation substitutions to be used in this component.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
-
TranslatableComponent
public TranslatableComponent(TranslatableComponent original)
Creates a translatable component from the original to clone it.- Parameters:
original- the original for the new translatable component.
-
TranslatableComponent
public TranslatableComponent(String translate, Object... with)
Creates a translatable component with the passed substitutions- Parameters:
translate- the translation keywith- theStrings andBaseComponents to use into the translation- See Also:
translate,setWith(java.util.List)
-
TranslatableComponent
public TranslatableComponent()
-
-
Method Detail
-
duplicate
public TranslatableComponent duplicate()
Creates a duplicate of this TranslatableComponent.- Specified by:
duplicatein classBaseComponent- Returns:
- the duplicate of this TranslatableComponent.
-
setWith
public void setWith(List<BaseComponent> components)
Sets the translation substitutions to be used in this component. Removes any previously set substitutions- Parameters:
components- the components to substitute
-
addWith
public void addWith(String text)
Adds a text substitution to the component. The text will inherit this component's formatting- Parameters:
text- the text to substitute
-
addWith
public void addWith(BaseComponent component)
Adds a component substitution to the component. The text will inherit this component's formatting- Parameters:
component- the component to substitute
-
toPlainText
protected void toPlainText(StringBuilder builder)
-
toLegacyText
protected void toLegacyText(StringBuilder builder)
-
getFormat
public Pattern getFormat()
-
getTranslate
public String getTranslate()
The key into the Minecraft locale files to use for the translation. The text depends on the client's locale setting. The console is always en_US
-
getWith
public List<BaseComponent> getWith()
The components to substitute into the translation
-
getFallback
public String getFallback()
The fallback, if the translation is not found
-
setTranslate
public void setTranslate(String translate)
The key into the Minecraft locale files to use for the translation. The text depends on the client's locale setting. The console is always en_US
-
setFallback
public void setFallback(String fallback)
The fallback, if the translation is not found
-
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
-
-