Open tyhh00 opened 4 years ago
Is it possible that they are using a different plugin that allows for the application of enchanted books by clicking on armor pieces, and somewhere along the line they either accidentally or intentionally trigger an ArmorEquipEvent when replacing the old (unenchanted) armor with the new (enchanted) armor?
If so, not exactly an issue that should be fixed upstream here.
Well the event does some checks to make sure the item is a valid "ArmorType" and it's possible this somehow returns an incorrect value which could cause what he is describing but the lack of information makes it impossible to test any further.
Only way I see another plugin breaking this is if they modify the current item/cursor or fake an InventoryClickEvent to do some type of update across plugins.
Not sure why it occurs either. I've seen that it does check to make sure it is of correct type but shouldn't the inventory click event check whether the item you click would then be in an armour slot? Because for e.g. like we have trinket shards. These are placed on a skull type item and it still calls the armorequipevent even when I hadn't equip the head and I just clicked the shards onto the head
We patched this issue by adding if(newItem != null && newItem.getType() != Material.AIR && newItem.getType() != Material.SKULL_ITEM && Arrays.asList(Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS).contains(newItem.getType())) {
to our checks.
For e.g., if I click on an enchant book to apply to an armor piece, even though its not being added to any armor slot, it thinks that it is being equipped and processes it as an armor equip event.