Reference

API reference

The public Kotlin interfaces exposed to Foundry addons.

On this page

FoundryAPi

Package: me.that1koda.foundry.api. Addons receive this interface in FoundryAddon.onEnable(api).

PropertyTypePurpose
pluginPluginThe Bukkit plugin instance.
abilitiesAbilityRegistryRegister, find, enumerate, and unregister abilities.
abilityServiceAbilityServiceActivate a registered ability by ID and context.
playerAbilitiesPlayerAbilityServiceAssign, retrieve, remove, or clear player action bindings.
itemAbilitiesItemAbilityServiceAssign, retrieve, or remove an ability ID on an item.

FoundryAddon

Package: me.that1koda.foundry.api.addon. Implement id and version, then implement onEnable(api). onDisable() has a default empty implementation; see the addon lifecycle note because the current core does not invoke it on shutdown.

Ability and AbilityContext

MemberSignature / defaultBehavior
idval id: StringAbility identifier. Registration rejects blank and duplicate IDs.
cooldownSecondsval cooldownSeconds: Long = 0LCooldown duration. Positive values are applied after a successful activation.
actionsval actions: Set<Action> = emptySet()Declared property; currently not consulted by the activation listener.
activatefun activate(context: AbilityContext)Runs the ability implementation.
AbilityContext.playerPlayerPlayer passed to the activation.
AbilityContext.idStringID supplied to AbilityService.activate().

Registry and services

InterfaceMethods
AbilityRegistryregister(base), unregister(id): Boolean, get(id): Ability?, getAll(): Collection<Ability>, isRegistered(id): Boolean
AbilityServiceactivate(id, context): Boolean
PlayerAbilityServiceassign(player, action, abilityId), remove(player, action), get(player, action): String?, clear(player)
ItemAbilityServiceassign(item, abilityId), remove(item), get(item): String?

Action enum

Package: me.that1koda.foundry.api.activation. Action contains LEFT_CLICK, RIGHT_CLICK, SHIFT_LEFT_CLICK, SHIFT_RIGHT_CLICK, OFFHAND_LEFT_CLICK, OFFHAND_RIGHT_CLICK, OFFHAND_SHIFT_LEFT_CLICK, and OFFHAND_SHIFT_RIGHT_CLICK.