English
Event API
EmakiAccessory publishes one Bukkit event in the emaki.jiuwu.craft.accessory.api.event package; its full contract follows
AccessorySetBonusChangeEvent
java
public final class AccessorySetBonusChangeEvent extends EventNot cancellable. By the time it fires the set bonus has already been folded into the attribute and skill contributions; listeners only receive the notification and cancelling changes nothing
| Member | Type | Description |
|---|---|---|
getPlayer() | Player | The player whose accessory set state changed |
getSetId() | String | Accessory set id |
getOldPieceCount() | int | Equipped piece count before the change |
getNewPieceCount() | int | Equipped piece count after the change |
getTotalPieces() | int | Total number of pieces the set declares; 0 when the set definition no longer exists (for example it was just removed from the configuration) |
getActiveThresholds() | List<Integer> | Required-piece numbers of the now-active thresholds; an empty list when the set definition no longer exists |
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 fires only when a set's equipped piece count changes; recomputations that leave the count unchanged produce no event
The baseline used for the comparison is cleared on reload (reconfigure resets the internal count table), so the first report after a reload describes a 0 → n increase for every set whose count is above 0
Threading
Fired on the player's entity-owner thread
Effect of Orphaned Slots
Orphaned accessories never count toward a piece total, so removing a part from parts.yml lowers the count reported here
Note that editing parts.yml requires /eacc reload, and a reload clears the comparison baseline: the next report starts from 0, so the event shows a 0 → n increase rather than the original drop. The only way to see a decrease without a reload is an in-session change such as switching the enabled page or editing the enabled page's accessories
Effect of Multiple Pages
Only the enabled page counts toward piece totals. Switching the enabled page changes counts on both sides, so every set whose count changes fires one event; 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());
}
}