This commit is contained in:
rockyhawk64 2023-03-05 10:36:06 +11:00
parent 24e1b3b6e4
commit d74d0b7051
4 changed files with 11 additions and 5 deletions

View File

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

View File

@ -46,7 +46,7 @@ public class Commandpanel implements CommandExecutor {
//below will start the command, once it got the right file and panel //below will start the command, once it got the right file and panel
if (cmd.getName().equalsIgnoreCase("cp") || cmd.getName().equalsIgnoreCase("commandpanel") || cmd.getName().equalsIgnoreCase("cpanel")) { if (cmd.getName().equalsIgnoreCase("cp") || cmd.getName().equalsIgnoreCase("commandpanel") || cmd.getName().equalsIgnoreCase("cpanel")) {
if(!(sender instanceof Player)) { if(!(sender instanceof Player)) {
//do console command command //do console command
if(args.length == 2){ if(args.length == 2){
if(!args[1].equals("item")){ if(!args[1].equals("item")){
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panel.copy(), PanelPosition.Top, true); plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panel.copy(), PanelPosition.Top, true);

View File

@ -275,7 +275,7 @@ public class CommandTags {
} }
} }
//if custom item is an mmo item (1.14+ for the API) //if custom item is a mmo item (1.14+ for the API)
try { try {
if (plugin.getServer().getPluginManager().isPluginEnabled("MMOItems") && panel.getConfig().getString("custom-item." + command.split("\\s")[1] + ".material").startsWith("mmo=")) { if (plugin.getServer().getPluginManager().isPluginEnabled("MMOItems") && panel.getConfig().getString("custom-item." + command.split("\\s")[1] + ".material").startsWith("mmo=")) {
String customItemMaterial = panel.getConfig().getString("custom-item." + command.split("\\s")[1] + ".material"); String customItemMaterial = panel.getConfig().getString("custom-item." + command.split("\\s")[1] + ".material");
@ -319,11 +319,13 @@ public class CommandTags {
//send message and return //send message and return
if(removedItem == PaywallOutput.Blocked){ if(removedItem == PaywallOutput.Blocked){
if(plugin.config.getBoolean("purchase.item.enable")){ if(plugin.config.getBoolean("purchase.item.enable")){
plugin.tex.sendString(panel, PanelPosition.Top, p, Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%", command.split("\\s")[1])); //no item was found
plugin.tex.sendString(panel, PanelPosition.Top, p, Objects.requireNonNull(plugin.config.getString("purchase.item.failure")).replaceAll("%cp-args%", command.split("\\s")[1]));
} }
}else{ }else{
if(plugin.config.getBoolean("purchase.item.enable")){ if(plugin.config.getBoolean("purchase.item.enable")){
plugin.tex.sendString(panel, PanelPosition.Top, p, Objects.requireNonNull(plugin.config.getString("purchase.item.failure")).replaceAll("%cp-args%", command.split("\\s")[1])); //item was removed
plugin.tex.sendString(panel, PanelPosition.Top, p, Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%", command.split("\\s")[1]));
} }
} }
return removedItem; return removedItem;

View File

@ -254,6 +254,10 @@ public class CPEventHandler implements Listener {
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
return; return;
case "panelname": case "panelname":
if(panel.getName().equals(playerInput.split("\\s")[0])) {
e.getPlayer().sendMessage(ChatColor.RED + "Changed name is not different!");
return;
}
YamlConfiguration newConfig = YamlConfiguration.loadConfiguration(panel.getFile()); YamlConfiguration newConfig = YamlConfiguration.loadConfiguration(panel.getFile());
newConfig.set("panels." + playerInput.split("\\s")[0], panel.getConfig()); newConfig.set("panels." + playerInput.split("\\s")[0], panel.getConfig());
newConfig.set("panels." + panel.getName(), null); newConfig.set("panels." + panel.getName(), null);