Package net.neoforged.neoforge.event
Class CommandEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.CommandEvent
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
public class CommandEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.bus.api.ICancellableEvent
CommandEvent is fired after a command is parsed, but before it is executed.
This event is fired during the invocation of
Commands.performCommand(ParseResults, String)
.
This event is cancellable, and does not have a result. If the event is cancelled, the command will not be executed.
This event is fired on the main Forge event bus, only on the logical server.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.bus.api.Event
net.neoforged.bus.api.Event.HasResult, net.neoforged.bus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprivate @Nullable Throwable
private com.mojang.brigadier.ParseResults<CommandSourceStack>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable Throwable
Returns an exception to be thrown when performing the command, starts null.com.mojang.brigadier.ParseResults<CommandSourceStack>
Returns the parsed command results.void
setException
(@Nullable Throwable exception) void
setParseResults
(com.mojang.brigadier.ParseResults<CommandSourceStack> parse) Methods inherited from class net.neoforged.bus.api.Event
getResult, hasResult, setResult
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
parse
-
exception
-
-
Constructor Details
-
CommandEvent
-
-
Method Details
-
getParseResults
Returns the parsed command results.- Returns:
- the parsed command results
-
setParseResults
-
getException
Returns an exception to be thrown when performing the command, starts null.- Returns:
- an exception to be thrown when performing the command, starts null
-
setException
-