From f852cb0f0e9c40d38ce2c86b49d3d263d1de924e Mon Sep 17 00:00:00 2001 From: ipodtouch0218 Date: Tue, 29 Dec 2020 14:13:02 -0500 Subject: [PATCH] When's the last time I pushed this?... lol --- src/me/ipodtouch0218/iptcore/IPTCore.java | 4 +++- .../iptcore/inventory/InventoryListener.java | 12 ++---------- .../iptcore/utils/ConfigParserUtils.java | 6 +++++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/me/ipodtouch0218/iptcore/IPTCore.java b/src/me/ipodtouch0218/iptcore/IPTCore.java index e75964b..0b37fcc 100644 --- a/src/me/ipodtouch0218/iptcore/IPTCore.java +++ b/src/me/ipodtouch0218/iptcore/IPTCore.java @@ -22,7 +22,9 @@ public IPTCore() { //---STATIC METHODS---// public static void initialize(JavaPlugin pluginn) { - if (instance != null) { return; } + if (instance != null) { + onDisable(); + } plugin = pluginn; instance = new IPTCore(); } diff --git a/src/me/ipodtouch0218/iptcore/inventory/InventoryListener.java b/src/me/ipodtouch0218/iptcore/inventory/InventoryListener.java index 3764c34..916d572 100644 --- a/src/me/ipodtouch0218/iptcore/inventory/InventoryListener.java +++ b/src/me/ipodtouch0218/iptcore/inventory/InventoryListener.java @@ -1,6 +1,5 @@ package me.ipodtouch0218.iptcore.inventory; -import java.util.Arrays; import java.util.HashMap; import java.util.Map.Entry; import java.util.Stack; @@ -32,8 +31,7 @@ public void onInventoryClick(InventoryClickEvent e) { GuiInventory currentInv = history.peek(); Inventory topInv = e.getView().getTopInventory(); - boolean equals = Arrays.equals(currentInv.getInventory().getContents(), - topInv.getContents()); + boolean equals = topInv.equals(currentInv.getInventory()); if (!equals) { return; } @@ -48,11 +46,6 @@ public void onInventoryClick(InventoryClickEvent e) { } } - @EventHandler - public void onInventoryClose(InventoryCloseEvent e) { - UUID playerUUID = e.getPlayer().getUniqueId(); - histories.remove(playerUUID); - } @EventHandler public void onInventoryOpen(InventoryOpenEvent e) { @@ -60,8 +53,7 @@ public void onInventoryOpen(InventoryOpenEvent e) { if (!histories.containsKey(playerUUID)) { return; } Stack history = histories.get(playerUUID); - boolean equals = Arrays.equals(history.peek().getInventory().getContents(), - e.getInventory().getContents()); + boolean equals = e.getInventory().equals(history.peek().getInventory()); if (!equals) { //different inventory opened than expected one, remove history diff --git a/src/me/ipodtouch0218/iptcore/utils/ConfigParserUtils.java b/src/me/ipodtouch0218/iptcore/utils/ConfigParserUtils.java index 75d657e..8896872 100644 --- a/src/me/ipodtouch0218/iptcore/utils/ConfigParserUtils.java +++ b/src/me/ipodtouch0218/iptcore/utils/ConfigParserUtils.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Map; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.enchantments.Enchantment; @@ -169,4 +168,9 @@ public static ItemStack parseItem(ConfigurationSection section) { return builder.build(); } + + @Deprecated + public static ItemStack parseItem_v1_8(ConfigurationSection section) { + return parseItem(section); + } }