Klasse CommandSupport
java.lang.Object
de.delinkedde.mobarenareborn.command.CommandSupport
Static helpers shared by the command implementations.
Provides sender resolution, prefixed feedback and Brigadier suggestion providers. The class is stateless and cannot be instantiated.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic @NotNull com.mojang.brigadier.suggestion.SuggestionProvider<CommandSourceStack> arenaNames(@NotNull ArenaManager manager) Builds a suggestion provider that completes the names of all loaded arenas.static voidfeedback(@NotNull CommandSourceStack source, @NotNull Messages messages, @NotNull String miniMessage) Sends a prefixed MiniMessage line to the command sender.static voidmsg(@NotNull CommandSourceStack source, @NotNull Messages messages, @NotNull String key, @NotNull String def, @NotNull String... replacements) Sends a translatable, prefixed message to the command sender.static @Nullable PlayerplayerOrNull(@NotNull CommandSourceStack source, @NotNull Messages messages) Returns the command sender as a player, or sends an error and returnsnull.static @NotNull com.mojang.brigadier.suggestion.SuggestionProvider<CommandSourceStack> suggest(@NotNull Collection<String> options) Builds a suggestion provider from a fixed set of options.
-
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 returnsnull.- Parameter:
source- the command sourcemessages- the message renderer used for the error- Gibt zurück:
- the player, or
nullif 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 sourcemessages- the message renderer providing the prefixminiMessage- 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 undermessages.<key>is used when present, otherwise the given default; placeholder/value pairs are applied afterwards.- Parameter:
source- the command sourcemessages- the message rendererkey- the message key relative to themessagessectiondef- 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
-