Skip to main content

EliteMobs Java API

Generated Java reference includes searchable classes, methods and signatures, with the source version and commit recorded for each module.

This guide covers the EliteMobs 10.9 API. The public Maven version checked for this refresh is com.magmaguy:EliteMobs:10.9.1. Use provided or compileOnly scope and declare depend: [EliteMobs]. Match the dependency to your installed plugin; the current source is 10.9.5. The developer index contains the Maven and Gradle setup.

Entry points

Package or typePurpose
com.magmaguy.elitemobs.apiBukkit events for combat, quests, NPCs, teleports, dungeons and initialization
com.magmaguy.elitemobs.api.instancedInstanced match lifecycle events
com.magmaguy.elitemobs.api.utils.EliteItemManagerElite item identification, level, damage and defense helpers
com.magmaguy.elitemobs.entitytracker.EntityTrackerResolve a Bukkit entity to its tracked EliteMobs entity
com.magmaguy.elitemobs.api.power.EliteLuaPowerServiceRegister and attach Lua powers through the EliteMobs runtime

EliteEntity, CustomBossEntity and RegionalBossEntity represent live plugin-owned actors. They expose more implementation detail than the event contracts. Retain references only for as long as the actor exists, and avoid changing tracker collections directly.

Listen for skill XP awards

This complete plugin class cancels combat skill XP awards for players with your integration's example.blockskillxp permission. Add its fully qualified class name to your own plugin.yml as main.

SkillXpIntegration.java
package example;

import com.magmaguy.elitemobs.api.EliteSkillXpGainEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public final class SkillXpIntegration extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}

@EventHandler(ignoreCancelled = true)
public void onSkillXp(EliteSkillXpGainEvent event) {
if (event.getPlayer().hasPermission("example.blockskillxp")) {
event.setCancelled(true);
}
}
}

EliteSkillXpGainEvent runs synchronously after combat eligibility checks and native/permission multipliers. getOriginalXp() is the amount at event creation; getXp() includes changes made by earlier listeners. setXp(long) rejects negative values. Cancellation or a final amount of zero suppresses the award and its gain feedback.

EliteMobs commits the accepted amount, handles persistence and applies level-up effects. Do not write player XP separately from this listener. Administrative XP writes and class XP use separate paths and do not represent this event's combat skill award.

Other events have their own contracts. In particular, cancelling EliteMobSpawnEvent prevents construction and removes the underlying living entity; it does not leave behind an ordinary mob. EliteMobDeathEvent and EliteMobRemoveEvent describe different lifecycle transitions. Check the event and its dispatching code before treating every removal as a kill or reward.

Resolve a tracked entity

Lookup inside your integration
EliteEntity elite = EntityTracker.getEliteMobEntity(bukkitEntity);
if (elite == null) {
return;
}

Import com.magmaguy.elitemobs.entitytracker.EntityTracker and com.magmaguy.elitemobs.mobconstructor.EliteEntity. The lookup can return null; a Bukkit entity is not necessarily a currently tracked EliteMob. Pass an existing, non-null Bukkit entity and perform the lookup on the server thread.

For equipment, start with EliteItemManager.isEliteMobsItem(itemStack) and the helper for the quantity you actually need, such as getItemLevel, getEliteDefense or getTotalDPS. These quantities are different; an item's level is not its final damage. Check each method's null handling rather than assuming every helper accepts an empty item.

Initialization and reloads

EliteMobs performs asynchronous initialization followed by server-thread initialization. EliteMobsInitializedEvent fires after the successful sequence, including the corresponding reload initialization. Register listeners early enough to observe it. Integrations enabled after that event must also account for the plugin already being initialized.

Entity references, attachments and cached services may become stale during reload. Reacquire what your integration needs when initialization completes. Do not call onEnable, onDisable or MagmaCore shutdown on EliteMobs' behalf.

Lua power integration

Obtain the service through Bukkit after EliteMobs initialization:

Service lookup
EliteLuaPowerService powers = Bukkit.getServicesManager()
.load(EliteLuaPowerService.class);
if (powers == null) {
return;
}

Import org.bukkit.Bukkit and com.magmaguy.elitemobs.api.power.EliteLuaPowerService. Treat an absent service as unavailable, rather than constructing the implementation yourself.

registerLuaPower(owner, key, revision, source) registers a program owned by your plugin. setPowers(owner, eliteEntity, orderedPowerKeys) replaces the actor's complete power collection with fresh runtimes in the supplied order. Every key must belong to that owner, and duplicate keys are rejected. This operation is not an append to the boss's existing powers.

inspectPowers returns the service-managed programs in attachment order. inspectPowerActivity exposes their runtime activity. unregisterOwner(owner) removes the owner's catalog entries and detaches its runtimes from active actors; use it when your integration disables while the service is available.

All mutations run on the server thread. The service deliberately avoids exposing MagmaCore scripting types across plugin classloaders. Pass the EliteMobs API types rather than objects from a privately shaded MagmaCore copy.

For authored Lua hooks and content, see the shared scripting reference. The Java service coordinates attachment and ownership; EliteMobs still owns the power lifecycle.