Class CommandContext

java.lang.Object
net.minestom.server.command.builder.CommandContext

public class CommandContext extends Object
Class used to retrieve argument data in a CommandExecutor.

All id are the one specified in the Argument constructor.

All methods are @NotNull in the sense that you should not have to verify their validity since if the syntax is called, it means that all of its arguments are correct. Be aware that trying to retrieve an argument not present in the syntax will result in a NullPointerException.

  • Field Details

  • Constructor Details

    • CommandContext

      public CommandContext(@NotNull @NotNull String input)
  • Method Details

    • getInput

      @NotNull public @NotNull String getInput()
    • getCommandName

      @NotNull public @NotNull String getCommandName()
    • get

      public <T> T get(@NotNull @NotNull Argument<T> argument)
    • get

      public <T> T get(@NotNull @NotNull String identifier)
    • getOrDefault

      public <T> T getOrDefault(@NotNull @NotNull Argument<T> argument, T defaultValue)
    • getOrDefault

      public <T> T getOrDefault(@NotNull @NotNull String identifier, T defaultValue)
    • has

      public boolean has(@NotNull @NotNull Argument<?> argument)
    • has

      public boolean has(@NotNull @NotNull String identifier)
    • getReturnData

      @Nullable public @Nullable CommandData getReturnData()
    • setReturnData

      public void setReturnData(@Nullable @Nullable CommandData returnData)
    • getMap

      @NotNull public @NotNull Map<String,Object> getMap()
    • copy

      public void copy(@NotNull @NotNull CommandContext context)
    • getRaw

      public String getRaw(@NotNull @NotNull Argument<?> argument)
    • getRaw

      public String getRaw(@NotNull @NotNull String identifier)
    • setArg

      public void setArg(@NotNull @NotNull String id, Object value, String rawInput)
    • clear

      protected void clear()
    • retrieveDefaultValues

      protected void retrieveDefaultValues(@Nullable @Nullable Map<String,Supplier<Object>> defaultValuesMap)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object