Skip to content

ArmorChange ​

com.jsmacrosce.jsmacros.client.api.event.impl.player.EventArmorChange

Since1.2.7Not cancellable

Fires when client-tick polling detects a change to one of the local player's four armor slots.
For a damage-only change, EventItemDamage fires first.

js
JsMacros.on("ArmorChange", JavaWrapper.methodToJava(function (event) {
 const now = event.item.isEmpty() ? "empty" : `${event.item.getItemId()} x${event.item.getCount()}`;  
 const before = event.oldItem.isEmpty() ? "empty" : `${event.oldItem.getItemId()} x${event.oldItem.getCount()}`;  
 Chat.log(`Armor ${event.slot}: ${before} to ${now}`);  
}))

Constructors ​

new EventArmorChange ​

new EventArmorChange(String slot, ItemStack item, ItemStack old)#
Stores the supplied slot label and wraps the current and previous raw stacks in helpers. The slot is stored verbatim without validation; either raw stack may be null, and is passed to its helper unchanged.

Parameters:

  • slot: supplied armor-slot label, possibly null
  • item: current raw item stack, possibly null
  • old: previous raw item stack, possibly null

Fields ​

item ​

item: ItemStackHelperread-only#
The item currently in the slot. An empty slot is represented by an empty ItemStackHelper, so check isEmpty() before reading the id or the count.

oldItem ​

oldItem: ItemStackHelperread-only#
The item previously recorded for the slot by polling, represented by an empty ItemStackHelper if the slot was empty.

slot ​

slot: Stringread-only#
The changed armor slot: HEAD, CHEST, LEGS, or FEET.

Methods ​

toString ​

toString(): String#
Returns a diagnostic string containing the event name and slot label; the item values are omitted. The format is %s:{"slot": %s} with standard String.format conversion, so the slot is not quoted or escaped as JSON.
Returns: diagnostic event-name and slot string