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
| Name | Description |
|---|---|
| argName | Is used to match a wildcard in raw command, or passed back as an keyValue in a callback. See CommandDefinition[rawCommand and handleEvent]. |
| displayName | Name of the argument to display near input. This supports i18n translation keys. |
| isRequired | If 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. |
| inputType | What input type should be rendered. Example CommandArgInputType.Player which will show a player dropdown. Default is CommandArgInputType.Text to show a text field. |
| defaultValue | Automatically populate an arg input with a default value. |
| defaultOptions | When using the CommandArgInputType.Dropdown option, then the fields returned here will be displayed. |