CommandDefinition
Definition
com.deezmods.unifiedui.api.definitions.CommandDefinition
package com.deezmods.unifiedui.api.definitions;
public class CommandDefinition {
public final String commandId;
public final String displayName;
public final String description;
public final CommandSortingGroup sortingGroup;
public final @Nullable String rawCommand;
public final boolean closePageOnRun;
public final List<String> worldFilter;
public final List<GameMode> gameModeFilter;
public final List<String> permissionFilters;
public final List<CommandArgumentDefinition> commandArgs;
public final @Nullable CommandHandleEventCallback handleEvent;
}
Summary
Defines how a command should be displayed and function within Unified UI.
info
CommandId only needs to be unique to your own extension.
When being processed with UnifiedUI, your manifest.json will use Group and Name fields to prefix the ID.
Builder
var commandBuilder = new CommandDefinition.Builder("commandId", "commandName", "commandDescription");
public Builder(String commandId, String displayName, String description);
public Builder withCommandId(String commandId);
public Builder withClosePageOnRun(Boolean closePageOnRun);
public Builder withSortingGroup(CommandSortingGroup sortingGroup);
public Builder withWorldFilters(List<String> worldFilters);
public Builder withGameModeFilters(List<GameMode> gameModeFilters);
public Builder withPermissionFilters(List<String> permissionFilters);
public Builder withCommandArgs(List<CommandArgumentDefinition> commandArgs);
public Builder withRawCommand(String rawCommand);
public Builder withEventCallback(CommandHandleEventCallback handleEvent);
public CommandDefinition build();
var command = commandBuilder.build();
Fields
| Name | Description |
|---|---|
| commandId | Is a unique id scoped to your module. Repeats can cause unexpected results in rendering and execution |
| displayName | Name of the command. This supports i18n translation keys |
| description | Short description of the command. This supports i18n translation keys |
| sortingGroup | The sorting group for the command, used when rendering the command list. See CommandSortingGroup. |
| rawCommand | The command as you would enter into the console. This supports wild-cards similarly displayed in the /help page. |
| worldFilter | Only show the command in the Unified UI when world identified. |
| gameModeFilter | Only show the command in the Unified UI when in the expected game mode. |
| permissionFilters | Only show the command in the Unified UI when a player has the expected permission. |
| commandArgs | Defines rendering properties to match onto rawCommand wild-cards. See CommandArgumentDefinition. |
| handleEvent() | Defines the callback used instead of using the rawCommand property. See CommandHandleEventCallback |