Class Component

java.lang.Object
me.unurled.srcore.utils.Component

public class Component extends Object
Utility class for working with components.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The message to display when an error occurs while executing a command.
    static final String
    The message to display when the player does not have permission to use a command.
    static final String
    The message to display when the player is not a player.
    static final String
    The message to display when a player is not found.
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull net.kyori.adventure.audience.Audience
    audience(org.bukkit.entity.Player player)
    Gets an audience for a player.
    static @NotNull net.kyori.adventure.text.Component
    comp(String msg)
    Converts a string to a MiniMessage component.
    static List<net.kyori.adventure.text.Component>
    fromStringList(@NotNull List<String> list)
    Converts a list of strings to a list of MiniMessage components.
    static @NotNull net.kyori.adventure.text.TextComponent
    Converts a string to a TextComponent.

    Methods inherited from class java.lang.Object

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

    • NOT_PLAYER

      public static final String NOT_PLAYER
      The message to display when the player is not a player.
      See Also:
    • NO_PERMISSION

      public static final String NO_PERMISSION
      The message to display when the player does not have permission to use a command.
      See Also:
    • ERROR

      public static final String ERROR
      The message to display when an error occurs while executing a command.
      See Also:
    • PLAYER_NOT_FOUND

      public static final String PLAYER_NOT_FOUND
      The message to display when a player is not found.
      See Also:
  • Method Details

    • comp

      public static @NotNull net.kyori.adventure.text.Component comp(String msg)
      Converts a string to a MiniMessage component.
      Parameters:
      msg - the string to convert
      Returns:
      the MiniMessage component
    • textComp

      public static @NotNull net.kyori.adventure.text.TextComponent textComp(String msg)
      Converts a string to a TextComponent.
      Parameters:
      msg - the string to convert
      Returns:
      the TextComponent
    • fromStringList

      public static List<net.kyori.adventure.text.Component> fromStringList(@NotNull @NotNull List<String> list)
      Converts a list of strings to a list of MiniMessage components.
      Parameters:
      list - the list of strings to convert
      Returns:
      the list of MiniMessage components
    • audience

      @Contract(pure=true) @NotNull public static @NotNull net.kyori.adventure.audience.Audience audience(org.bukkit.entity.Player player)
      Gets an audience for a player.
      Parameters:
      player - the player
      Returns:
      the audience