From b8200c9f118425e4aeac278a59172db03c21c7e0 Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 22 Apr 2023 13:32:52 +0200 Subject: [PATCH] Fixed an issue when unequipping item --- .../java/net/Indyuce/mmoitems/listener/PlayerListener.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/PlayerListener.java b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/PlayerListener.java index 1c3ea2a7..df39056a 100644 --- a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/PlayerListener.java +++ b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/PlayerListener.java @@ -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); }