Class ChatLayout

java.lang.Object
dev.despical.pixelpainter.command.ChatLayout

public final class ChatLayout extends Object
Provides shared chat layout primitives for panel headings, hints and navigation.

Text is measured with Minecraft bitmap-font advances so centering depends on the rendered width instead of the character count. Formatting and interactions of the wrapped components are retained; only spacing is added. Console senders receive the plain text path of Messages.reply(CommandSender, Component).

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    centered(org.bukkit.command.CommandSender sender, Messages messages, net.kyori.adventure.text.Component component, boolean bold)
    Sends a component centered for players, or unchanged for the console.
    static void
    header(org.bukkit.command.CommandSender sender, Messages messages, String title, Object... replacements)
    Sends the separator, an empty line and the centered bold title to players.
    static void
    navigation(org.bukkit.command.CommandSender sender, Messages messages, String command, int page, int pages)
    Sends centered previous and next buttons when more than one page exists.
    static int
    pixelWidth(net.kyori.adventure.text.Component component, boolean bold)
    Measures a component in bitmap-font pixels.
    static String
    wrap(String text, int columns)
    Wraps text at word boundaries for hover descriptions.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • header

      public static void header(org.bukkit.command.CommandSender sender, Messages messages, String title, Object... replacements)
      Sends the separator, an empty line and the centered bold title to players.
      Parameters:
      sender - command audience
      messages - active messages
      title - title message key
      replacements - alternating placeholder names and values
    • centered

      public static void centered(org.bukkit.command.CommandSender sender, Messages messages, net.kyori.adventure.text.Component component, boolean bold)
      Sends a component centered for players, or unchanged for the console.
      Parameters:
      sender - command audience
      messages - active messages
      component - content to center
      bold - whether the content is rendered bold
    • pixelWidth

      public static int pixelWidth(net.kyori.adventure.text.Component component, boolean bold)
      Measures a component in bitmap-font pixels.
      Parameters:
      component - content to measure
      bold - whether bold glyph widening applies
      Returns:
      width in font pixels
    • wrap

      public static String wrap(String text, int columns)
      Wraps text at word boundaries for hover descriptions.
      Parameters:
      text - text to wrap
      columns - maximum characters per line
      Returns:
      text with line breaks