Class TriggerVolumesPlugin

All Implemented Interfaces:
CommandOwner

public class TriggerVolumesPlugin extends JavaPlugin
  • Constructor Details

    • TriggerVolumesPlugin

      public TriggerVolumesPlugin(@Nonnull JavaPluginInit init)
  • Method Details

    • get

      @Nonnull public static TriggerVolumesPlugin get()
    • registerEffectType

      public <T extends TriggerEffect> void registerEffectType(@Nonnull String typeId, @Nonnull Class<T> clazz, @Nonnull BuilderCodec<T> codec)
      Registers a custom trigger effect type so it can be used in trigger volume JSON and appears in the in-game effect editor UI automatically.

      Call this from your plugin's setup() method. Your plugin must declare "Hytale:TriggerVolumes" as a dependency in its manifest.json to guarantee correct load ordering.

      The codec should chain from TriggerEffect.BASE_CODEC to inherit the standard Event and Interval fields.

      Parameters:
      typeId - unique type identifier used as the "Type" discriminator in JSON
      clazz - the concrete effect class
      codec - a BuilderCodec that can serialize and deserialize the effect
      Throws:
      IllegalArgumentException - if typeId or clazz is null, or if typeId is already registered
    • registerConditionType

      public <T extends TriggerCondition> void registerConditionType(@Nonnull String typeId, @Nonnull Class<T> clazz, @Nonnull BuilderCodec<T> codec)
    • registerRuleType

      public <T extends TriggerRule> void registerRuleType(@Nonnull String typeId, @Nonnull Class<T> clazz, @Nonnull BuilderCodec<T> codec)
      Registers a custom always-active rule type so it can be used in trigger volume JSON and appears in the in-game effect editor's "Always Active" list automatically.

      Rules are pure data: the registering plugin must also register its own enforcement system (typically an event system that queries TriggerVolumeManager.hasActiveRule() and cancels the action).

      The codec should chain from TriggerRule.BASE_CODEC. Provide a server.customUI.triggerVolumeEffectEditor.ruleType.<typeId> lang key for the editor label.

    • registerEventType

      @Nonnull public TriggerEventType registerEventType(@Nonnull String typeId)
      Registers a custom event type so effects and conditions can listen for it and it appears in the in-game effect editor's event dropdown.

      The returned TriggerEventType is interned: hold onto it and pass it to one of the manager's enqueue* methods from the plugin's own system to fire the event. ENTER, TICK and EXIT are driven by the spatial tick loop and cannot be fired this way; custom events behave like the positional and signal events. Provide a server.customUI.triggerVolumeEffectEditor.addEventType.<typeId> lang key for the dropdown label.

      Throws:
      IllegalArgumentException - if typeId is null or already registered
    • registerAssetSource

      public void registerAssetSource(@Nonnull String sourceId, @Nonnull AssetSourceProvider provider)
      Registers an asset source that provides a set of asset IDs for the effect editor's asset picker UI. Multiple effect fields can reference the same source.
      Parameters:
      sourceId - unique identifier for this asset source
      provider - supplies the current set of asset IDs when the picker is opened
    • registerAssetField

      public void registerAssetField(@Nonnull String effectTypeId, @Nonnull String fieldKey, @Nonnull String sourceId)
      Maps a specific field on a registered effect type to an asset source, causing that field to render as an asset picker in the effect editor UI instead of a plain text input.
      Parameters:
      effectTypeId - the effect type ID as registered with registerEffectType(String, Class, BuilderCodec)
      fieldKey - the codec field key (e.g. "Effect", "SoundEvent")
      sourceId - the asset source ID as registered with registerAssetSource(String, AssetSourceProvider)
    • getPastePrefabPreviewState

      @Nullable public TriggerVolumesPlugin.PastePrefabPreviewState getPastePrefabPreviewState(@Nonnull UUID playerUuid)
    • setPastePrefabPreviewState

      public void setPastePrefabPreviewState(@Nonnull UUID playerUuid, @Nonnull TriggerVolumesPlugin.PastePrefabPreviewState state)
    • clearPastePrefabPreviewState

      public void clearPastePrefabPreviewState(@Nonnull UUID playerUuid)
    • getAssetSourceForField

      @Nullable public String getAssetSourceForField(@Nonnull String effectTypeId, @Nonnull String fieldKey)
    • getAssetIds

      @Nonnull public Collection<String> getAssetIds(@Nonnull String sourceId)
    • getManagerResourceType

      @Nonnull public ResourceType<EntityStore, TriggerVolumeManager> getManagerResourceType()
    • getTriggerVolumeComponentType

      @Nonnull public ComponentType<EntityStore, TriggerVolume> getTriggerVolumeComponentType()
    • getTriggerVolumeGroupComponentType

      @Nonnull public ComponentType<EntityStore, TriggerVolumeGroup> getTriggerVolumeGroupComponentType()
    • getIgnoreTriggerVolumesComponentType

      @Nonnull public ComponentType<EntityStore, IgnoreTriggerVolumes> getIgnoreTriggerVolumesComponentType()
    • collectAnimationIdsForApplyOn

      @Nonnull public Collection<String> collectAnimationIdsForApplyOn(@Nonnull String applyOn)
      Animation keys available for the given Apply On target. Player resolves to the player model, Everyone to the keys shared by the player model and every resolvable role model, and a role name to that role's model. Falls back to the global union (collectAnimationIds()) for a blank or otherwise unresolvable target so the picker always has something to show.
    • collectApplyOnIdsForAnimation

      @Nonnull public Collection<String> collectApplyOnIdsForAnimation(@Nonnull String animationKey)
      Apply On targets whose model can play the given animation key, used for the reverse-direction picker (animation chosen first). Targets whose model cannot be resolved are omitted.
    • isLoopingAnimation

      public boolean isLoopingAnimation(@Nonnull String applyOn, @Nonnull String animationKey)
      Whether the given animation key has any looping animation on the Apply On target's model. Only meaningful for a concrete model (Player or a role); blank and Everyone have no single model and return false.