Klasse CommandSupport

java.lang.Object
de.delinkedde.mobarenareborn.command.CommandSupport

public final class CommandSupport extends Object
Static helpers shared by the command implementations.

Provides sender resolution, prefixed feedback and Brigadier suggestion providers. The class is stateless and cannot be instantiated.

  • Methodendetails

    • playerOrNull

      @Nullable public static @Nullable Player playerOrNull(@NotNull @NotNull CommandSourceStack source, @NotNull @NotNull Messages messages)
      Returns the command sender as a player, or sends an error and returns null.
      Parameter:
      source - the command source
      messages - the message renderer used for the error
      Gibt zurück:
      the player, or null if the sender is not a player
    • feedback

      public static void feedback(@NotNull @NotNull CommandSourceStack source, @NotNull @NotNull Messages messages, @NotNull @NotNull String miniMessage)
      Sends a prefixed MiniMessage line to the command sender.
      Parameter:
      source - the command source
      messages - the message renderer providing the prefix
      miniMessage - the MiniMessage body
    • msg

      public static void msg(@NotNull @NotNull CommandSourceStack source, @NotNull @NotNull Messages messages, @NotNull @NotNull String key, @NotNull @NotNull String def, @NotNull @NotNull String... replacements)
      Sends a translatable, prefixed message to the command sender. The configured value under messages.<key> is used when present, otherwise the given default; placeholder/value pairs are applied afterwards.
      Parameter:
      source - the command source
      messages - the message renderer
      key - the message key relative to the messages section
      def - the built-in default (MiniMessage)
      replacements - placeholder/value pairs
    • arenaNames

      @NotNull public static @NotNull com.mojang.brigadier.suggestion.SuggestionProvider<CommandSourceStack> arenaNames(@NotNull @NotNull ArenaManager manager)
      Builds a suggestion provider that completes the names of all loaded arenas.
      Parameter:
      manager - the arena manager to read names from
      Gibt zurück:
      a suggestion provider
    • suggest

      @NotNull public static @NotNull com.mojang.brigadier.suggestion.SuggestionProvider<CommandSourceStack> suggest(@NotNull @NotNull Collection<String> options)
      Builds a suggestion provider from a fixed set of options.
      Parameter:
      options - the options to offer
      Gibt zurück:
      a suggestion provider