forked from Upstream/CommandPanels
Fixed item paywall id checks.
This commit is contained in:
parent
5f30c6edcb
commit
a0760da81a
@ -206,11 +206,11 @@ public class CommandTags {
|
|||||||
List<ItemStack> remCont = new ArrayList<>();
|
List<ItemStack> remCont = new ArrayList<>();
|
||||||
String[] args = command.split("\\s");
|
String[] args = command.split("\\s");
|
||||||
try {
|
try {
|
||||||
short id = 0;
|
byte id = -1;
|
||||||
int customData = 0;
|
int customData = 0;
|
||||||
for(String val : args) {
|
for(String val : args) {
|
||||||
if(val.startsWith("id:")) {
|
if(val.startsWith("id:")) {
|
||||||
id = Short.parseShort(val.substring(3));
|
id = Byte.parseByte(val.substring(3));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(val.startsWith("custom-data:")) {
|
if(val.startsWith("custom-data:")) {
|
||||||
@ -223,7 +223,7 @@ public class CommandTags {
|
|||||||
if (Material.matchMaterial(args[1]) == null) {
|
if (Material.matchMaterial(args[1]) == null) {
|
||||||
sellItem = plugin.itemCreate.makeCustomItemFromConfig(panel, PanelPosition.Top, panel.getConfig().getConfigurationSection("custom-item." + args[1]), p, true, true, false);
|
sellItem = plugin.itemCreate.makeCustomItemFromConfig(panel, PanelPosition.Top, panel.getConfig().getConfigurationSection("custom-item." + args[1]), p, true, true, false);
|
||||||
} else {
|
} 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
|
//this is not a boolean because it needs to return an int
|
||||||
PaywallOutput removedItem = PaywallOutput.Blocked;
|
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.
|
//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);
|
ItemStack add = new ItemStack(cont.get(f).getType(), cont.get(f).getAmount(), (short) f);
|
||||||
remainingAmount -= add.getAmount();
|
remainingAmount -= add.getAmount();
|
||||||
|
Loading…
Reference in New Issue
Block a user