FeatureDefinition
Definition
com.deezmods.unifiedui.api.definitions.FeatureDefinition
package com.deezmods.unifiedui.api.definitions;
public class FeatureDefinition {
public final String featureId;
public final String displayName;
public final List<String> worldFilter;
public final List<GameMode> gameModeFilter;
public final List<String> permissionFilters;
public final BuildUserInterfaceCallback buildUserInterface;
public final GetEventDefinitionsCallback getEventDefinitions;
public final HandleEventCallback handleEvent;
}
Summary
Defines how a feature should be displayed and function within Unified UI.
Call Order:
withBuildUserInterface and withGetEventDefinitions will get called when it is time to render the content. withBuildUserInterface will be called first, which can be used to define any indexed arrays used in conjunction with withGetEventDefinitions event selectors.
info
featureId 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 featureBuilder = new FeatureDefinition.Builder("featureId", "displayName");
public Builder(String featureId, String displayName);
public Builder withFeatureId(String featureId);
public Builder withWorldFilter(List<String> worldFilter);
public Builder withGameModeFilter(List<GameMode> gameModeFilter);
public Builder withPermissionFilters(List<String> permissionFilters);
public Builder withBuildUserInterface(FeatureBuildCallback buildUserInterface);
public Builder withGetEventDefinitions(FeatureGetEventsCallback getEventDefinitions);
public Builder withHandleEvent(FeatureHandleEventCallback handleEvent);
public FeatureDefinition build();
var feature = featureBuilder.build();
Fields
| Name | Description |
|---|---|
| featureId | Is a unique id scoped to your module. Repeats can cause unexpected results in rendering and execution. |
| displayName | Name of the feature. This supports i18n translation keys. |
| worldFilter | Only show the feature in the Unified UI when world identified. |
| gameModeFilter | Only show the feature in the Unified UI when in the expected game mode. |
| permissionFilters | Only show the feature in the Unified UI when a player has the expected permission. |
| buildUserInterface | Defines a callback for UnifiedUI to call when it is time to render the content. See BuildUserInterfaceCallback. |
| getEventDefinitions | Defines a callback which instructs UnifiedUI how and what to bind to. See GetEventDefinitionsCallback. |
| handleEvent | Defines a callback to handle events defined in getEventDefinitions.See HandleEventCallback. |