类 MessageBuilder

java.lang.Object
cn.afternode.commons.velocity.message.MessageBuilder

public class MessageBuilder extends Object
Velocity message builder implementation
  • 构造器详细资料

    • 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 provider
      linePrefix - Prefix of each line
      target - Message target
    • MessageBuilder

      public MessageBuilder()
      Create a basic message builder
  • 方法详细资料

    • text

      public MessageBuilder text(String text)
      Append raw text
      参数:
      text - Raw text
      返回:
      This builder
    • text

      public MessageBuilder text(String text, Color color)
      Append colored raw text (overwrites style)
      参数:
      text - Raw text
      color - AWT color
      返回:
      This builder
      另请参阅:
    • localize

      public MessageBuilder localize(String key, Map<String,Object> placeholders)
      Append localized text with placeholder, a localizations object must be passed to this builder
      参数:
      key - Localization key
      placeholders - Localization placeholder
      返回:
      This builder
      另请参阅:
    • localize

      public MessageBuilder localize(String key)
      Append localized text, a localizations object must be passed to this builder
      参数:
      key - Localization key
      返回:
      This builder
      另请参阅:
    • mini

      public MessageBuilder mini(String mini)
      Append MiniMessage (overwrites style)
      MiniMessage docs
      参数:
      mini - MiniMessage string
      返回:
      This builder
    • hover

      public MessageBuilder hover(net.kyori.adventure.text.event.HoverEventSource<?> source)
      Append HoverEvent
      参数:
      source - Event source
      返回:
      This builder
      另请参阅:
      • HoverEvent
    • click

      public MessageBuilder click(net.kyori.adventure.text.event.ClickEvent event)
      Append click event
      参数:
      event - Event
      返回:
      This builder
      另请参阅:
      • ClickEvent
    • append

      public MessageBuilder append(net.kyori.adventure.text.ComponentLike componentLike)
      Append adventure component
      参数:
      componentLike - Component
      返回:
      This builder
      另请参阅:
      • Component
    • line

      public MessageBuilder line()
      Append new line with prefix
      返回:
      This builder
      另请参阅:
    • emptyLine

      public MessageBuilder 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 check
      componentLike - 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

      public MessageBuilder linePrefix(net.kyori.adventure.text.ComponentLike linePrefix)
    • target

      public com.velocitypowered.api.command.CommandSource target()
    • target

      public MessageBuilder target(com.velocitypowered.api.command.CommandSource 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
      另请参阅:
    • send

      public void send(com.velocitypowered.api.command.CommandSource target)
      Convert this builder to Adventure component and send it to target
      参数:
      target - Bukkit CommandSender
      另请参阅: