类 MessageBuilder
java.lang.Object
cn.afternode.commons.bukkit.message.MessageBuilder
-
构造器概要
构造器构造器说明MessageBuilder(boolean styleStack) MessageBuilder(@Nullable cn.afternode.commons.localizations.ILocalizations locale) MessageBuilder(@Nullable cn.afternode.commons.localizations.ILocalizations locale, @Nullable net.kyori.adventure.text.ComponentLike linePrefix, @Nullable org.bukkit.command.CommandSender sender, boolean styleStack) -
方法概要
修饰符和类型方法说明append(net.kyori.adventure.text.ComponentLike componentLike) Append adventure componentnet.kyori.adventure.text.TextComponentbuild()Convert this builder to an Adventure componentvoidClear style stack and push a default styleclick(net.kyori.adventure.text.event.ClickEvent event) Append click eventAppend empty linenet.kyori.adventure.text.ComponentLikecn.afternode.commons.localizations.ILocalizationsorg.bukkit.command.CommandSenderhover(net.kyori.adventure.text.event.HoverEventSource<?> source) Append HoverEventline()Append new line with prefixlinePrefix(net.kyori.adventure.text.ComponentLike prefix) localizations(cn.afternode.commons.localizations.ILocalizations localizations) Append localized text, a localizations object must be passed to this builderAppend localized text with placeholder, a localizations object must be passed to this builderAppend MiniMessage (overwrites style)
MiniMessage docspermission(String permission, net.kyori.adventure.text.ComponentLike componentLike) Check sender permission and append adventure component, a CommandSender must be passed to this builderpermission(org.bukkit.permissions.Permission permission, net.kyori.adventure.text.ComponentLike component) Check sender permission and append adventure component, a CommandSender must be passed to this buildervoidpopStyle()Pop style stackvoidPush a default style to the stackvoidsend()Convert this builder to Adventure component and send it to sender of this builder
A sender must be passed to this buildervoidsend(org.bukkit.command.CommandSender sender) Convert this builder to Adventure component and send it to sendersender(org.bukkit.command.CommandSender sender) style()Get style at top of stackAppend raw textAppend colored raw text (overwrites style)voidEnable style stack and push a default style
-
构造器详细资料
-
MessageBuilder
public MessageBuilder(@Nullable @Nullable cn.afternode.commons.localizations.ILocalizations locale, @Nullable @Nullable net.kyori.adventure.text.ComponentLike linePrefix, @Nullable @Nullable org.bukkit.command.CommandSender sender, boolean styleStack) -
MessageBuilder
public MessageBuilder(@Nullable @Nullable cn.afternode.commons.localizations.ILocalizations locale) -
MessageBuilder
public MessageBuilder() -
MessageBuilder
public MessageBuilder(boolean styleStack)
-
-
方法详细资料
-
pushStyle
public void pushStyle()Push a default style to the stack -
style
Get style at top of stack- 返回:
- Style, or null if style stack not enabled
-
popStyle
public void popStyle()Pop style stack -
clearStyle
public void clearStyle()Clear style stack and push a default style -
useStyleStack
public void useStyleStack()Enable style stack and push a default style -
localize
Append localized text with placeholder, a localizations object must be passed to this builder- 参数:
key- Localization keyplaceholders- Localization placeholder- 返回:
- This builder
- 另请参阅:
-
localizationslocalizations(ILocalizations)ILocalizations.get(String, Map)
-
localize
Append localized text, a localizations object must be passed to this builder- 参数:
key- Localization key- 返回:
- This builder
- 另请参阅:
-
localizationslocalizations(ILocalizations)ILocalizations.get(String, Map)
-
text
Append raw text- 参数:
text- Raw text- 返回:
- This builder
-
text
Append colored raw text (overwrites style)- 参数:
text- Raw textcolor- AWT color- 返回:
- This builder
- 另请参阅:
-
mini
Append MiniMessage (overwrites style)
MiniMessage docs- 参数:
mini- MiniMessage string- 返回:
- This builder
-
hover
Append HoverEvent- 参数:
source- Event source- 返回:
- This builder
- 另请参阅:
-
HoverEvent
-
click
Append click event- 参数:
event- Event- 返回:
- This builder
- 另请参阅:
-
ClickEvent
-
append
Append adventure component- 参数:
componentLike- Component- 返回:
- This builder
- 另请参阅:
-
Component
-
line
Append new line with prefix- 返回:
- This builder
- 另请参阅:
-
linePrefixlinePrefix(ComponentLike)
-
emptyLine
Append empty line- 返回:
- This builder
-
permission
public MessageBuilder permission(String permission, net.kyori.adventure.text.ComponentLike componentLike) Check sender permission and append adventure component, a CommandSender must be passed to this builder- 参数:
permission- Permission to checkcomponentLike- Adventure component- 返回:
- This builder
- 另请参阅:
-
sendersender(CommandSender)
-
permission
public MessageBuilder permission(org.bukkit.permissions.Permission permission, net.kyori.adventure.text.ComponentLike component) Check sender permission and append adventure component, a CommandSender must be passed to this builder- 参数:
permission- Permission to checkcomponent- Adventure component- 返回:
- This builder
- 另请参阅:
-
sendersender(CommandSender)
-
build
public net.kyori.adventure.text.TextComponent build()Convert this builder to an Adventure component- 返回:
- Adventure component
-
send
public void send()Convert this builder to Adventure component and send it to sender of this builder
A sender must be passed to this builder- 另请参阅:
-
sender(CommandSender)senderbuild()
-
send
public void send(org.bukkit.command.CommandSender sender) Convert this builder to Adventure component and send it to sender -
getLocalizations
public cn.afternode.commons.localizations.ILocalizations getLocalizations() -
localizations
public MessageBuilder localizations(cn.afternode.commons.localizations.ILocalizations localizations) -
getLinePrefix
public net.kyori.adventure.text.ComponentLike getLinePrefix() -
linePrefix
-
getSender
public org.bukkit.command.CommandSender getSender() -
sender
-