Skip to content

Event API

EmakiAccessory publishes one Bukkit event in the emaki.jiuwu.craft.accessory.api.event package.

AccessorySetBonusChangeEvent

java
public final class AccessorySetBonusChangeEvent extends Event

Not cancellable. By the time it fires the set bonus has already been folded into the attribute and skill contributions, so the event is purely informational.

MemberTypeDescription
getPlayer()PlayerThe player whose accessory set state changed.
getSetId()StringAccessory set id.
getOldPieceCount()intEquipped piece count before the change.
getNewPieceCount()intEquipped piece count after the change.
getTotalPieces()intTotal number of pieces the set declares.
getActiveThresholds()List<Integer>Required-piece numbers of the now-active thresholds.

getActiveThresholds() returns an immutable list. Because thresholds are cumulative, wearing 3 pieces yields a list containing both 2 and 3.

Edge Triggered

The accessory contribution snapshot is recomputed on every GUI change, data load and reload, but this event only fires when a set's equipped piece count actually changes. Recomputations that leave the count unchanged produce no event.

Threading

Fired on the player's entity-owner thread.

Effect of Orphaned Slots

Orphaned accessories never count toward a piece total. Removing a part from parts.yml therefore lowers the count reported here and fires an event describing the decrease.

Effect of Multiple Pages

Only the enabled page counts toward piece totals. Switching the enabled page changes counts on both sides, so several set events may fire in sequence; when a player loses the enabled page's permission, that page contributes zero and a decrease fires the same way.

The event itself carries no page information. Query EmakiAccessoryApi.catalog().enabledPage(playerId) when you need to know which page is active.

Relationship to EmakiItem Equipment Sets

Accessory sets only count items inside accessory slots and never mix with EmakiItem equipment sets. When one item belongs to a set on both sides, each side counts independently and fires its own event.

Example

java
@EventHandler
public void onSetChange(AccessorySetBonusChangeEvent event) {
    if (event.getNewPieceCount() == event.getTotalPieces()) {
        event.getPlayer().sendMessage("Accessory set complete: " + event.getSetId());
    }
}