This commit is contained in:
rockyhawk64 2022-10-27 09:29:46 +11:00
parent b3662984f9
commit 6ed1b170f6
4 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
version: 3.18.1.4
version: 3.18.2.0
main: me.rockyhawk.commandpanels.CommandPanels
name: CommandPanels
author: RockyHawk

View File

@ -239,7 +239,7 @@ public class CommandTags {
//create the item to be removed
ItemStack sellItem;
if(command.split("\\s").length == 2) {
if(Material.matchMaterial(command.split("\\s")[1]) == null) {
sellItem = plugin.itemCreate.makeCustomItemFromConfig(panel,PanelPosition.Top,panel.getConfig().getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, false);
}else{
sellItem = new ItemStack(Objects.requireNonNull(Material.matchMaterial(command.split("\\s")[1])), Integer.parseInt(command.split("\\s")[2]), id);
@ -255,15 +255,19 @@ public class CommandTags {
continue;
}
if(command.split("\\s").length == 2){
//if item paywall is custom item
if(Material.matchMaterial(command.split("\\s")[1]) == null){
//item-paywall is a custom item as it is not a material
if(plugin.itemCreate.isIdentical(sellItem,cont.get(f))){
if (sellItem.getAmount() <= cont.get(f).getAmount()) {
int sellItemAmount = sellItem.getAmount();
if(command.split("\\s").length == 3){
sellItemAmount = Integer.parseInt(command.split("\\s")[2]);
}
if (sellItemAmount <= cont.get(f).getAmount()) {
if (plugin.inventorySaver.hasNormalInventory(p)) {
p.getInventory().getItem(f).setAmount(cont.get(f).getAmount() - sellItem.getAmount());
p.getInventory().getItem(f).setAmount(cont.get(f).getAmount() - sellItemAmount);
p.updateInventory();
} else {
cont.get(f).setAmount(cont.get(f).getAmount() - sellItem.getAmount());
cont.get(f).setAmount(cont.get(f).getAmount() - sellItemAmount);
plugin.inventorySaver.inventoryConfig.set(p.getUniqueId().toString(), plugin.itemSerializer.itemStackArrayToBase64(cont.toArray(new ItemStack[0])));
}
removedItem = PaywallOutput.Passed;

View File

@ -26,6 +26,11 @@ public class BasicTags implements Listener {
if(e.name.equalsIgnoreCase("cpc") || e.name.equalsIgnoreCase("commandpanelclose")){
e.commandTagUsed();
//return if no panel open
if(!plugin.openPanels.hasPanelOpen(e.p.getName(),PanelPosition.Top)){
return;
}
//unclosable panels are at the Top only
if(plugin.openPanels.getOpenPanel(e.p.getName(),PanelPosition.Top).getConfig().contains("panelType")){
if(plugin.openPanels.getOpenPanel(e.p.getName(),PanelPosition.Top).getConfig().getStringList("panelType").contains("unclosable")){

View File

@ -19,7 +19,7 @@ public class BungeeTags implements Listener {
public void commandTag(CommandTagEvent e){
if(e.name.equalsIgnoreCase("force-server=")){
e.commandTagUsed();
//this contacts bungee and tells it to send the server change command
//this contacts bungee and tells it to send the server change command without checking permissions
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(e.args[0]);
@ -31,7 +31,7 @@ public class BungeeTags implements Listener {
Player player = Bukkit.getPlayerExact(e.p.getName());
assert player != null;
if (player.hasPermission("bungeecord.command.server." + e.args[0].toLowerCase())) {
//this contacts bungee and tells it to send the server change command
//this contacts bungee and tells it to send the server change command whilst checking for permissions
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(e.args[0]);