From 09f7756a1c93fa411f3d3aa8d5b89817f9513904 Mon Sep 17 00:00:00 2001 From: Thatsmusic99 Date: Sat, 23 Jan 2021 10:09:56 +0000 Subject: [PATCH] Fixed 1.8.x error --- .../headsplus/listeners/HPMaskEvents.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/thatsmusic99/headsplus/listeners/HPMaskEvents.java b/src/main/java/io/github/thatsmusic99/headsplus/listeners/HPMaskEvents.java index 1e566914..21d60cd6 100644 --- a/src/main/java/io/github/thatsmusic99/headsplus/listeners/HPMaskEvents.java +++ b/src/main/java/io/github/thatsmusic99/headsplus/listeners/HPMaskEvents.java @@ -74,14 +74,17 @@ public void onEvent(PlayerQuitEvent event) { public void onEvent(InventoryClickEvent e) { HeadsPlus hp = HeadsPlus.getInstance(); Player player = (Player) e.getWhoClicked(); - for (int i = 0; i < 46; i++) { - ItemStack item = player.getInventory().getItem(i); - if (item != null) { - if (NBTManager.isIcon(item)) { - player.getInventory().setItem(i, new ItemStack(Material.AIR)); + if (hp.getNMSVersion().getOrder() > NMSIndex.v1_8_R3.getOrder()) { + for (int i = 0; i < 46; i++) { + ItemStack item = player.getInventory().getItem(i); + if (item != null) { + if (NBTManager.isIcon(item)) { + player.getInventory().setItem(i, new ItemStack(Material.AIR)); + } } } } + ItemStack item; boolean shift = e.isShiftClick(); // If we're shift clicking