类 MessageBuilder
java.lang.Object
cn.afternode.commons.velocity.message.MessageBuilder
Velocity message builder implementation
-
构造器概要
构造器构造器说明Create a basic message builderMessageBuilder(cn.afternode.commons.localizations.ILocalizations localizations, net.kyori.adventure.text.ComponentLike linePrefix, com.velocitypowered.api.command.CommandSource target) Primary constructor -
方法概要
修饰符和类型方法说明append(net.kyori.adventure.text.ComponentLike componentLike) Append adventure componentnet.kyori.adventure.text.TextComponentbuild()Convert this builder to an Adventure componentclick(net.kyori.adventure.text.event.ClickEvent event) Append click eventAppend empty lineUNSAFE
Append gradient text, this method uses MiniMessage, may cause injection, NEVER insert player messages with this
MiniMessage docsUNSAFE
Append gradient text, this method uses MiniMessage, may cause injection, NEVER insert player messages with this
MiniMessage docshover(net.kyori.adventure.text.event.HoverEventSource<?> source) Append HoverEventline()Append new line with prefixnet.kyori.adventure.text.ComponentLikelinePrefix(net.kyori.adventure.text.ComponentLike linePrefix) cn.afternode.commons.localizations.ILocalizationslocalizations(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 buildervoidsend()Convert this builder to Adventure component and send it to target of this builder
A sender must be passed to this buildervoidsend(com.velocitypowered.api.command.CommandSource target) Convert this builder to Adventure component and send it to targetcom.velocitypowered.api.command.CommandSourcetarget()target(com.velocitypowered.api.command.CommandSource target) Append raw textAppend colored raw text (overwrites style)
-
构造器详细资料
-
MessageBuilder
public MessageBuilder(cn.afternode.commons.localizations.ILocalizations localizations, net.kyori.adventure.text.ComponentLike linePrefix, com.velocitypowered.api.command.CommandSource target) Primary constructor- 参数:
localizations- Localizations providerlinePrefix- Prefix of each linetarget- Message target
-
MessageBuilder
public MessageBuilder()Create a basic message builder
-
-
方法详细资料
-
text
Append raw text- 参数:
text- Raw text- 返回:
- This builder
-
text
Append colored raw text (overwrites style)- 参数:
text- Raw textcolor- AWT color- 返回:
- This builder
- 另请参阅:
-
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)
-
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
-
gradient
UNSAFE
Append gradient text, this method uses MiniMessage, may cause injection, NEVER insert player messages with this
MiniMessage docs- 参数:
text- Textcolors- Colors- 返回:
- This builder
-
gradient
UNSAFE
Append gradient text, this method uses MiniMessage, may cause injection, NEVER insert player messages with this
MiniMessage docs- 参数:
text- Textcolors- Colors- 返回:
- 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
-
localizations
public cn.afternode.commons.localizations.ILocalizations localizations() -
localizations
public MessageBuilder localizations(cn.afternode.commons.localizations.ILocalizations localizations) -
linePrefix
public net.kyori.adventure.text.ComponentLike linePrefix() -
linePrefix
-
target
public com.velocitypowered.api.command.CommandSource target() -
target
-
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 target of this builder
A sender must be passed to this builder- 另请参阅:
-
target(CommandSource)Audience.sendMessage(Component)build()
-
send
public void send(com.velocitypowered.api.command.CommandSource target) Convert this builder to Adventure component and send it to target
-