Package net.realdarkstudios.commons.util
Class TextComponentBuilder
java.lang.Object
net.realdarkstudios.commons.util.TextComponentBuilder
A builder for
TextComponents- Since:
- before 0.1.4.3-2
For localized messages, see
LocalizedMessagesandLocalizedMessages.StyleOptions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbold(boolean bold) Bolds thisTextComponentBuildernet.md_5.bungee.api.chat.TextComponentbuild()Builds thisTextComponentBuilderclickEvent(net.md_5.bungee.api.chat.ClickEvent.Action action, String value) Adds a click event to thisTextComponentBuildercolor(net.md_5.bungee.api.ChatColor color) Sets the color of thisTextComponentBuilderstatic TextComponentBuilderfromTextComponent(net.md_5.bungee.api.chat.TextComponent from) Static method to create aTextComponentBuilderfrom aTextComponent.static TextComponentBuilderfromTranslation(String key, Localization localization, Object... substitutions) Deprecated, for removal: This API element is subject to removal in a future version.static TextComponentBuilderfromTranslation(LocalizedMessages.Key key, Object... formatArgs) italic(boolean italic) Italicizes thisTextComponentBuilderobfuscate(boolean obfuscated) Obfuscates thisTextComponentBuilderstrikethrough(boolean strikethrough) Applies strikethrough to thisTextComponentBuilderunderline(boolean underline) Underlines thisTextComponentBuilder
-
Constructor Details
-
TextComponentBuilder
Creates aTextComponentBuilderwith the given message- Parameters:
msg- The message- Since:
- pre-0.1.4.3-2
-
-
Method Details
-
fromTextComponent
Static method to create aTextComponentBuilderfrom aTextComponent.- Parameters:
from- The TextComponent to use- Returns:
- The TextComponentBuilder
- Since:
- 0.3.0.5
-
fromTranslation
-
fromTranslation
@Deprecated(since="0.3.1.0", forRemoval=true) public static TextComponentBuilder fromTranslation(String key, Localization localization, Object... substitutions) Deprecated, for removal: This API element is subject to removal in a future version.Please usefromTranslation(LocalizedMessages.Key, Object...)insteadStatic method to create aTextComponentBuilderfrom a translation path.- Parameters:
key- The translation pathlocalization- The localization to usesubstitutions- The substitutions (or format args). UsesString.format(String, Object...)- Returns:
- The TextComponentBuilder
- Since:
- 0.3.0.5
-
color
Sets the color of thisTextComponentBuilder- Parameters:
color- The color to set- Returns:
- This TextComponentBuilder
-
bold
Bolds thisTextComponentBuilder- Returns:
- This TextComponentBuilder
- Since:
- pre-0.1.4.3-2
-
italic
Italicizes thisTextComponentBuilder- Returns:
- This TextComponentBuilder
- Since:
- pre-0.1.4.3-2
-
underline
Underlines thisTextComponentBuilder- Returns:
- This TextComponentBuilder
- Since:
- pre-0.1.4.3-2
-
strikethrough
Applies strikethrough to thisTextComponentBuilder- Returns:
- This TextComponentBuilder
- Since:
- pre-0.1.4.3-2
-
obfuscate
Obfuscates thisTextComponentBuilder- Returns:
- This TextComponentBuilder
- Since:
- pre-0.1.4.3-2
-
clickEvent
public TextComponentBuilder clickEvent(net.md_5.bungee.api.chat.ClickEvent.Action action, String value) Adds a click event to thisTextComponentBuilder- Parameters:
action- TheClickEvent.Actionto set.value- TheClickEventvalue- Returns:
- This TextComponentBuilder
- Since:
- pre-0.1.4.3-2
-
build
public net.md_5.bungee.api.chat.TextComponent build()Builds thisTextComponentBuilder- Returns:
- The TextComponent
- Since:
- pre-0.1.4.3-2
-
fromTranslation(LocalizedMessages.Key, Object...)instead