Class CommandPerformEvent
java.lang.Object
dev.architectury.event.events.common.CommandPerformEvent
This event is invoked whenever a command is issued.
The
ParseResults
can be modified and even a custom Throwable
can be used to tell the source of failure.
A command fails when any other result than InteractionResult.PASS
is returned.
When PASS is used, the getResults()
is used for execution.
Equivalent to Forge's CommandEvent
event.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCommandPerformEvent
(com.mojang.brigadier.ParseResults<net.minecraft.commands.CommandSourceStack> results, @Nullable Throwable throwable) -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.brigadier.ParseResults<net.minecraft.commands.CommandSourceStack>
@Nullable Throwable
void
setResults
(com.mojang.brigadier.ParseResults<net.minecraft.commands.CommandSourceStack> results) void
setThrowable
(@Nullable Throwable throwable)
-
Field Details
-
EVENT
-
-
Constructor Details
-
CommandPerformEvent
public CommandPerformEvent(com.mojang.brigadier.ParseResults<net.minecraft.commands.CommandSourceStack> results, @Nullable @Nullable Throwable throwable) - Parameters:
results
- The initial used parsed results.throwable
- The initial used throwable.
-
-
Method Details
-
getResults
public com.mojang.brigadier.ParseResults<net.minecraft.commands.CommandSourceStack> getResults()- Returns:
- The parsed results for the issued command.
-
setResults
public void setResults(com.mojang.brigadier.ParseResults<net.minecraft.commands.CommandSourceStack> results) - Parameters:
results
- The new results the command should use.
-
getThrowable
- Returns:
- An throwable to be used as why the command has failed.
-
setThrowable
- Parameters:
throwable
- The throwable used when the command has failed.
-