Class TextUtils

java.lang.Object
net.kamkeyke.raccooncore.util.TextUtils

public class TextUtils extends Object
Utility class containing helper methods for building formatted text Components.

This class centralizes common text formatting logic used across commands, messages and UI-related things.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.network.chat.Component
    buildComponentList(List<net.minecraft.network.chat.MutableComponent> components)
     
    static net.minecraft.network.chat.Component
    buildComponentUnorderedList(List<net.minecraft.network.chat.MutableComponent> components)
     
    static net.minecraft.network.chat.Component
    buildPlayerList(Collection<? extends net.minecraft.world.entity.player.Player> players)
    Builds a human-readable Component containing the provided players' display names.
    static net.minecraft.network.chat.Component
    buildPlayerListCopyName(Collection<? extends net.minecraft.world.entity.player.Player> players)
    Builds a human-readable Component containing the provided players' display names.
    static net.minecraft.network.chat.Component
    buildPlayerListCopyUUID(Collection<? extends net.minecraft.world.entity.player.Player> players)
    Builds a human-readable Component containing the provided players' display names.

    Methods inherited from class java.lang.Object

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

    • TextUtils

      public TextUtils()
  • Method Details

    • buildPlayerList

      public static net.minecraft.network.chat.Component buildPlayerList(Collection<? extends net.minecraft.world.entity.player.Player> players)
      Builds a human-readable Component containing the provided players' display names.
      • 1 player → Player
      • 2 players → Player1 and Player2
      • 3+ players → Player1, Player2 and Player3

      The returned component preserves each player's display name formatting and defers translation resolution to the client.

      Parameters:
      players - the collection of players whose names should be formatted
      Returns:
      a formatted Component representing the player list
    • buildPlayerListCopyName

      public static net.minecraft.network.chat.Component buildPlayerListCopyName(Collection<? extends net.minecraft.world.entity.player.Player> players)
      Builds a human-readable Component containing the provided players' display names. Clicking a player's name will copy their nickname to the clipboard.
      • 1 player → Player
      • 2 players → Player1 and Player2
      • 3+ players → Player1, Player2 and Player3

      The returned component preserves each player's display name formatting and defers translation resolution to the client.

      Parameters:
      players - the collection of players whose names should be formatted
      Returns:
      a formatted Component representing the player list
    • buildPlayerListCopyUUID

      public static net.minecraft.network.chat.Component buildPlayerListCopyUUID(Collection<? extends net.minecraft.world.entity.player.Player> players)
      Builds a human-readable Component containing the provided players' display names. Clicking a player's name will copy their UUID to the clipboard.
      • 1 player → Player
      • 2 players → Player1 and Player2
      • 3+ players → Player1, Player2 and Player3

      The returned component preserves each player's display name formatting and defers translation resolution to the client.

      Parameters:
      players - the collection of players whose names should be formatted
      Returns:
      a formatted Component representing the player list
    • buildComponentList

      public static net.minecraft.network.chat.Component buildComponentList(List<net.minecraft.network.chat.MutableComponent> components)
    • buildComponentUnorderedList

      public static net.minecraft.network.chat.Component buildComponentUnorderedList(List<net.minecraft.network.chat.MutableComponent> components)