Package net.minecraft.commands
Class Commands
java.lang.Object
net.minecraft.commands.Commands
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ThreadLocal
<ExecutionContext<CommandSourceStack>> private final com.mojang.brigadier.CommandDispatcher
<CommandSourceStack> static final int
static final int
static final int
static final int
static final int
private static final org.slf4j.Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.mojang.brigadier.builder.RequiredArgumentBuilder
<CommandSourceStack, T> Creates a new argument.static CommandBuildContext
createValidationContext
(HolderLookup.Provider provider) static void
executeCommandInContext
(CommandSourceStack source, Consumer<ExecutionContext<CommandSourceStack>> contextConsumer) private void
fillUsableCommands
(com.mojang.brigadier.tree.CommandNode<CommandSourceStack> rootCommandSource, com.mojang.brigadier.tree.CommandNode<SharedSuggestionProvider> rootSuggestion, CommandSourceStack source, Map<com.mojang.brigadier.tree.CommandNode<CommandSourceStack>, com.mojang.brigadier.tree.CommandNode<SharedSuggestionProvider>> commandNodeToSuggestionNode) private static com.mojang.brigadier.context.ContextChain
<CommandSourceStack> finishParsing
(com.mojang.brigadier.ParseResults<CommandSourceStack> parseResults, String command, CommandSourceStack source) com.mojang.brigadier.CommandDispatcher
<CommandSourceStack> static <S> com.mojang.brigadier.exceptions.CommandSyntaxException
getParseException
(com.mojang.brigadier.ParseResults<S> result) static com.mojang.brigadier.builder.LiteralArgumentBuilder
<CommandSourceStack> Creates a new argument.static <S> com.mojang.brigadier.ParseResults
<S> mapSource
(com.mojang.brigadier.ParseResults<S> parseResults, UnaryOperator<S> mapper) void
performCommand
(com.mojang.brigadier.ParseResults<CommandSourceStack> parseResults, String command) void
performPrefixedCommand
(CommandSourceStack source, String command) void
sendCommands
(ServerPlayer player) static void
validate()
static <S> void
validateParseResults
(com.mojang.brigadier.ParseResults<S> parseResults)
-
Field Details
-
CURRENT_EXECUTION_CONTEXT
-
LOGGER
private static final org.slf4j.Logger LOGGER -
LEVEL_ALL
public static final int LEVEL_ALL- See Also:
-
LEVEL_MODERATORS
public static final int LEVEL_MODERATORS- See Also:
-
LEVEL_GAMEMASTERS
public static final int LEVEL_GAMEMASTERS- See Also:
-
LEVEL_ADMINS
public static final int LEVEL_ADMINS- See Also:
-
LEVEL_OWNERS
public static final int LEVEL_OWNERS- See Also:
-
dispatcher
-
-
Constructor Details
-
Commands
-
-
Method Details
-
mapSource
public static <S> com.mojang.brigadier.ParseResults<S> mapSource(com.mojang.brigadier.ParseResults<S> parseResults, UnaryOperator<S> mapper) -
performPrefixedCommand
-
performCommand
public void performCommand(com.mojang.brigadier.ParseResults<CommandSourceStack> parseResults, String command) -
finishParsing
@Nullable private static com.mojang.brigadier.context.ContextChain<CommandSourceStack> finishParsing(com.mojang.brigadier.ParseResults<CommandSourceStack> parseResults, String command, CommandSourceStack source) -
executeCommandInContext
public static void executeCommandInContext(CommandSourceStack source, Consumer<ExecutionContext<CommandSourceStack>> contextConsumer) -
sendCommands
-
fillUsableCommands
private void fillUsableCommands(com.mojang.brigadier.tree.CommandNode<CommandSourceStack> rootCommandSource, com.mojang.brigadier.tree.CommandNode<SharedSuggestionProvider> rootSuggestion, CommandSourceStack source, Map<com.mojang.brigadier.tree.CommandNode<CommandSourceStack>, com.mojang.brigadier.tree.CommandNode<SharedSuggestionProvider>> commandNodeToSuggestionNode) -
literal
public static com.mojang.brigadier.builder.LiteralArgumentBuilder<CommandSourceStack> literal(String name) Creates a new argument. Intended to be imported statically. The benefit of this over the brigadierLiteralArgumentBuilder.literal
method is that it is typed toCommandSource
. -
argument
public static <T> com.mojang.brigadier.builder.RequiredArgumentBuilder<CommandSourceStack,T> argument(String name, com.mojang.brigadier.arguments.ArgumentType<T> type) Creates a new argument. Intended to be imported statically. The benefit of this over the brigadierRequiredArgumentBuilder.argument(java.lang.String, com.mojang.brigadier.arguments.ArgumentType<T>)
method is that it is typed toCommandSource
. -
createValidator
-
getDispatcher
-
validateParseResults
public static <S> void validateParseResults(com.mojang.brigadier.ParseResults<S> parseResults) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getParseException
@Nullable public static <S> com.mojang.brigadier.exceptions.CommandSyntaxException getParseException(com.mojang.brigadier.ParseResults<S> result) -
createValidationContext
-
validate
public static void validate()
-