forked from Upstream/CommandPanels
Merge pull request #307 from TinyTank800/master
Fixes to mmo= paywalls, multipaywalls, minor changes to item-paywall=
This commit is contained in:
commit
53dafd8f69
14
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
14
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -33,6 +33,7 @@ body:
|
||||
- 1.17
|
||||
- 1.18
|
||||
- 1.19
|
||||
- 1.20
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
@ -41,6 +42,9 @@ body:
|
||||
label: What CommandPanels version are you using?
|
||||
options:
|
||||
- latest
|
||||
- 3.20.0.3
|
||||
- 3.20.0.2
|
||||
- 3.20.0.1
|
||||
- 3.19.0.3
|
||||
- 3.19.0.2
|
||||
- 3.19.0.1
|
||||
@ -66,16 +70,6 @@ body:
|
||||
- 3.17.4.1
|
||||
- 3.17.4.0
|
||||
- 3.17.3.1
|
||||
- 3.17.3.0
|
||||
- 3.17.2.2
|
||||
- 3.17.2.1
|
||||
- 3.17.2.0
|
||||
- 3.17.1.5
|
||||
- 3.17.1.4
|
||||
- 3.17.1.3
|
||||
- 3.17.1.2
|
||||
- 3.17.1.1
|
||||
- 3.17.1.0
|
||||
- Any other version
|
||||
validations:
|
||||
required: true
|
||||
|
14
.github/ISSUE_TEMPLATE/need-help.yml
vendored
14
.github/ISSUE_TEMPLATE/need-help.yml
vendored
@ -31,6 +31,7 @@ body:
|
||||
- 1.17
|
||||
- 1.18
|
||||
- 1.19
|
||||
- 1.20
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
@ -39,6 +40,9 @@ body:
|
||||
label: What CommandPanels version are you using?
|
||||
options:
|
||||
- latest
|
||||
- 3.20.0.3
|
||||
- 3.20.0.2
|
||||
- 3.20.0.1
|
||||
- 3.19.0.3
|
||||
- 3.19.0.2
|
||||
- 3.19.0.1
|
||||
@ -64,16 +68,6 @@ body:
|
||||
- 3.17.4.1
|
||||
- 3.17.4.0
|
||||
- 3.17.3.1
|
||||
- 3.17.3.0
|
||||
- 3.17.2.2
|
||||
- 3.17.2.1
|
||||
- 3.17.2.0
|
||||
- 3.17.1.5
|
||||
- 3.17.1.4
|
||||
- 3.17.1.3
|
||||
- 3.17.1.2
|
||||
- 3.17.1.1
|
||||
- 3.17.1.0
|
||||
- Any other version
|
||||
validations:
|
||||
required: true
|
||||
|
@ -523,6 +523,14 @@ public class ItemCreation {
|
||||
}
|
||||
}
|
||||
}catch(Exception ignore){}
|
||||
//check for custom model data
|
||||
try {
|
||||
if (one.getItemMeta().getCustomModelData() != (two.getItemMeta().getCustomModelData())) {
|
||||
if(one.getItemMeta().hasCustomModelData()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}catch(Exception ignore){}
|
||||
//check for nbt
|
||||
if(nbtCheck) {
|
||||
try {
|
||||
|
@ -231,7 +231,7 @@ public class CommandTags {
|
||||
}
|
||||
case "item-paywall=": {
|
||||
String command = plugin.tex.placeholders(panel, PanelPosition.Top, p, rawCommand);
|
||||
//if player uses item-paywall= [Material] [Amount] <id:#> WILL NOT TAKE CUSTOM ITEMS
|
||||
//if player uses item-paywall= [Material] [Amount] <id:#> <IGNORENBT> WILL NOT TAKE CUSTOM ITEMS. IGNORENBT lets nbt items through. Useful for spawner edge cases.
|
||||
//player can use item-paywall= [custom-item] [Amount]
|
||||
List<ItemStack> cont = new ArrayList<>(Arrays.asList(plugin.inventorySaver.getNormalInventory(p)));
|
||||
HashMap<Integer, ItemStack> remCont = new HashMap<>();
|
||||
@ -254,6 +254,8 @@ public class CommandTags {
|
||||
}
|
||||
//this is not a boolean because it needs to return an int
|
||||
PaywallOutput removedItem = PaywallOutput.Blocked;
|
||||
//This is here for when people want to take nbt items like spawners with types in a check for spawners.
|
||||
boolean ignoreNBT = command.contains("IGNORENBT");
|
||||
|
||||
int remainingAmount = sellItem.getAmount();
|
||||
//loop through items in the inventory
|
||||
@ -267,17 +269,6 @@ public class CommandTags {
|
||||
ItemStack itm = cont.get(f);
|
||||
|
||||
if (Material.matchMaterial(args[1]) == null) {
|
||||
//item-paywall is a custom item as it is not a material
|
||||
if (plugin.itemCreate.isIdentical(sellItem, itm, Objects.requireNonNull(panel.getConfig().getConfigurationSection("custom-item." + args[1])).contains("nbt"))) {
|
||||
ItemStack add = new ItemStack(p.getInventory().getItem(f).getType(), p.getInventory().getItem(f).getAmount());
|
||||
remainingAmount -= add.getAmount();
|
||||
if (removal) remCont.put(f,add);
|
||||
if (remainingAmount <= 0) {
|
||||
removedItem = PaywallOutput.Passed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if custom item is a mmo item (1.14+ for the API)
|
||||
try {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("MMOItems") && panel.getConfig().getString("custom-item." + args[1] + ".material").startsWith("mmo=")) {
|
||||
@ -294,15 +285,27 @@ public class CommandTags {
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue; //This stops the other custom item section from reading and adding false numbers.
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plugin.debug(ex, p);
|
||||
}
|
||||
|
||||
//item-paywall is a custom item as it is not a material
|
||||
if (plugin.itemCreate.isIdentical(sellItem, itm, Objects.requireNonNull(panel.getConfig().getConfigurationSection("custom-item." + args[1])).contains("nbt"))) {
|
||||
ItemStack add = new ItemStack(p.getInventory().getItem(f).getType(), p.getInventory().getItem(f).getAmount());
|
||||
remainingAmount -= add.getAmount();
|
||||
if (removal) remCont.put(f,add);
|
||||
if (remainingAmount <= 0) {
|
||||
removedItem = PaywallOutput.Passed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
//if the item is a standard material
|
||||
if (itm.getType() == sellItem.getType()) {
|
||||
if(itm.hasItemMeta()){
|
||||
if(itm.hasItemMeta() && !ignoreNBT){
|
||||
//If item has custom meta continue to next item.
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user