Skip to main content

CommandArgumentDefinition

Definition

com.deezmods.unifiedui.api.definitions.CommandArgumentDefinition
package com.deezmods.unifiedui.api.definitions;

public class CommandArgumentDefinition {
public final String argName;
public final String displayName;
public final Boolean isRequired;
public final CommandArgInputType inputType;
public final String defaultValue;
public final Map<String, String> defaultOptions;
}

Summary

Defines how a dynamic argument should be displayed and function for a CommandDefinition. To avoid issues, argName should always be unique to the CommandDefinition. Both argName and displayName fields support i18n translation keys.

Example argName

<playerName> or filter=<someFilter>

Builder

var argumentBuilder = new CommandArgumentDefinition.Builder("argName", "displayName");

public Builder(String argName, String displayName);

public Builder withArgName(String argName);

public Builder withDisplayName(String displayName);

public Builder withIsRequired(Boolean isRequired);

public Builder withCommandArgInputType(CommandArgInputType inputType);

public Builder withDefaultValue(String defaultValue);

public Builder withDefaultOptions(Map<String, String> defaultOptions);

public CommandArgumentDefinition build();

var argument = argumentBuilder.build();

Fields

NameDescription
argNameIs used to match a wildcard in raw command, or passed back as an keyValue in a callback. See CommandDefinition[rawCommand and handleEvent].
displayNameName of the argument to display near input. This supports i18n translation keys.
isRequiredIf the field is required to run the command. If false and rawCommand is used, the wildcard substring will be removed from the command when value is not provided.
inputTypeWhat input type should be rendered. Example CommandArgInputType.Player which will show a player dropdown. Default is CommandArgInputType.Text to show a text field.
defaultValueAutomatically populate an arg input with a default value.
defaultOptionsWhen using the CommandArgInputType.Dropdown option, then the fields returned here will be displayed.