类 CommandEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.CommandEvent
所有已实现的接口:
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.

  • 字段详细资料

    • parse

      private com.mojang.brigadier.ParseResults<CommandSourceStack> parse
    • exception

      @Nullable private @Nullable Throwable exception
  • 构造器详细资料

    • CommandEvent

      public CommandEvent(com.mojang.brigadier.ParseResults<CommandSourceStack> parse)
  • 方法详细资料

    • getParseResults

      public com.mojang.brigadier.ParseResults<CommandSourceStack> getParseResults()
      返回 the parsed command results。
      返回:
      the parsed command results
    • setParseResults

      public void setParseResults(com.mojang.brigadier.ParseResults<CommandSourceStack> parse)
    • getException

      @Nullable public @Nullable Throwable getException()
      返回 an exception to be thrown when performing the command, starts null。
      返回:
      an exception to be thrown when performing the command, starts null
    • setException

      public void setException(@Nullable @Nullable Throwable exception)