From a0760da81a930b4b87b91b84b8dd315875a8a973 Mon Sep 17 00:00:00 2001 From: TinyTank800 Date: Wed, 5 Apr 2023 18:09:35 -0700 Subject: [PATCH] Fixed item paywall id checks. --- .../commandpanels/commandtags/CommandTags.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java b/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java index 6dab4ab..bfc54bd 100644 --- a/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java +++ b/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java @@ -206,11 +206,11 @@ public class CommandTags { List remCont = new ArrayList<>(); String[] args = command.split("\\s"); try { - short id = 0; + byte id = -1; int customData = 0; for(String val : args) { if(val.startsWith("id:")) { - id = Short.parseShort(val.substring(3)); + id = Byte.parseByte(val.substring(3)); continue; } if(val.startsWith("custom-data:")) { @@ -223,7 +223,7 @@ public class CommandTags { if (Material.matchMaterial(args[1]) == null) { sellItem = plugin.itemCreate.makeCustomItemFromConfig(panel, PanelPosition.Top, panel.getConfig().getConfigurationSection("custom-item." + args[1]), p, true, true, false); } else { - sellItem = new ItemStack(Objects.requireNonNull(Material.matchMaterial(args[1])), Integer.parseInt(args[2]), id); + sellItem = new ItemStack(Objects.requireNonNull(Material.matchMaterial(args[1])), Integer.parseInt(args[2])); } //this is not a boolean because it needs to return an int PaywallOutput removedItem = PaywallOutput.Blocked; @@ -294,6 +294,11 @@ public class CommandTags { } } + //Check if the item matches the id set. If not continue to next in loop. + if(id != -1 && cont.get(f).getDurability() != id){ + continue; + } + //Adding item to the remove list then checking if we have reached the required amount. ItemStack add = new ItemStack(cont.get(f).getType(), cont.get(f).getAmount(), (short) f); remainingAmount -= add.getAmount();