Skip to content

Commit

Permalink
When's the last time I pushed this?... lol
Browse files Browse the repository at this point in the history
  • Loading branch information
ipodtouch0218 committed Dec 29, 2020
1 parent 81b8872 commit f852cb0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/me/ipodtouch0218/iptcore/IPTCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
12 changes: 2 additions & 10 deletions src/me/ipodtouch0218/iptcore/inventory/InventoryListener.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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; }

Expand All @@ -48,20 +46,14 @@ 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) {
UUID playerUUID = e.getPlayer().getUniqueId();
if (!histories.containsKey(playerUUID)) { return; }
Stack<GuiInventory> 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
Expand Down
6 changes: 5 additions & 1 deletion src/me/ipodtouch0218/iptcore/utils/ConfigParserUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

0 comments on commit f852cb0

Please sign in to comment.