类 MessageBuilder

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

public class MessageBuilder extends Object
  • 构造器详细资料

    • 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

      public ComponentStyle 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

      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
      另请参阅:
    • 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
      另请参阅:
    • 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
      另请参阅:
    • 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 check
      component - Adventure component
      返回:
      This builder
      另请参阅:
    • 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
      另请参阅:
    • send

      public void send(org.bukkit.command.CommandSender sender)
      Convert this builder to Adventure component and send it to sender
      参数:
      sender - Bukkit CommandSender
      另请参阅:
    • 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

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

      public org.bukkit.command.CommandSender getSender()
    • sender

      public MessageBuilder sender(org.bukkit.command.CommandSender sender)