For the complete documentation index, see llms.txt. This page is also available as Markdown.

💻Developer API

EnchantedMobs 2.0.0 exposes registries for custom abilities, conditions, modifiers, and triggers. Register extensions after EnchantedMobs has enabled.

Maven dependency

<repositories>
    <repository>
        <id>repo-lanink-cn</id>
        <url>https://repo.lanink.cn/repository/maven-public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>cn.superiormc.enchantedmobs</groupId>
        <artifactId>plugin</artifactId>
        <version>2.0.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Add a hard dependency when your plugin requires the API:

depend:
  - EnchantedMobs

Registry keys

Ability, condition, and modifier keys are normalized by:

  • converting to lowercase;

  • replacing - with _.

My-Ability and my_ability therefore refer to the same key. Registering a duplicate normalized key throws IllegalArgumentException; built-ins are not silently replaced.

Custom ability

Register a factory during onEnable:

Returning true requests cancellation of a cancellable trigger event. Most effect abilities return false.

The base class applies common typed conditions, random, cooldown, times, dynamic values, entity selectors, and location offsets.

Custom condition

The base implementation applies the common not: true inversion after onMatch returns.

Custom modifier

The modifier base class evaluates typed conditions, random, and per-path cooldown before onApply.

Manual trigger

A manual trigger lets another plugin expose a custom power section without adapting a Bukkit event.

The power section key is the trigger's namespaced key. For a plugin named MyPlugin:

TriggerData.builder(owner) requires an owner. Source, skill, target, block, location, Bukkit event, tick number, and typed extra context values are optional.

TriggerManager.fire evaluates the owner's assigned powers, applies their final result, and returns a TriggerResult containing execution and cancellation state.

Custom event-backed trigger

Advanced integrations may extend AbstractTrigger<E>, provide a unique NamespacedKey and configuration key, declare supported TriggerEventType values, and register it with:

The trigger manager dispatches registered triggers for their event types. Call unregisterAll(plugin) during disable to remove every trigger owned by that plugin.

Lifecycle cleanup

Custom ability, modifier, and condition implementations may override:

These hooks are intended for type-wide runtime cleanup during EnchantedMobs reload/unload and tracked entity removal. Do not make cleanup depend on one particular YAML section instance.

Compatibility guidance

  • Use scheduler-safe entity operations when supporting Folia.

  • Store UUIDs instead of retaining unloaded entity objects.

  • Validate that required context entities and result values exist for the trigger.

  • Keep published type IDs stable because user YAML depends on them.

  • Re-test integrations when the EnchantedMobs API version changes across a major release.

Last updated