forked from Upstream/CommandPanels
3.15.5.5
This commit is contained in:
parent
9d6a15bd87
commit
52600fe347
@ -1,4 +1,4 @@
|
|||||||
version: 3.15.5.4
|
version: 3.15.5.5
|
||||||
main: me.rockyhawk.commandpanels.CommandPanels
|
main: me.rockyhawk.commandpanels.CommandPanels
|
||||||
name: CommandPanels
|
name: CommandPanels
|
||||||
author: RockyHawk
|
author: RockyHawk
|
||||||
|
@ -112,7 +112,6 @@ public class SellItemTags implements Listener {
|
|||||||
int amt = itm.getAmount() - new ItemStack(Objects.requireNonNull(Material.matchMaterial(args[1])), Integer.parseInt(args[2])).getAmount();
|
int amt = itm.getAmount() - new ItemStack(Objects.requireNonNull(Material.matchMaterial(args[1])), Integer.parseInt(args[2])).getAmount();
|
||||||
itm.setAmount(amt);
|
itm.setAmount(amt);
|
||||||
p.getInventory().setItem(f, amt > 0 ? itm : null);
|
p.getInventory().setItem(f, amt > 0 ? itm : null);
|
||||||
plugin.econ.depositPlayer(p, Double.parseDouble(args[0]));
|
|
||||||
p.updateInventory();
|
p.updateInventory();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,22 @@ public class OpenGUI {
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
ItemStack empty;
|
ItemStack empty;
|
||||||
try {
|
try {
|
||||||
|
//emptyID for older versions of minecraft (might be deprecated later on)
|
||||||
short id = 0;
|
short id = 0;
|
||||||
if(pconfig.contains("emptyID")){
|
if(pconfig.contains("emptyID")){
|
||||||
id = Short.parseShort(pconfig.getString("emptyID"));
|
id = Short.parseShort(pconfig.getString("emptyID"));
|
||||||
}
|
}
|
||||||
empty = new ItemStack(Objects.requireNonNull(Material.matchMaterial(Objects.requireNonNull(pconfig.getString("empty")).toUpperCase())), 1,id);
|
//either use custom item or just material type
|
||||||
empty = NBTEditor.set(empty,"CommandPanels","CommandPanels");
|
if(pconfig.contains("custom-item." + pconfig.getString("empty"))){
|
||||||
|
empty = plugin.itemCreate.makeItemFromConfig(panel,pconfig.getConfigurationSection("custom-item." + pconfig.getString("empty")),p,true,true,true);
|
||||||
|
}else{
|
||||||
|
empty = new ItemStack(Objects.requireNonNull(Material.matchMaterial(pconfig.getString("empty").toUpperCase())), 1,id);
|
||||||
|
empty = NBTEditor.set(empty,"CommandPanels","CommandPanels");
|
||||||
|
ItemMeta renamedMeta = empty.getItemMeta();
|
||||||
|
assert renamedMeta != null;
|
||||||
|
renamedMeta.setDisplayName(" ");
|
||||||
|
empty.setItemMeta(renamedMeta);
|
||||||
|
}
|
||||||
if (empty.getType() == Material.AIR) {
|
if (empty.getType() == Material.AIR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -144,11 +154,6 @@ public class OpenGUI {
|
|||||||
plugin.openPanels.closePanelForLoader(p.getName());
|
plugin.openPanels.closePanelForLoader(p.getName());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemMeta renamedMeta = empty.getItemMeta();
|
|
||||||
assert renamedMeta != null;
|
|
||||||
renamedMeta.setDisplayName(" ");
|
|
||||||
empty.setItemMeta(renamedMeta);
|
|
||||||
if (onOpen != 3) {
|
if (onOpen != 3) {
|
||||||
//only place empty items if not editing
|
//only place empty items if not editing
|
||||||
if(i.getItem(c) == null && !pconfig.contains("item." + c)) {
|
if(i.getItem(c) == null && !pconfig.contains("item." + c)) {
|
||||||
@ -158,12 +163,15 @@ public class OpenGUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (onOpen == 1 || onOpen == 3) {
|
if (onOpen == 1) {
|
||||||
//onOpen 1 is default and 3 is for the editor
|
//onOpen 1 is default
|
||||||
plugin.openPanels.skipPanelClose.add(p.getName());
|
plugin.openPanels.skipPanelClose.add(p.getName());
|
||||||
plugin.openPanels.openPanelForLoader(p.getName(),panel);
|
plugin.openPanels.openPanelForLoader(p.getName(),panel);
|
||||||
p.openInventory(i);
|
p.openInventory(i);
|
||||||
plugin.openPanels.skipPanelClose.remove(p.getName());
|
plugin.openPanels.skipPanelClose.remove(p.getName());
|
||||||
|
} else if (onOpen == 3) {
|
||||||
|
//onOpen 3 will open the editor panel
|
||||||
|
p.openInventory(i);
|
||||||
} else if (onOpen == 0) {
|
} else if (onOpen == 0) {
|
||||||
//onOpen 0 will just refresh the panel
|
//onOpen 0 will just refresh the panel
|
||||||
plugin.legacy.setStorageContents(p,plugin.legacy.getStorageContents(i));
|
plugin.legacy.setStorageContents(p,plugin.legacy.getStorageContents(i));
|
||||||
|
Loading…
Reference in New Issue
Block a user