-
Notifications
You must be signed in to change notification settings - Fork 0
Recommendations
You may often find situations where both ArmorPiece#getPreviousPiece() and ArmorPiece#getPiece() both share the same material type.
When this happens, there are two possibilities:
-
ArmorPiece#getMethod()isMethod#UNCHANGEDThe armour piece was not modified at all. This could happen f. eg. when a player modified another piece. You may filter it this way:
for (ArmorPiece armorPiece : event.getArmorPieces()) { Method method = armorPiece.getMethod(); if (method == Method.UNCHANGED) continue; // The armor piece has suffered from a modification. }
-
ArmorPiece#getMethod()isMethod#DAMAGEDIn this case, the player did not implicitly have his armour modified. Instead, such piece got damaged.
for (ArmorPiece armorPiece : event.getArmorPieces()) { if (armorPiece.hasBeenDamaged()) // The same as (armorpiece.getMethod() == Method.DAMAGED) continue; // The armor piece was not damaged. }
It is up to the developer to determine how these situations should be handled. The library will always provide the complete array of armour pieces a player is wearing. In most cases, only one armour slot gets modified.
This information is compulsory to be borne in mind, as these situations will occasionally happen.