Fixed an issue when unequipping item

This commit is contained in:
Jules 2023-04-22 13:32:52 +02:00
parent 03a49d0589
commit b8200c9f11

View File

@ -117,9 +117,10 @@ public class PlayerListener implements Listener {
@EventHandler
public void onArmorEquip(ArmorEquipEvent event) {
Player player = event.getPlayer();
NBTItem item = NBTItem.get(event.getNewArmorPiece());
if (!PlayerData.get(player).getRPG().canUse(item, true))
if (event.getNewArmorPiece() == null)
return;
if (!PlayerData.get(event.getPlayer()).getRPG().canUse(NBTItem.get(event.getNewArmorPiece()), true))
event.setCancelled(true);
}