Skip to content
okereke-dev edited this page Jul 17, 2026 · 2 revisions

Developer API

RPGMood fires four Bukkit events under com.okereke.rpgmood.api so other plugins can hook into it without a hard dependency — add softdepend: [RPGMood] to your plugin.yml, listen for the events below, and guard with a try { ... } catch (NoClassDefFoundError e) { ... } (or a Bukkit.getPluginManager().getPlugin("RPGMood") != null check) if you want your plugin to keep working when RPGMood isn't installed.

If you only need a scaled mob's level and don't want any event at all, read it directly off the entity instead — see Compatibility → Reading a mob's level.


PlayerZoneChangeEvent

Fired when a player's zone change is confirmed (after the dwell timer elapses) — not cancellable.

public class PlayerZoneChangeEvent extends PlayerEvent {
    public String getPreviousZone();        // internal zone key, null on first join
    public String getNewZone();              // internal zone key
    public String getPreviousZoneDisplay();   // human-readable name
    public String getNewZoneDisplay();
    public boolean isDynamic();               // true if newZone is a procedurally-generated zone cluster
}

Since v1.10.0, isDynamic() is always true. It predates the removal of the curated zones.yml zone list — every zone is now a zone cluster, so there's no longer a non-dynamic case. Kept for compatibility with existing listeners; safe to ignore in new code.

MobScaleEvent

Fired before a mob's level is applied — Cancellable, and the level itself can be overridden.

public class MobScaleEvent extends EntityEvent implements Cancellable {
    public LivingEntity getEntity();
    public int getLevel();
    public void setLevel(int level);   // override before scaling is applied
    // + isCancelled()/setCancelled() — cancelling skips scaling entirely for this mob
}

PlayerDeathMessageEvent

Fired after RPGMood composes a narrative death message but before it's set as the actual death message — Cancellable, and the message can be replaced.

public class PlayerDeathMessageEvent extends PlayerEvent implements Cancellable {
    public String getMessage();          // the generated message, may contain '&' colour codes
    public void setMessage(String msg);  // replace entirely
    public String getCauseKey();         // e.g. "entity", "fire", "fall", "void"
    public String getBiomeKey();         // normalised biome key, e.g. "plains", "dark_forest"
    public String getKillerKey();        // killer entity type key, or "none"
    // + isCancelled()/setCancelled() — cancelling falls back to a blank vanilla death message
}

PlayerCropHarvestEvent

Fired when a player harvests a farming crop — not cancellable, but the drop list is mutable.

public class PlayerCropHarvestEvent extends PlayerEvent {
    public String getCropType();          // configured crop key, e.g. "carrot", "tomato"
    public CropQuality getQuality();      // BRONZE, SILVER, or GOLD
    public Location getLocation();
    public List<ItemStack> getDrops();    // mutable — add/remove/replace items before they're given
}

Example: a loot plugin scaling drops by mob level

@EventHandler
public void onMobScale(MobScaleEvent event) {
    // Read-only observation — don't call setLevel() unless you actually want to override RPGMood's calculation
    int level = event.getLevel();
    lootTable.setRarityBonus(event.getEntity(), level / 5);
}

Clone this wiki locally