v3.14.0.1

This commit is contained in:
rockyhawk64 2020-11-27 17:38:12 +11:00
parent 6226c146f8
commit 689a8cb0a6
20 changed files with 244 additions and 266 deletions

View File

@ -11,9 +11,9 @@
<orderEntry type="library" name="HeadDatabaseAPI" level="project" /> <orderEntry type="library" name="HeadDatabaseAPI" level="project" />
<orderEntry type="library" name="TokenManager-3.2.4" level="project" /> <orderEntry type="library" name="TokenManager-3.2.4" level="project" />
<orderEntry type="library" name="Vault" level="project" /> <orderEntry type="library" name="Vault" level="project" />
<orderEntry type="library" name="VotingPlugin" level="project" />
<orderEntry type="library" name="spigot-1.16.1" level="project" /> <orderEntry type="library" name="spigot-1.16.1" level="project" />
<orderEntry type="library" name="spigot-1.13.2" level="project" /> <orderEntry type="library" name="spigot-1.13.2" level="project" />
<orderEntry type="library" name="PlaceholderAPI-2.10.8" level="project" /> <orderEntry type="library" name="PlaceholderAPI-2.10.8" level="project" />
<orderEntry type="library" name="VotingPlugin" level="project" />
</component> </component>
</module> </module>

View File

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

View File

@ -1,7 +1,5 @@
package me.rockyhawk.commandpanels; package me.rockyhawk.commandpanels;
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
import java.io.*; import java.io.*;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
@ -9,6 +7,7 @@ import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.bencodez.votingplugin.user.UserManager;
import me.clip.placeholderapi.PlaceholderAPI; import me.clip.placeholderapi.PlaceholderAPI;
import me.realized.tokenmanager.api.TokenManager; import me.realized.tokenmanager.api.TokenManager;
import me.rockyhawk.commandpanels.classresources.*; import me.rockyhawk.commandpanels.classresources.*;
@ -55,10 +54,12 @@ import org.bukkit.plugin.java.JavaPlugin;
public class CommandPanels extends JavaPlugin { public class CommandPanels extends JavaPlugin {
public YamlConfiguration config; public YamlConfiguration config;
public Economy econ = null; public Economy econ = null;
public boolean update = false;
public boolean debug = false; public boolean debug = false;
public boolean openWithItem = false; //this will be true if there is a panel with open-with-item public boolean openWithItem = false; //this will be true if there is a panel with open-with-item
//initialise the tag
public String tag = "[CommandPanels]";
public List<Player> generateMode = new ArrayList<>(); //players that are currently in generate mode public List<Player> generateMode = new ArrayList<>(); //players that are currently in generate mode
public List<String[]> userInputStrings = new ArrayList<>(); public List<String[]> userInputStrings = new ArrayList<>();
public List<String[]> editorInputStrings = new ArrayList<>(); public List<String[]> editorInputStrings = new ArrayList<>();
@ -189,6 +190,9 @@ public class CommandPanels extends JavaPlugin {
//load panelFiles //load panelFiles
reloadPanelFiles(); reloadPanelFiles();
//get tag
tag = papi(config.getString("config.format.tag") + " ");
Bukkit.getLogger().info("[CommandPanels] RockyHawk's CommandPanels v" + this.getDescription().getVersion() + " Plugin Loaded!"); Bukkit.getLogger().info("[CommandPanels] RockyHawk's CommandPanels v" + this.getDescription().getVersion() + " Plugin Loaded!");
} }
@ -340,7 +344,6 @@ public class CommandPanels extends JavaPlugin {
} }
public String setCpPlaceholders(Player p, String str) { public String setCpPlaceholders(Player p, String str) {
String tag = config.getString("config.format.tag") + " ";
//replace nodes with PlaceHolders //replace nodes with PlaceHolders
str = str.replaceAll("%cp-player-displayname%", p.getDisplayName()); str = str.replaceAll("%cp-player-displayname%", p.getDisplayName());
str = str.replaceAll("%cp-player-name%", p.getName()); str = str.replaceAll("%cp-player-name%", p.getName());
@ -493,7 +496,6 @@ public class CommandPanels extends JavaPlugin {
} }
public void helpMessage(CommandSender p) { public void helpMessage(CommandSender p) {
String tag = config.getString("config.format.tag") + " ";
p.sendMessage(papi( tag + ChatColor.GREEN + "Commands:")); p.sendMessage(papi( tag + ChatColor.GREEN + "Commands:"));
p.sendMessage(ChatColor.GOLD + "/cp <panel> [player:item] [player] " + ChatColor.WHITE + "Open a command panel."); p.sendMessage(ChatColor.GOLD + "/cp <panel> [player:item] [player] " + ChatColor.WHITE + "Open a command panel.");
if (p.hasPermission("commandpanel.reload")) { if (p.hasPermission("commandpanel.reload")) {

View File

@ -24,7 +24,6 @@ public class CommandTags {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void commandTags(Player p, String command) { public void commandTags(Player p, String command) {
String tag = plugin.config.getString("config.format.tag") + " ";
//set cp placeholders, commandRAW is without placeholders //set cp placeholders, commandRAW is without placeholders
String commandRAW = command; String commandRAW = command;
command = plugin.papi(p, command); command = plugin.papi(p, command);
@ -90,7 +89,7 @@ public class CommandTags {
} catch (Exception exc) { } catch (Exception exc) {
p.setOp(isop); p.setOp(isop);
plugin.debug(exc); plugin.debug(exc);
p.sendMessage(tag + plugin.papi( plugin.config.getString("config.format.error") + " op=: Error in op command!")); p.sendMessage(plugin.tag + plugin.papi( plugin.config.getString("config.format.error") + " op=: Error in op command!"));
} }
}else if (command.split("\\s")[0].equalsIgnoreCase("delay=")) { }else if (command.split("\\s")[0].equalsIgnoreCase("delay=")) {
//if player uses op= it will perform command as op //if player uses op= it will perform command as op
@ -114,7 +113,7 @@ public class CommandTags {
plugin.econ.withdrawPlayer(p, Double.parseDouble(command.split("\\s")[1])); plugin.econ.withdrawPlayer(p, Double.parseDouble(command.split("\\s")[1]));
//if the message is empty don't send //if the message is empty don't send
if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()){ if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()){
p.sendMessage(plugin.papi( tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", command.split("\\s")[1]))); p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", command.split("\\s")[1])));
} }
//legacy ID //legacy ID
byte id = 0; byte id = 0;
@ -132,14 +131,14 @@ public class CommandTags {
Objects.requireNonNull(p.getLocation().getWorld()).dropItemNaturally(p.getLocation(), new ItemStack(Objects.requireNonNull(Material.matchMaterial(command.split("\\s")[2])), Integer.parseInt(command.split("\\s")[3]),id)); Objects.requireNonNull(p.getLocation().getWorld()).dropItemNaturally(p.getLocation(), new ItemStack(Objects.requireNonNull(Material.matchMaterial(command.split("\\s")[2])), Integer.parseInt(command.split("\\s")[3]),id));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needmoney"))); p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
} }
} catch (Exception buy) { } catch (Exception buy) {
plugin.debug(buy); plugin.debug(buy);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("tokenbuy=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("tokenbuy=")) {
//if player uses tokenbuy= it will be eg. tokenbuy= <price> <item> <amount of item> <ID> //if player uses tokenbuy= it will be eg. tokenbuy= <price> <item> <amount of item> <ID>
@ -152,7 +151,7 @@ public class CommandTags {
api.removeTokens(p, Long.parseLong(command.split("\\s")[1])); api.removeTokens(p, Long.parseLong(command.split("\\s")[1]));
//if the message is empty don't send //if the message is empty don't send
if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) { if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) {
p.sendMessage(plugin.papi( tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", command.split("\\s")[1]))); p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", command.split("\\s")[1])));
} }
//legacy ID //legacy ID
byte id = 0; byte id = 0;
@ -170,14 +169,14 @@ public class CommandTags {
Objects.requireNonNull(p.getLocation().getWorld()).dropItemNaturally(p.getLocation(), new ItemStack(Objects.requireNonNull(Material.matchMaterial(command.split("\\s")[2])), Integer.parseInt(command.split("\\s")[3]),id)); Objects.requireNonNull(p.getLocation().getWorld()).dropItemNaturally(p.getLocation(), new ItemStack(Objects.requireNonNull(Material.matchMaterial(command.split("\\s")[2])), Integer.parseInt(command.split("\\s")[3]),id));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needmoney"))); p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Buying Requires TokenManager to work!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires TokenManager to work!"));
} }
} catch (Exception buy) { } catch (Exception buy) {
plugin.debug(buy); plugin.debug(buy);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("sell=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("sell=")) {
//if player uses sell= it will be eg. sell= <cashback> <item> <amount of item> [enchanted:KNOCKBACK:1] [potion:JUMP] //if player uses sell= it will be eg. sell= <cashback> <item> <amount of item> [enchanted:KNOCKBACK:1] [potion:JUMP]
@ -235,19 +234,19 @@ public class CommandTags {
} }
} }
if (!sold) { if (!sold) {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needitems"))); p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needitems")));
} else { } else {
//if the message is empty don't send //if the message is empty don't send
if(!Objects.requireNonNull(plugin.config.getString("config.format.sold")).isEmpty()) { if(!Objects.requireNonNull(plugin.config.getString("config.format.sold")).isEmpty()) {
p.sendMessage(plugin.papi( tag + Objects.requireNonNull(plugin.config.getString("config.format.sold")).replaceAll("%cp-args%", command.split("\\s")[1]))); p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.sold")).replaceAll("%cp-args%", command.split("\\s")[1])));
} }
} }
} else { } else {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Selling Requires Vault and an Economy to work!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Selling Requires Vault and an Economy to work!"));
} }
} catch (Exception sell) { } catch (Exception sell) {
plugin.debug(sell); plugin.debug(sell);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("tokensell=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("tokensell=")) {
//if player uses tokensell= it will be eg. tokensell= <cashback> <item> <amount of item> [enchanted:KNOCKBACK:1] [potion:JUMP] //if player uses tokensell= it will be eg. tokensell= <cashback> <item> <amount of item> [enchanted:KNOCKBACK:1] [potion:JUMP]
@ -281,7 +280,7 @@ public class CommandTags {
PotionMeta potionMeta = (PotionMeta) itm.getItemMeta(); PotionMeta potionMeta = (PotionMeta) itm.getItemMeta();
assert potionMeta != null; assert potionMeta != null;
if (!potionMeta.getBasePotionData().getType().name().equalsIgnoreCase(potion)) { if (!potionMeta.getBasePotionData().getType().name().equalsIgnoreCase(potion)) {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Your item has the wrong potion effect")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Your item has the wrong potion effect"));
return; return;
} }
} }
@ -308,19 +307,19 @@ public class CommandTags {
} }
} }
if (!sold) { if (!sold) {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needitems"))); p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needitems")));
} else { } else {
//if the message is empty don't send //if the message is empty don't send
if(!Objects.requireNonNull(plugin.config.getString("config.format.sold")).isEmpty()) { if(!Objects.requireNonNull(plugin.config.getString("config.format.sold")).isEmpty()) {
p.sendMessage(plugin.papi( tag + Objects.requireNonNull(plugin.config.getString("config.format.sold")).replaceAll("%cp-args%", command.split("\\s")[1]))); p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.sold")).replaceAll("%cp-args%", command.split("\\s")[1])));
} }
} }
} else { } else {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Selling Requires TokenManager to work!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Selling Requires TokenManager to work!"));
} }
} catch (Exception sell) { } catch (Exception sell) {
plugin.debug(sell); plugin.debug(sell);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("msg=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("msg=")) {
//if player uses msg= it will send the player a message //if player uses msg= it will send the player a message
@ -331,7 +330,7 @@ public class CommandTags {
p.playSound(p.getLocation(), Sound.valueOf(command.split("\\s")[1]), 1F, 1F); p.playSound(p.getLocation(), Sound.valueOf(command.split("\\s")[1]), 1F, 1F);
} catch (Exception s) { } catch (Exception s) {
plugin.debug(s); plugin.debug(s);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("tokenbuycommand=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("tokenbuycommand=")) {
//if player uses tokenbuycommand [price] [command] //if player uses tokenbuycommand [price] [command]
@ -350,17 +349,17 @@ public class CommandTags {
commandTags(p,plugin.papi(p, commandp)); commandTags(p,plugin.papi(p, commandp));
//if the message is empty don't send //if the message is empty don't send
if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) { if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) {
p.sendMessage(plugin.papi( tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", price))); p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", price)));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needmoney"))); p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
} }
} catch (Exception buyc) { } catch (Exception buyc) {
plugin.debug(buyc); plugin.debug(buyc);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("buycommand=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("buycommand=")) {
//if player uses buycommand [price] [command] //if player uses buycommand [price] [command]
@ -376,17 +375,17 @@ public class CommandTags {
commandTags(p,plugin.papi(p, commandp)); commandTags(p,plugin.papi(p, commandp));
//if the message is empty don't send //if the message is empty don't send
if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) { if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) {
p.sendMessage(plugin.papi( tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", price))); p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", price)));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needmoney"))); p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
} }
} else { } else {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
} }
} catch (Exception buyc) { } catch (Exception buyc) {
plugin.debug(buyc); plugin.debug(buyc);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("teleport=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("teleport=")) {
//if player uses teleport= x y z (optional other player) //if player uses teleport= x y z (optional other player)
@ -414,7 +413,7 @@ public class CommandTags {
assert otherplayer != null; assert otherplayer != null;
otherplayer.teleport(new Location(otherplayer.getWorld(), x, y, z)); otherplayer.teleport(new Location(otherplayer.getWorld(), x, y, z));
} catch (Exception tpe) { } catch (Exception tpe) {
p.sendMessage(tag + plugin.config.getString("config.format.notitem")); p.sendMessage(plugin.tag + plugin.config.getString("config.format.notitem"));
} }
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("stopsound=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("stopsound=")) {
@ -423,7 +422,7 @@ public class CommandTags {
p.stopSound(Sound.valueOf(command.split("\\s")[1])); p.stopSound(Sound.valueOf(command.split("\\s")[1]));
} catch (Exception ss) { } catch (Exception ss) {
plugin.debug(ss); plugin.debug(ss);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("sudo=")) { } else if (command.split("\\s")[0].equalsIgnoreCase("sudo=")) {
//if player uses sudo= [command] //if player uses sudo= [command]

View File

@ -19,7 +19,6 @@ public class ExecuteOpenVoids {
//this is the main method to open a panel //this is the main method to open a panel
public void openCommandPanel(CommandSender sender, Player p, String panelName, ConfigurationSection cf, boolean sendOpenedMessage){ public void openCommandPanel(CommandSender sender, Player p, String panelName, ConfigurationSection cf, boolean sendOpenedMessage){
String tag = plugin.config.getString("config.format.tag") + " ";
if(p.isSleeping()){ if(p.isSleeping()){
//avoid plugin glitches when sleeping //avoid plugin glitches when sleeping
return; return;
@ -33,14 +32,14 @@ public class ExecuteOpenVoids {
if (disabledWorlds.contains(p.getWorld().getName())) { if (disabledWorlds.contains(p.getWorld().getName())) {
//panel cannot be used in the players world! //panel cannot be used in the players world!
if (Objects.requireNonNull(plugin.config.getString("config.disabled-world-message")).equalsIgnoreCase("true")) { if (Objects.requireNonNull(plugin.config.getString("config.disabled-world-message")).equalsIgnoreCase("true")) {
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Panel is disabled in the world!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Panel is disabled in the world!"));
} }
return; return;
} }
} }
}catch(NullPointerException offlinePlayer){ }catch(NullPointerException offlinePlayer){
//SKIP because player is offline //SKIP because player is offline
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.notitem"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.notitem")));
return; return;
} }
//close the inventory after the checks for permissions and worlds, so other panels can load //close the inventory after the checks for permissions and worlds, so other panels can load
@ -52,7 +51,7 @@ public class ExecuteOpenVoids {
try { try {
p.playSound(p.getLocation(), Sound.valueOf(Objects.requireNonNull(cf.getString("sound-on-open")).toUpperCase()), 1F, 1F); p.playSound(p.getLocation(), Sound.valueOf(Objects.requireNonNull(cf.getString("sound-on-open")).toUpperCase()), 1F, 1F);
} catch (Exception s) { } catch (Exception s) {
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "sound-on-open: " + cf.getString("sound-on-open"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "sound-on-open: " + cf.getString("sound-on-open")));
} }
} }
} }
@ -70,29 +69,28 @@ public class ExecuteOpenVoids {
} }
} }
}catch(Exception s){ }catch(Exception s){
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " " + "commands-on-open: " + cf.getString("commands-on-open"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands-on-open: " + cf.getString("commands-on-open")));
} }
} }
plugin.openPanels.openPanelForLoader(p.getName(), panelName, cf); plugin.openPanels.openPanelForLoader(p.getName(), panelName, cf);
plugin.createGUI.openGui(panelName, p, cf,1,0); plugin.createGUI.openGui(panelName, p, cf,1,0);
if(sendOpenedMessage) { if(sendOpenedMessage) {
sender.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Panel Opened for " + p.getDisplayName())); sender.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Panel Opened for " + p.getDisplayName()));
} }
} catch (Exception r) { } catch (Exception r) {
plugin.debug(r); plugin.debug(r);
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.notitem"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.notitem")));
} }
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
return; return;
} }
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
//this will give a hotbar item to a player //this will give a hotbar item to a player
public void giveHotbarItem(CommandSender sender, Player p, ConfigurationSection cf, boolean sendGiveMessage){ public void giveHotbarItem(CommandSender sender, Player p, ConfigurationSection cf, boolean sendGiveMessage){
String tag = plugin.config.getString("config.format.tag") + " ";
if (sender.hasPermission("commandpanel.item." + cf.getString("perm")) && cf.contains("open-with-item")) { if (sender.hasPermission("commandpanel.item." + cf.getString("perm")) && cf.contains("open-with-item")) {
try { try {
if (cf.contains("disabled-worlds")) { if (cf.contains("disabled-worlds")) {
@ -100,21 +98,21 @@ public class ExecuteOpenVoids {
if (disabledWorlds.contains(p.getWorld().getName())) { if (disabledWorlds.contains(p.getWorld().getName())) {
//panel cannot be used in the players world! //panel cannot be used in the players world!
if (Objects.requireNonNull(plugin.config.getString("config.disabled-world-message")).equalsIgnoreCase("true")) { if (Objects.requireNonNull(plugin.config.getString("config.disabled-world-message")).equalsIgnoreCase("true")) {
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Panel is disabled in the world!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Panel is disabled in the world!"));
} }
return; return;
} }
} }
}catch(NullPointerException offlinePlayer){ }catch(NullPointerException offlinePlayer){
//SKIP because player is offline //SKIP because player is offline
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.notitem"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.notitem")));
return; return;
} }
ItemStack s; ItemStack s;
try { try {
s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(cf.getConfigurationSection("open-with-item")), p, false, true); s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(cf.getConfigurationSection("open-with-item")), p, false, true);
}catch(Exception n){ }catch(Exception n){
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " open-with-item: material")); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " open-with-item: material"));
return; return;
} }
plugin.setName(s, cf.getString("open-with-item.name"), cf.getStringList("open-with-item.lore"),p,false, true); plugin.setName(s, cf.getString("open-with-item.name"), cf.getStringList("open-with-item.lore"),p,false, true);
@ -127,20 +125,20 @@ public class ExecuteOpenVoids {
p.getInventory().addItem(s); p.getInventory().addItem(s);
} }
if(sendGiveMessage) { if(sendGiveMessage) {
sender.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Item Given to " + p.getDisplayName())); sender.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Item Given to " + p.getDisplayName()));
} }
} catch (Exception r) { } catch (Exception r) {
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.notitem"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.notitem")));
} }
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
return; return;
} }
if (!cf.contains("open-with-item")) { if (!cf.contains("open-with-item")) {
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.noitem"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.noitem")));
return; return;
} }
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
} }

View File

@ -34,7 +34,6 @@ public class ItemCreation {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public ItemStack makeItemFromConfig(ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours){ public ItemStack makeItemFromConfig(ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours){
String tag = plugin.config.getString("config.format.tag") + " ";
String material = plugin.papiNoColour(p,itemSection.getString("material")); String material = plugin.papiNoColour(p,itemSection.getString("material"));
try { try {
if (Objects.requireNonNull(material).equalsIgnoreCase("AIR")) { if (Objects.requireNonNull(material).equalsIgnoreCase("AIR")) {
@ -42,7 +41,7 @@ public class ItemCreation {
} }
}catch(NullPointerException e){ }catch(NullPointerException e){
plugin.debug(e); plugin.debug(e);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " material: could not load material!")); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: could not load material!"));
return null; return null;
} }
ItemStack s; ItemStack s;
@ -99,7 +98,7 @@ public class ItemCreation {
assert meta != null; assert meta != null;
meta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(skullname))); meta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(skullname)));
} catch (Exception var23) { } catch (Exception var23) {
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " material: cps= self")); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: cps= self"));
plugin.debug(var23); plugin.debug(var23);
} }
}else{ }else{
@ -114,7 +113,7 @@ public class ItemCreation {
s = plugin.customHeads.getCustomHead(plugin.papiNoColour(p,matskull.split("\\s")[1])); s = plugin.customHeads.getCustomHead(plugin.papiNoColour(p,matskull.split("\\s")[1]));
} }
} catch (Exception var32) { } catch (Exception var32) {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " head material: Could not load skull")); p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.error") + " head material: Could not load skull"));
plugin.debug(var32); plugin.debug(var32);
} }
} }
@ -132,11 +131,11 @@ public class ItemCreation {
try { try {
s = api.getItemHead(matskull.split("\\s")[1].trim()); s = api.getItemHead(matskull.split("\\s")[1].trim());
} catch (Exception var22) { } catch (Exception var22) {
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " hdb: could not load skull!")); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " hdb: could not load skull!"));
plugin.debug(var22); plugin.debug(var22);
} }
} else { } else {
p.sendMessage(plugin.papi(tag + "Download HeadDatabaseHook from Spigot to use this feature!")); p.sendMessage(plugin.papi(plugin.tag + "Download HeadDatabaseHook from Spigot to use this feature!"));
} }
} }
if (itemSection.contains("map")) { if (itemSection.contains("map")) {
@ -167,10 +166,10 @@ public class ItemCreation {
meta.setMapView(map); meta.setMapView(map);
s.setItemMeta(meta); s.setItemMeta(meta);
}else{ }else{
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " map: File not found.")); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " map: File not found."));
} }
}catch(Exception map){ }catch(Exception map){
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " map: " + itemSection.getString("map"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " map: " + itemSection.getString("map")));
plugin.debug(map); plugin.debug(map);
} }
} }
@ -190,7 +189,7 @@ public class ItemCreation {
s.setItemMeta(EnchantMeta); s.setItemMeta(EnchantMeta);
} }
} catch (Exception ench) { } catch (Exception ench) {
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " enchanted: " + itemSection.getString("enchanted"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " enchanted: " + itemSection.getString("enchanted")));
plugin.debug(ench); plugin.debug(ench);
} }
} }
@ -241,7 +240,7 @@ public class ItemCreation {
} catch (Exception er) { } catch (Exception er) {
//don't colour the armor //don't colour the armor
plugin.debug(er); plugin.debug(er);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " leatherarmor: " + itemSection.getString("leatherarmor"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " leatherarmor: " + itemSection.getString("leatherarmor")));
} }
} }
if (itemSection.contains("potion")) { if (itemSection.contains("potion")) {
@ -257,7 +256,7 @@ public class ItemCreation {
} catch (Exception er) { } catch (Exception er) {
//don't add the effect //don't add the effect
plugin.debug(er); plugin.debug(er);
p.sendMessage(plugin.papi(tag + ChatColor.RED + plugin.config.getString("config.format.error") + " potion: " + itemSection.getString("potion"))); p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + plugin.config.getString("config.format.error") + " potion: " + itemSection.getString("potion")));
} }
} }
if (itemSection.contains("damage")) { if (itemSection.contains("damage")) {
@ -267,7 +266,7 @@ public class ItemCreation {
s.setDurability(Short.parseShort(Objects.requireNonNull(plugin.papi(p, itemSection.getString("damage"))))); s.setDurability(Short.parseShort(Objects.requireNonNull(plugin.papi(p, itemSection.getString("damage")))));
}catch(Exception e){ }catch(Exception e){
plugin.debug(e); plugin.debug(e);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage")));
} }
}else { }else {
try { try {
@ -276,7 +275,7 @@ public class ItemCreation {
s.setItemMeta((ItemMeta) itemDamage); s.setItemMeta((ItemMeta) itemDamage);
} catch (Exception e) { } catch (Exception e) {
plugin.debug(e); plugin.debug(e);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage")));
} }
} }
} }
@ -286,7 +285,7 @@ public class ItemCreation {
} }
} catch (IllegalArgumentException | NullPointerException var33) { } catch (IllegalArgumentException | NullPointerException var33) {
plugin.debug(var33); plugin.debug(var33);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " material: " + itemSection.getString("material"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: " + itemSection.getString("material")));
return null; return null;
} }
plugin.setName(s, itemSection.getString("name"), itemSection.getStringList("lore"), p, placeholders, colours); plugin.setName(s, itemSection.getString("name"), itemSection.getStringList("lore"), p, placeholders, colours);

View File

@ -21,7 +21,6 @@ public class Commandpanel implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
ConfigurationSection cf = null; //this is the file to use for any panel.* requests ConfigurationSection cf = null; //this is the file to use for any panel.* requests
String panelName = ""; String panelName = "";
//below is going to go through the files and find the right one //below is going to go through the files and find the right one
@ -38,7 +37,7 @@ public class Commandpanel implements CommandExecutor {
return true; return true;
} }
if(cf == null){ if(cf == null){
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.nopanel"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
return true; return true;
} }
if(cf.contains("panelType")) { if(cf.contains("panelType")) {
@ -55,18 +54,18 @@ public class Commandpanel implements CommandExecutor {
if(!args[1].equals("item")){ if(!args[1].equals("item")){
plugin.openVoids.openCommandPanel(sender,plugin.getServer().getPlayer(args[1]),panelName,cf,true); plugin.openVoids.openCommandPanel(sender,plugin.getServer().getPlayer(args[1]),panelName,cf,true);
}else{ }else{
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cp <panel> [item] [player]")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> [item] [player]"));
} }
return true; return true;
}else if(args.length == 3){ }else if(args.length == 3){
if (args[1].equals("item")) { if (args[1].equals("item")) {
plugin.openVoids.giveHotbarItem(sender,plugin.getServer().getPlayer(args[2]),cf,true); plugin.openVoids.giveHotbarItem(sender,plugin.getServer().getPlayer(args[2]),cf,true);
}else{ }else{
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cp <panel> item [player]")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> item [player]"));
} }
return true; return true;
} else { } else {
sender.sendMessage(plugin.papi( tag + ChatColor.RED + "Please execute command directed to a Player!")); sender.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please execute command directed to a Player!"));
return true; return true;
} }
}else{ }else{
@ -89,7 +88,7 @@ public class Commandpanel implements CommandExecutor {
} }
} }
} }
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cp <panel> [player:item] [player]")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> [player:item] [player]"));
return true; return true;
} }
} }

View File

@ -14,9 +14,8 @@ public class Commandpanelclose implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if(!(sender instanceof Player)) { if(!(sender instanceof Player)) {
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Please execute command as a Player!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
return true; return true;
} }
Player p = (Player)sender; Player p = (Player)sender;
@ -25,7 +24,7 @@ public class Commandpanelclose implements CommandExecutor {
p.closeInventory(); p.closeInventory();
return true; return true;
} }
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpc")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpc"));
return true; return true;
} }
} }

View File

@ -13,20 +13,19 @@ public class Commandpanelresources implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if (label.equalsIgnoreCase("cpa") || label.equalsIgnoreCase("commandpaneladdons") || label.equalsIgnoreCase("cpanela")) { if (label.equalsIgnoreCase("cpa") || label.equalsIgnoreCase("commandpaneladdons") || label.equalsIgnoreCase("cpanela")) {
if (sender.hasPermission("commandpanel.addons")) { if (sender.hasPermission("commandpanel.addons")) {
//version command //version command
sender.sendMessage(plugin.papi(tag)); sender.sendMessage(plugin.papi(plugin.tag));
sender.sendMessage(ChatColor.GREEN + "Version " + ChatColor.GRAY + plugin.getDescription().getVersion()); sender.sendMessage(ChatColor.GREEN + "Version " + ChatColor.GRAY + plugin.getDescription().getVersion());
sender.sendMessage(ChatColor.GREEN + "Find Panels " + ChatColor.GRAY + "https://commandpanels.org/resources/"); sender.sendMessage(ChatColor.GREEN + "Find Panels " + ChatColor.GRAY + "https://commandpanels.org/resources/");
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
return true; return true;
} }
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpa")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpa"));
return true; return true;
} }
} }

View File

@ -13,26 +13,25 @@ public class Commandpanelsdebug implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if (label.equalsIgnoreCase("cpd") || label.equalsIgnoreCase("commandpaneldebug") || label.equalsIgnoreCase("cpaneld")) { if (label.equalsIgnoreCase("cpd") || label.equalsIgnoreCase("commandpaneldebug") || label.equalsIgnoreCase("cpaneld")) {
if (sender.hasPermission("commandpanel.debug")) { if (sender.hasPermission("commandpanel.debug")) {
if (args.length == 0) { if (args.length == 0) {
//command /cpd //command /cpd
plugin.debug = !plugin.debug; plugin.debug = !plugin.debug;
if(plugin.debug){ if(plugin.debug){
sender.sendMessage(plugin.papi(tag + ChatColor.GREEN + "Debug Mode Enabled!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Debug Mode Enabled!"));
}else{ }else{
sender.sendMessage(plugin.papi(tag + ChatColor.GREEN + "Debug Mode Disabled!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Debug Mode Disabled!"));
} }
}else{ }else{
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpd")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
} }
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
return true; return true;
} }
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpd")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
return true; return true;
} }
} }

View File

@ -19,18 +19,17 @@ public class Commandpanelslist implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if (label.equalsIgnoreCase("cpl") || label.equalsIgnoreCase("commandpanellist") || label.equalsIgnoreCase("cpanell")) { if (label.equalsIgnoreCase("cpl") || label.equalsIgnoreCase("commandpanellist") || label.equalsIgnoreCase("cpanell")) {
if (sender.hasPermission("commandpanel.list")) { if (sender.hasPermission("commandpanel.list")) {
//command /cpl //command /cpl
//check to make sure the panels isn't empty //check to make sure the panels isn't empty
try { try {
if (plugin.panelFiles == null) { if (plugin.panelFiles == null) {
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "No panels found!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "No panels found!"));
return true; return true;
} }
}catch(Exception b){ }catch(Exception b){
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "No panels found!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "No panels found!"));
return true; return true;
} }
ArrayList<String> apanels = new ArrayList<String>(); //all panels from all files (panel names) ArrayList<String> apanels = new ArrayList<String>(); //all panels from all files (panel names)
@ -57,7 +56,7 @@ public class Commandpanelslist implements CommandExecutor {
page = Integer.parseInt(args[0]); page = Integer.parseInt(args[0]);
skip = page*9-9; skip = page*9-9;
}catch (Exception e){ }catch (Exception e){
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Inaccessible Page")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Inaccessible Page"));
} }
} }
for (int f = skip; apanels.size() > f; f++) { for (int f = skip; apanels.size() > f; f++) {
@ -67,7 +66,7 @@ public class Commandpanelslist implements CommandExecutor {
break; break;
} }
} }
sender.sendMessage(plugin.papi(tag + ChatColor.DARK_AQUA + "Panels: (Page " + page + ")")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.DARK_AQUA + "Panels: (Page " + page + ")"));
for (int f = skip; apanels.size() > f; f++) { for (int f = skip; apanels.size() > f; f++) {
if(apanels.get(f).contains("%file%")){ if(apanels.get(f).contains("%file%")){
if(skip+9 <= f){ if(skip+9 <= f){
@ -80,11 +79,11 @@ public class Commandpanelslist implements CommandExecutor {
} }
} }
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
return true; return true;
} }
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpl")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpl"));
return true; return true;
} }
} }

View File

@ -16,7 +16,6 @@ public class Commandpanelsreload implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if (label.equalsIgnoreCase("cpr") || label.equalsIgnoreCase("commandpanelreload") || label.equalsIgnoreCase("cpanelr")) { if (label.equalsIgnoreCase("cpr") || label.equalsIgnoreCase("commandpanelreload") || label.equalsIgnoreCase("cpanelr")) {
if (sender.hasPermission("commandpanel.reload")) { if (sender.hasPermission("commandpanel.reload")) {
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
@ -28,14 +27,14 @@ public class Commandpanelsreload implements CommandExecutor {
//check for duplicates //check for duplicates
plugin.checkDuplicatePanel(sender); plugin.checkDuplicatePanel(sender);
tag = plugin.config.getString("config.format.tag") + " "; plugin.tag = plugin.papi(plugin.config.getString("config.format.tag") + " ");
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.reload"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.reload")));
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
return true; return true;
} }
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpr")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpr"));
return true; return true;
} }
} }

View File

@ -13,23 +13,22 @@ public class Commandpanelversion implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if (label.equalsIgnoreCase("cpv") || label.equalsIgnoreCase("commandpanelversion") || label.equalsIgnoreCase("cpanelv")) { if (label.equalsIgnoreCase("cpv") || label.equalsIgnoreCase("commandpanelversion") || label.equalsIgnoreCase("cpanelv")) {
if (sender.hasPermission("commandpanel.version")) { if (sender.hasPermission("commandpanel.version")) {
//version command //version command
sender.sendMessage(plugin.papi(tag)); sender.sendMessage(plugin.papi(plugin.tag));
sender.sendMessage(ChatColor.GREEN + "This Version " + ChatColor.GRAY + plugin.getDescription().getVersion()); sender.sendMessage(ChatColor.GREEN + "This Version " + ChatColor.GRAY + plugin.getDescription().getVersion());
sender.sendMessage(ChatColor.GREEN + "Latest Version " + ChatColor.GRAY + plugin.updater.githubNewUpdate(false)); sender.sendMessage(ChatColor.GREEN + "Latest Version " + ChatColor.GRAY + plugin.updater.githubNewUpdate(false));
sender.sendMessage(ChatColor.GRAY + "-------------------"); sender.sendMessage(ChatColor.GRAY + "-------------------");
sender.sendMessage(ChatColor.GREEN + "Developer " + ChatColor.GRAY + "RockyHawk"); sender.sendMessage(ChatColor.GREEN + "Developer " + ChatColor.GRAY + "RockyHawk");
sender.sendMessage(ChatColor.GREEN + "Command " + ChatColor.GRAY + "/cp"); sender.sendMessage(ChatColor.GREEN + "Command " + ChatColor.GRAY + "/cp");
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
} }
return true; return true;
} }
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpv")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpv"));
return true; return true;
} }
} }

View File

@ -18,9 +18,8 @@ public class Commandpanelsgenerate implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if(!(sender instanceof Player)) { if(!(sender instanceof Player)) {
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Please execute command as a Player!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
return true; return true;
} }
Player p = (Player) sender; Player p = (Player) sender;
@ -33,30 +32,30 @@ public class Commandpanelsgenerate implements CommandExecutor {
Inventory i = Bukkit.createInventory((InventoryHolder) null, Integer.parseInt(args[0]) * 9, "Generate New Panel"); Inventory i = Bukkit.createInventory((InventoryHolder) null, Integer.parseInt(args[0]) * 9, "Generate New Panel");
p.openInventory(i); p.openInventory(i);
} else { } else {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Please use integer from 1-6.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please use integer from 1-6."));
} }
}catch(Exception exc){ }catch(Exception exc){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Please use integer from 1-6.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please use integer from 1-6."));
} }
return true; return true;
}else if (args.length == 0) { }else if (args.length == 0) {
if (this.plugin.generateMode.contains(p)) { if (this.plugin.generateMode.contains(p)) {
this.plugin.generateMode.remove(p); this.plugin.generateMode.remove(p);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Generate Mode Disabled!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Generate Mode Disabled!"));
} else { } else {
this.plugin.generateMode.add(p); this.plugin.generateMode.add(p);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Generate Mode Enabled!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Generate Mode Enabled!"));
} }
return true; return true;
} }
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Usage: /cpg [rows]")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
return true; return true;
}else{ }else{
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
return true; return true;
} }
} }
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpg [rows]")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
return true; return true;
} }
} }

View File

@ -63,8 +63,6 @@ public class GenUtils implements Listener {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
void generatePanel(Player p, Inventory inv){ void generatePanel(Player p, Inventory inv){
ItemStack[] cont = inv.getContents();
String tag = plugin.config.getString("config.format.tag") + " ";
ArrayList<String> apanels = new ArrayList(); ArrayList<String> apanels = new ArrayList();
for(String[] panelNames : plugin.panelNames){ for(String[] panelNames : plugin.panelNames){
//create list of names that aren't a String list //create list of names that aren't a String list
@ -80,7 +78,7 @@ public class GenUtils implements Listener {
} }
if(!foundItem){ if(!foundItem){
//panels don't need items but I cancel on generate with no items because then players have the option to cancel if they need to //panels don't need items but I cancel on generate with no items because then players have the option to cancel if they need to
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Cancelled Panel!")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Cancelled Panel!"));
return; return;
} }
YamlConfiguration file; YamlConfiguration file;
@ -106,9 +104,9 @@ public class GenUtils implements Listener {
try { try {
file.save(new File(plugin.panelsf + File.separator + date + ".yml")); file.save(new File(plugin.panelsf + File.separator + date + ".yml"));
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Saved Generated File To: " + date + ".yml")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Saved Generated File To: " + date + ".yml"));
} catch (IOException var16) { } catch (IOException var16) {
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could Not Save Generated Panel!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could Not Save Generated Panel!"));
} }
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
} }

View File

@ -22,18 +22,17 @@ public class CpIngameEditCommand implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if(!sender.hasPermission("commandpanel.edit")){ if(!sender.hasPermission("commandpanel.edit")){
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
return true; return true;
} }
if(Objects.requireNonNull(plugin.config.getString("config.ingame-editor")).equalsIgnoreCase("false")){ if(Objects.requireNonNull(plugin.config.getString("config.ingame-editor")).equalsIgnoreCase("false")){
//this will cancel every /cpe command if ingame-editor is set to false //this will cancel every /cpe command if ingame-editor is set to false
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Editor disabled!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Editor disabled!"));
return true; return true;
} }
if(!(sender instanceof Player)) { if(!(sender instanceof Player)) {
sender.sendMessage(plugin.papi( tag + ChatColor.RED + "Please execute command as a Player!")); sender.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
return true; return true;
} }
ConfigurationSection cf = null; //this is the file to use for any panel.* requests ConfigurationSection cf = null; //this is the file to use for any panel.* requests
@ -61,7 +60,7 @@ public class CpIngameEditCommand implements CommandExecutor {
return true; return true;
} }
} }
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpe <panel>")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpe <panel>"));
return true; return true;
} }
} }

View File

@ -118,108 +118,107 @@ public class EditorUserInput implements Listener {
} }
void panelSectionCheck(Player p, String section, String panelName, String panelTitle, ConfigurationSection cf, YamlConfiguration cfile, File panelFile, AsyncPlayerChatEvent e){ void panelSectionCheck(Player p, String section, String panelName, String panelTitle, ConfigurationSection cf, YamlConfiguration cfile, File panelFile, AsyncPlayerChatEvent e){
String tag = plugin.config.getString("config.format.tag") + " ";
switch (section) { switch (section) {
case "panel.delete": case "panel.delete":
if (e.getMessage().contains("y")) { if (e.getMessage().contains("y")) {
if(Objects.requireNonNull(cfile.getConfigurationSection("panels")).getKeys(false).size() != 1){ if(Objects.requireNonNull(cfile.getConfigurationSection("panels")).getKeys(false).size() != 1){
//if the file has more than one panel in it //if the file has more than one panel in it
if(savePanelFile(null, cfile, panelName, panelFile)){ if(savePanelFile(null, cfile, panelName, panelFile)){
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Deleted Panel!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Deleted Panel!"));
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could Not Delete Panel!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could Not Delete Panel!"));
} }
}else { }else {
//if the file only has one panel in it //if the file only has one panel in it
if (panelFile.delete()) { if (panelFile.delete()) {
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Deleted Panel!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Deleted Panel!"));
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could Not Delete Panel!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could Not Delete Panel!"));
} }
} }
} }
break; break;
case "panel.perm": case "panel.perm":
if(e.getMessage().contains(" ")){ if(e.getMessage().contains(" ")){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Permission cannot contain spaces!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Permission cannot contain spaces!"));
break; break;
} }
cf.set("perm", e.getMessage()); cf.set("perm", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Permission required is now " + "commandpanel.panel." + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Permission required is now " + "commandpanel.panel." + e.getMessage()));
break; break;
case "panel.rows": case "panel.rows":
try { try {
int rows = Integer.parseInt(e.getMessage()); int rows = Integer.parseInt(e.getMessage());
if (rows >= 7 || rows <= 0) { if (rows >= 7 || rows <= 0) {
//if the number isn't between 1-6 //if the number isn't between 1-6
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Choose an integer between 1 to 6!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Choose an integer between 1 to 6!"));
return; return;
} }
cf.set("rows", rows); cf.set("rows", rows);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set Panel to " + rows + " rows!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set Panel to " + rows + " rows!"));
} catch (Exception io) { } catch (Exception io) {
plugin.debug(io); plugin.debug(io);
} }
break; break;
case "panel.title": case "panel.title":
if(panelTitle.equals(plugin.papi(e.getMessage()))){ if(panelTitle.equals(plugin.papi(e.getMessage()))){
p.sendMessage(plugin.papi(tag + e.getMessage() + ChatColor.RED + " is in use from another panel!")); p.sendMessage(plugin.papi(plugin.tag + e.getMessage() + ChatColor.RED + " is in use from another panel!"));
break; break;
} }
cf.set("title", e.getMessage()); cf.set("title", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set new Title to " + ChatColor.WHITE + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new Title to " + ChatColor.WHITE + e.getMessage()));
break; break;
case "panel.name": case "panel.name":
if(e.getMessage().contains(" ")){ if(e.getMessage().contains(" ")){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Panel name cannot contain spaces!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Panel name cannot contain spaces!"));
break; break;
} }
if(panelName.equals(e.getMessage())){ if(panelName.equals(e.getMessage())){
p.sendMessage(plugin.papi(tag + ChatColor.RED + e.getMessage() + " is in use from another panel!")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + e.getMessage() + " is in use from another panel!"));
break; break;
} }
cfile.set("panels." + e.getMessage(), cfile.get("panels." + panelName)); cfile.set("panels." + e.getMessage(), cfile.get("panels." + panelName));
//I have put null there instead of cf because that will replicate cp = null to delete it //I have put null there instead of cf because that will replicate cp = null to delete it
savePanelFile(null, cfile, panelName, panelFile); savePanelFile(null, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set new Name to " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new Name to " + e.getMessage()));
break; break;
case "panel.empty": case "panel.empty":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("empty", null); cf.set("empty", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Empty materials have been removed.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Empty materials have been removed."));
break; break;
} }
String materialTemp = null; String materialTemp = null;
try { try {
materialTemp = Objects.requireNonNull(Material.matchMaterial(e.getMessage())).toString(); materialTemp = Objects.requireNonNull(Material.matchMaterial(e.getMessage())).toString();
}catch(NullPointerException ex){ }catch(NullPointerException ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + e.getMessage() + " is not a valid Material!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + e.getMessage() + " is not a valid Material!"));
} }
cf.set("empty", materialTemp); cf.set("empty", materialTemp);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set Empty material to " + materialTemp)); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set Empty material to " + materialTemp));
break; break;
case "panel.sound-on-open": case "panel.sound-on-open":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("sound-on-open", null); cf.set("sound-on-open", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Sounds have been removed.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Sounds have been removed."));
break; break;
} }
String tempSound; String tempSound;
try { try {
tempSound = Sound.valueOf(e.getMessage()).toString(); tempSound = Sound.valueOf(e.getMessage()).toString();
}catch(Exception ex){ }catch(Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + e.getMessage() + " is not a valid Sound!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + e.getMessage() + " is not a valid Sound!"));
return; return;
} }
cf.set("sound-on-open", tempSound); cf.set("sound-on-open", tempSound);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Sound when opening is now " + tempSound)); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Sound when opening is now " + tempSound));
break; break;
case "panel.panelType.add": case "panel.panelType.add":
List<String> typeAdd = new ArrayList<>(); List<String> typeAdd = new ArrayList<>();
@ -229,20 +228,20 @@ public class EditorUserInput implements Listener {
typeAdd.add(e.getMessage().toLowerCase()); typeAdd.add(e.getMessage().toLowerCase());
cf.set("panelType", typeAdd); cf.set("panelType", typeAdd);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new panel type: " + e.getMessage().toLowerCase())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new panel type: " + e.getMessage().toLowerCase()));
break; break;
case "panel.panelType.remove": case "panel.panelType.remove":
List<String> typeRemove; List<String> typeRemove;
if(cf.contains("panelType")){ if(cf.contains("panelType")){
typeRemove = cf.getStringList("panelType"); typeRemove = cf.getStringList("panelType");
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No types found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No types found to remove!"));
break; break;
} }
try { try {
typeRemove.remove(Integer.parseInt(e.getMessage())-1); typeRemove.remove(Integer.parseInt(e.getMessage())-1);
}catch (Exception ex){ }catch (Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find type!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find type!"));
break; break;
} }
if(typeRemove.size() == 0){ if(typeRemove.size() == 0){
@ -251,7 +250,7 @@ public class EditorUserInput implements Listener {
cf.set("panelType", typeRemove); cf.set("panelType", typeRemove);
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed panel type " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed panel type " + e.getMessage()));
break; break;
case "panel.commands.add": case "panel.commands.add":
List<String> commandsAdd = new ArrayList<>(); List<String> commandsAdd = new ArrayList<>();
@ -261,20 +260,20 @@ public class EditorUserInput implements Listener {
commandsAdd.add(e.getMessage()); commandsAdd.add(e.getMessage());
cf.set("commands", commandsAdd); cf.set("commands", commandsAdd);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new command: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
break; break;
case "panel.commands.remove": case "panel.commands.remove":
List<String> commandsRemove; List<String> commandsRemove;
if(cf.contains("commands")){ if(cf.contains("commands")){
commandsRemove = cf.getStringList("commands"); commandsRemove = cf.getStringList("commands");
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No commands found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No commands found to remove!"));
break; break;
} }
try { try {
commandsRemove.remove(Integer.parseInt(e.getMessage())-1); commandsRemove.remove(Integer.parseInt(e.getMessage())-1);
}catch (Exception ex){ }catch (Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find command!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
break; break;
} }
if(commandsRemove.size() == 0){ if(commandsRemove.size() == 0){
@ -283,7 +282,7 @@ public class EditorUserInput implements Listener {
cf.set("commands", commandsRemove); cf.set("commands", commandsRemove);
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed command line " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
break; break;
case "panel.commands-on-open.add": case "panel.commands-on-open.add":
List<String> commandsOnOpenAdd = new ArrayList<>(); List<String> commandsOnOpenAdd = new ArrayList<>();
@ -293,20 +292,20 @@ public class EditorUserInput implements Listener {
commandsOnOpenAdd.add(e.getMessage()); commandsOnOpenAdd.add(e.getMessage());
cf.set("commands-on-open", commandsOnOpenAdd); cf.set("commands-on-open", commandsOnOpenAdd);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new command: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
break; break;
case "panel.commands-on-open.remove": case "panel.commands-on-open.remove":
List<String> commandsOnOpenRemove; List<String> commandsOnOpenRemove;
if(cf.contains("commands-on-open")){ if(cf.contains("commands-on-open")){
commandsOnOpenRemove = cf.getStringList("commands-on-open"); commandsOnOpenRemove = cf.getStringList("commands-on-open");
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No commands found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No commands found to remove!"));
break; break;
} }
try { try {
commandsOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1); commandsOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1);
}catch (Exception ex){ }catch (Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find command!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
break; break;
} }
if(commandsOnOpenRemove.size() == 0){ if(commandsOnOpenRemove.size() == 0){
@ -315,7 +314,7 @@ public class EditorUserInput implements Listener {
cf.set("commands-on-open", commandsOnOpenRemove); cf.set("commands-on-open", commandsOnOpenRemove);
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed command line " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
break; break;
case "panel.disabled-worlds.add": case "panel.disabled-worlds.add":
List<String> disabledWorldsAdd = new ArrayList<>(); List<String> disabledWorldsAdd = new ArrayList<>();
@ -325,20 +324,20 @@ public class EditorUserInput implements Listener {
disabledWorldsAdd.add(e.getMessage()); disabledWorldsAdd.add(e.getMessage());
cf.set("disabled-worlds", disabledWorldsAdd); cf.set("disabled-worlds", disabledWorldsAdd);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new World: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new World: " + e.getMessage()));
break; break;
case "panel.disabled-worlds.remove": case "panel.disabled-worlds.remove":
List<String> disabledWorldsRemove; List<String> disabledWorldsRemove;
if(cf.contains("disabled-worlds")){ if(cf.contains("disabled-worlds")){
disabledWorldsRemove = cf.getStringList("disabled-worlds"); disabledWorldsRemove = cf.getStringList("disabled-worlds");
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No Worlds found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No Worlds found to remove!"));
break; break;
} }
try { try {
disabledWorldsRemove.remove(Integer.parseInt(e.getMessage())-1); disabledWorldsRemove.remove(Integer.parseInt(e.getMessage())-1);
}catch (Exception ex){ }catch (Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find World!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find World!"));
break; break;
} }
if(disabledWorldsRemove.size() == 0){ if(disabledWorldsRemove.size() == 0){
@ -347,13 +346,13 @@ public class EditorUserInput implements Listener {
cf.set("disabled-worlds", disabledWorldsRemove); cf.set("disabled-worlds", disabledWorldsRemove);
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed World line " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed World line " + e.getMessage()));
break; break;
case "panel.hotbar.material": case "panel.hotbar.material":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("open-with-item", null); cf.set("open-with-item", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Hotbar item have been removed.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Hotbar item have been removed."));
//after an open-with-item has been altered, reload after changes //after an open-with-item has been altered, reload after changes
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
break; break;
@ -363,7 +362,7 @@ public class EditorUserInput implements Listener {
cf.set("open-with-item.name", panelName + " Item"); cf.set("open-with-item.name", panelName + " Item");
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set new Material to " + ChatColor.WHITE + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new Material to " + ChatColor.WHITE + e.getMessage()));
//after an open-with-item has been altered, reload after changes //after an open-with-item has been altered, reload after changes
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
break; break;
@ -371,17 +370,17 @@ public class EditorUserInput implements Listener {
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("open-with-item.stationary", null); cf.set("open-with-item.stationary", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Hotbar item can now be moved.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Hotbar item can now be moved."));
break; break;
} }
try { try {
int loc = Integer.parseInt(e.getMessage()); int loc = Integer.parseInt(e.getMessage());
if (loc >= 10 || loc <= 0) { if (loc >= 10 || loc <= 0) {
//if the number isn't between 1-9 //if the number isn't between 1-9
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Choose an integer between 1 to 9!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Choose an integer between 1 to 9!"));
return; return;
} }
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set Hotbar Location to " + loc + "!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set Hotbar Location to " + loc + "!"));
//because it needs to convert 1-9 to 0-8 for in the panel //because it needs to convert 1-9 to 0-8 for in the panel
loc -= 1; loc -= 1;
cf.set("open-with-item.stationary", loc); cf.set("open-with-item.stationary", loc);
@ -393,7 +392,7 @@ public class EditorUserInput implements Listener {
case "panel.hotbar.name": case "panel.hotbar.name":
cf.set("open-with-item.name",e.getMessage()); cf.set("open-with-item.name",e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set new Name to " + ChatColor.WHITE + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new Name to " + ChatColor.WHITE + e.getMessage()));
break; break;
case "panel.hotbar.lore.add": case "panel.hotbar.lore.add":
List<String> loreAdd = new ArrayList<>(); List<String> loreAdd = new ArrayList<>();
@ -403,20 +402,20 @@ public class EditorUserInput implements Listener {
loreAdd.add(e.getMessage()); loreAdd.add(e.getMessage());
cf.set("open-with-item.lore", loreAdd); cf.set("open-with-item.lore", loreAdd);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new lore: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new lore: " + e.getMessage()));
break; break;
case "panel.hotbar.lore.remove": case "panel.hotbar.lore.remove":
List<String> loreRemove; List<String> loreRemove;
if(cf.contains("open-with-item.lore")){ if(cf.contains("open-with-item.lore")){
loreRemove = cf.getStringList("open-with-item.lore"); loreRemove = cf.getStringList("open-with-item.lore");
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No lore found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No lore found to remove!"));
break; break;
} }
try { try {
loreRemove.remove(Integer.parseInt(e.getMessage())-1); loreRemove.remove(Integer.parseInt(e.getMessage())-1);
}catch (Exception ex){ }catch (Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find lore!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find lore!"));
break; break;
} }
if(loreRemove.size() == 0){ if(loreRemove.size() == 0){
@ -425,7 +424,7 @@ public class EditorUserInput implements Listener {
cf.set("open-with-item.lore", loreRemove); cf.set("open-with-item.lore", loreRemove);
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed lore line " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed lore line " + e.getMessage()));
break; break;
} }
} }
@ -437,7 +436,6 @@ public class EditorUserInput implements Listener {
so using a different symbol will help to separate the section from so using a different symbol will help to separate the section from
everything else everything else
*/ */
String tag = plugin.config.getString("config.format.tag") + " ";
String itemSlot = section.split(":")[1]; String itemSlot = section.split(":")[1];
String sectionChange = section.replace("item:" + itemSlot + ":",""); String sectionChange = section.replace("item:" + itemSlot + ":","");
switch (sectionChange) { switch (sectionChange) {
@ -445,41 +443,41 @@ public class EditorUserInput implements Listener {
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".name", ""); cf.set("item." + itemSlot + ".name", "");
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Name is now default.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Name is now default."));
break; break;
} }
cf.set("item." + itemSlot + ".name", e.getMessage()); cf.set("item." + itemSlot + ".name", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set new name to " + ChatColor.WHITE + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new name to " + ChatColor.WHITE + e.getMessage()));
break; break;
case "head": case "head":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".material", plugin.getHeads.playerHeadString()); cf.set("item." + itemSlot + ".material", plugin.getHeads.playerHeadString());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Material is now default.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Material is now default."));
break; break;
} }
cf.set("item." + itemSlot + ".material", e.getMessage()); cf.set("item." + itemSlot + ".material", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set Material value to " + ChatColor.WHITE + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set Material value to " + ChatColor.WHITE + e.getMessage()));
break; break;
case "stack": case "stack":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".stack", null); cf.set("item." + itemSlot + ".stack", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Item has been unstacked.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Item has been unstacked."));
break; break;
} }
try { try {
int rows = Integer.parseInt(e.getMessage()); int rows = Integer.parseInt(e.getMessage());
if (rows >= 65 || rows <= 0) { if (rows >= 65 || rows <= 0) {
//if the number isn't between 1-64 //if the number isn't between 1-64
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Choose an integer between 1 to 64!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Choose an integer between 1 to 64!"));
return; return;
} }
cf.set("item." + itemSlot + ".stack", rows); cf.set("item." + itemSlot + ".stack", rows);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set stack to " + rows + "!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set stack to " + rows + "!"));
} catch (Exception io) { } catch (Exception io) {
plugin.debug(io); plugin.debug(io);
} }
@ -488,45 +486,45 @@ public class EditorUserInput implements Listener {
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".enchanted", null); cf.set("item." + itemSlot + ".enchanted", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Enchantments have been removed.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Enchantments have been removed."));
break; break;
} }
cf.set("item." + itemSlot + ".enchanted", e.getMessage()); cf.set("item." + itemSlot + ".enchanted", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set new Enchantment to " + ChatColor.WHITE + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new Enchantment to " + ChatColor.WHITE + e.getMessage()));
break; break;
case "potion": case "potion":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".potion", null); cf.set("item." + itemSlot + ".potion", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Potion effects have been removed.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Potion effects have been removed."));
break; break;
} }
cf.set("item." + itemSlot + ".potion", e.getMessage()); cf.set("item." + itemSlot + ".potion", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set new Potion to " + e.getMessage().toUpperCase())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new Potion to " + e.getMessage().toUpperCase()));
break; break;
case "customdata": case "customdata":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".customdata", null); cf.set("item." + itemSlot + ".customdata", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Custom Model Data has been removed.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Custom Model Data has been removed."));
break; break;
} }
cf.set("item." + itemSlot + ".customdata", e.getMessage()); cf.set("item." + itemSlot + ".customdata", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Custom Model Data set to " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Custom Model Data set to " + e.getMessage()));
break; break;
case "leatherarmor": case "leatherarmor":
if(e.getMessage().trim().equalsIgnoreCase("remove")){ if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".leatherarmor", null); cf.set("item." + itemSlot + ".leatherarmor", null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Leather armor colour has been removed.")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Leather armor colour has been removed."));
break; break;
} }
cf.set("item." + itemSlot + ".leatherarmor", e.getMessage()); cf.set("item." + itemSlot + ".leatherarmor", e.getMessage());
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Leather armor colour set to " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Leather armor colour set to " + e.getMessage()));
break; break;
case "commands:add": case "commands:add":
List<String> commandsOnOpenAdd = new ArrayList<>(); List<String> commandsOnOpenAdd = new ArrayList<>();
@ -536,20 +534,20 @@ public class EditorUserInput implements Listener {
commandsOnOpenAdd.add(e.getMessage()); commandsOnOpenAdd.add(e.getMessage());
cf.set("item." + itemSlot + ".commands", commandsOnOpenAdd); cf.set("item." + itemSlot + ".commands", commandsOnOpenAdd);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new command: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
break; break;
case "commands:remove": case "commands:remove":
List<String> commandsOnOpenRemove; List<String> commandsOnOpenRemove;
if(cf.contains("item." + itemSlot + ".commands")){ if(cf.contains("item." + itemSlot + ".commands")){
commandsOnOpenRemove = cf.getStringList("item." + itemSlot + ".commands"); commandsOnOpenRemove = cf.getStringList("item." + itemSlot + ".commands");
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No commands found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No commands found to remove!"));
break; break;
} }
try { try {
commandsOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1); commandsOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1);
}catch (Exception ex){ }catch (Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find command!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
plugin.debug(ex); plugin.debug(ex);
break; break;
} }
@ -559,7 +557,7 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".commands", commandsOnOpenRemove); cf.set("item." + itemSlot + ".commands", commandsOnOpenRemove);
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed command line " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
break; break;
case "lore:add": case "lore:add":
List<String> loreOnOpenAdd = new ArrayList<>(); List<String> loreOnOpenAdd = new ArrayList<>();
@ -569,20 +567,20 @@ public class EditorUserInput implements Listener {
loreOnOpenAdd.add(e.getMessage()); loreOnOpenAdd.add(e.getMessage());
cf.set("item." + itemSlot + ".lore", loreOnOpenAdd); cf.set("item." + itemSlot + ".lore", loreOnOpenAdd);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new lore: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new lore: " + e.getMessage()));
break; break;
case "lore:remove": case "lore:remove":
List<String> loreOnOpenRemove; List<String> loreOnOpenRemove;
if(cf.contains("item." + itemSlot + ".lore")){ if(cf.contains("item." + itemSlot + ".lore")){
loreOnOpenRemove = cf.getStringList("item." + itemSlot + ".lore"); loreOnOpenRemove = cf.getStringList("item." + itemSlot + ".lore");
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No lore found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No lore found to remove!"));
break; break;
} }
try { try {
loreOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1); loreOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1);
}catch (Exception ex){ }catch (Exception ex){
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find lore!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find lore!"));
plugin.debug(ex); plugin.debug(ex);
break; break;
} }
@ -592,7 +590,7 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".lore", loreOnOpenRemove); cf.set("item." + itemSlot + ".lore", loreOnOpenRemove);
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed lore line " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed lore line " + e.getMessage()));
break; break;
case "duplicate:add": case "duplicate:add":
if(cf.contains("item." + itemSlot + ".duplicate")){ if(cf.contains("item." + itemSlot + ".duplicate")){
@ -601,7 +599,7 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".duplicate", e.getMessage()); cf.set("item." + itemSlot + ".duplicate", e.getMessage());
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new duplicate item/s: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new duplicate item/s: " + e.getMessage()));
break; break;
case "duplicate:remove": case "duplicate:remove":
if(cf.contains("item." + itemSlot + ".duplicate")){ if(cf.contains("item." + itemSlot + ".duplicate")){
@ -617,7 +615,7 @@ public class EditorUserInput implements Listener {
} }
cf.set("item." + itemSlot + ".duplicate", items.toString()); cf.set("item." + itemSlot + ".duplicate", items.toString());
} catch (Exception ex) { } catch (Exception ex) {
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Could not delete or find item!")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could not delete or find item!"));
plugin.debug(ex); plugin.debug(ex);
break; break;
} }
@ -628,17 +626,16 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".duplicate", null); cf.set("item." + itemSlot + ".duplicate", null);
} }
}else{ }else{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No items found to remove!")); p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No items found to remove!"));
break; break;
} }
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed duplicate item/s: " + e.getMessage())); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed duplicate item/s: " + e.getMessage()));
break; break;
} }
} }
void itemSectionSectionCheck(Player p, String section, String panelName, ConfigurationSection cf, YamlConfiguration cfile, File panelFile, AsyncPlayerChatEvent e){ void itemSectionSectionCheck(Player p, String section, String panelName, ConfigurationSection cf, YamlConfiguration cfile, File panelFile, AsyncPlayerChatEvent e){
String tag = plugin.config.getString("config.format.tag") + " ";
String secondValue = section.split("\\.")[1]; String secondValue = section.split("\\.")[1];
//section includes slot at front eg, 1.hasvalue //section includes slot at front eg, 1.hasvalue
String itemSection = ChatColor.stripColor(section.replace("section." + secondValue + ".", "")); String itemSection = ChatColor.stripColor(section.replace("section." + secondValue + ".", ""));
@ -656,19 +653,19 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSection + "." + playerMessage + ".name", ""); cf.set("item." + itemSection + "." + playerMessage + ".name", "");
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added Section " + ChatColor.WHITE + playerMessage)); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added Section " + ChatColor.WHITE + playerMessage));
break; break;
case "remove": case "remove":
cf.set("item." + itemSection + "." + playerMessage, null); cf.set("item." + itemSection + "." + playerMessage, null);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed Section " + ChatColor.WHITE + playerMessage)); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed Section " + ChatColor.WHITE + playerMessage));
break; break;
case "change": case "change":
cf.set("item." + itemSection + "." + playerMessage.split(":")[0], playerMessage.split(":")[1]); cf.set("item." + itemSection + "." + playerMessage.split(":")[0], playerMessage.split(":")[1]);
savePanelFile(cf, cfile, panelName, panelFile); savePanelFile(cf, cfile, panelName, panelFile);
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Set " + playerMessage.split(":")[0] + " to " + ChatColor.WHITE + playerMessage.split(":")[1])); p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set " + playerMessage.split(":")[0] + " to " + ChatColor.WHITE + playerMessage.split(":")[1]));
break; break;
} }
} }

View File

@ -348,7 +348,6 @@ public class EditorUtils implements Listener {
@EventHandler @EventHandler
public void onPanelSettings(InventoryClickEvent e) { public void onPanelSettings(InventoryClickEvent e) {
Player p = (Player)e.getWhoClicked(); Player p = (Player)e.getWhoClicked();
String tag = plugin.config.getString("config.format.tag") + " ";
try { try {
if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) { if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) {
return; return;
@ -392,52 +391,52 @@ public class EditorUtils implements Listener {
} }
if(e.getSlot() == 1){ if(e.getSlot() == 1){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.perm"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.perm"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Permission")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Permission"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 3){ if(e.getSlot() == 3){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.title"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.title"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Title")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Title"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 5){ if(e.getSlot() == 5){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.sound-on-open"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.sound-on-open"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Sound ID")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Sound ID"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 7){ if(e.getSlot() == 7){
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands.add"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands.add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Command")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Command"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands.remove"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands.remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Command to remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Command to remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 21){ if(e.getSlot() == 21){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.delete"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.delete"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Are you sure? (yes/no)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Are you sure? (yes/no)"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 23){ if(e.getSlot() == 23){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.rows"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.rows"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Row Amount (1 to 6)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Row Amount (1 to 6)"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 13){ if(e.getSlot() == 13){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.empty"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.empty"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Material ID")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Material ID"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 15){ if(e.getSlot() == 15){
//adds abilities to add and remove lines //adds abilities to add and remove lines
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands-on-open.add"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands-on-open.add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Command")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Command"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands-on-open.remove"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands-on-open.remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Command to remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Command to remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
@ -445,10 +444,10 @@ public class EditorUtils implements Listener {
//adds abilities to add and remove types //adds abilities to add and remove types
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.panelType.add"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.panelType.add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Panel type")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Panel type"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.panelType.remove"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.panelType.remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Panel Type to remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Panel Type to remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
@ -456,16 +455,16 @@ public class EditorUtils implements Listener {
//adds abilities to add and remove lines //adds abilities to add and remove lines
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.disabled-worlds.add"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.disabled-worlds.add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New World Name")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New World Name"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.disabled-worlds.remove"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.disabled-worlds.remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter World line to remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter World line to remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 11){ if(e.getSlot() == 11){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.name"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.name"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Name")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Name"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 18){ if(e.getSlot() == 18){
@ -474,28 +473,28 @@ public class EditorUtils implements Listener {
} }
if(e.getSlot() == 40){ if(e.getSlot() == 40){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.material"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.material"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Material")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Material"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 38 && hotbarItems){ if(e.getSlot() == 38 && hotbarItems){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.name"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.name"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Name")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Name"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 36 && hotbarItems){ if(e.getSlot() == 36 && hotbarItems){
//adds abilities to add and remove lines //adds abilities to add and remove lines
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.lore.add"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.lore.add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Item Lore")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Lore"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.lore.remove"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.lore.remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter lore line to remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter lore line to remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 42 && hotbarItems){ if(e.getSlot() == 42 && hotbarItems){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.stationary"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.stationary"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Location (1 to 9)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Location (1 to 9)"));
p.closeInventory(); p.closeInventory();
} }
} }
@ -503,7 +502,6 @@ public class EditorUtils implements Listener {
@EventHandler @EventHandler
public void onItemSettings(InventoryClickEvent e) { public void onItemSettings(InventoryClickEvent e) {
Player p = (Player)e.getWhoClicked(); Player p = (Player)e.getWhoClicked();
String tag = plugin.config.getString("config.format.tag") + " ";
try { try {
if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) { if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) {
return; return;
@ -556,38 +554,38 @@ public class EditorUtils implements Listener {
} }
if(e.getSlot() == 1){ if(e.getSlot() == 1){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":name"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":name"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Item Name")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Name"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 3){ if(e.getSlot() == 3){
//adds abilities to add and remove lines //adds abilities to add and remove lines
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":commands:add"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":commands:add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Item Command")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Command"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":commands:remove"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":commands:remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter command line to remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter command line to remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 5){ if(e.getSlot() == 5){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":enchanted"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":enchanted"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Item Enchantment")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Enchantment"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 7){ if(e.getSlot() == 7){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":potion"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":potion"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Item Potion Effect")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Potion Effect"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 13){ if(e.getSlot() == 13){
//adds abilities to add and remove items //adds abilities to add and remove items
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":duplicate:add"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":duplicate:add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Duplicate Item Location/s")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Duplicate Item Location/s"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":duplicate:remove"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":duplicate:remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Duplicate Item/s to Remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Duplicate Item/s to Remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
@ -595,26 +593,26 @@ public class EditorUtils implements Listener {
//adds abilities to add and remove lines //adds abilities to add and remove lines
if(e.getClick().isLeftClick()) { if(e.getClick().isLeftClick()) {
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":lore:add"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":lore:add"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Item Lore")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Lore"));
}else{ }else{
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":lore:remove"}); plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "item:" + itemSlot + ":lore:remove"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter lore line to remove (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter lore line to remove (must be an integer)"));
} }
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 21){ if(e.getSlot() == 21){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":stack"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":stack"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Item Stack (must be an integer)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Stack (must be an integer)"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 23){ if(e.getSlot() == 23){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":customdata"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":customdata"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Custom Model Data")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Custom Model Data"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 25){ if(e.getSlot() == 25){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":leatherarmor"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":leatherarmor"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Leather Armor Colour")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Leather Armor Colour"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 31){ if(e.getSlot() == 31){
@ -624,7 +622,7 @@ public class EditorUtils implements Listener {
} }
if(e.getSlot() == 35){ if(e.getSlot() == 35){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":head"}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"item:" + itemSlot + ":head"});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Custom Material (eg. cps= self)")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Custom Material (eg. cps= self)"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 27){ if(e.getSlot() == 27){
@ -642,7 +640,6 @@ public class EditorUtils implements Listener {
@EventHandler @EventHandler
public void onItemSection(InventoryClickEvent e) { public void onItemSection(InventoryClickEvent e) {
Player p = (Player)e.getWhoClicked(); Player p = (Player)e.getWhoClicked();
String tag = plugin.config.getString("config.format.tag") + " ";
try { try {
if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) { if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) {
return; return;
@ -708,7 +705,7 @@ public class EditorUtils implements Listener {
}else{ }else{
String itemNameSection = "." + ChatColor.stripColor(e.getInventory().getItem(e.getSlot()).getItemMeta().getDisplayName()); String itemNameSection = "." + ChatColor.stripColor(e.getInventory().getItem(e.getSlot()).getItemMeta().getDisplayName());
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"section.change." + section + itemNameSection}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"section.change." + section + itemNameSection});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Setting to change, eg, value:500")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Setting to change, eg, value:500"));
p.closeInventory(); p.closeInventory();
} }
} }
@ -716,13 +713,13 @@ public class EditorUtils implements Listener {
if(e.getSlot() == 38){ if(e.getSlot() == 38){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"section.remove." + section}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"section.remove." + section});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Section name to remove, eg, hasperm or hasperm0")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Section name to remove, eg, hasperm or hasperm0"));
p.closeInventory(); p.closeInventory();
} }
if(e.getSlot() == 42){ if(e.getSlot() == 42){
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"section.add." + section}); plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"section.add." + section});
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Section name to add, eg, hasperm or hasperm0")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Section name to add, eg, hasperm or hasperm0"));
p.closeInventory(); p.closeInventory();
} }
@ -768,7 +765,6 @@ public class EditorUtils implements Listener {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void onEditPanelClose(Player p, Inventory inv, InventoryView invView) { public void onEditPanelClose(Player p, Inventory inv, InventoryView invView) {
String tag = plugin.config.getString("config.format.tag") + " ";
if(inv.getType() != InventoryType.CHEST){ if(inv.getType() != InventoryType.CHEST){
return; return;
} }
@ -810,9 +806,9 @@ public class EditorUtils implements Listener {
file = plugin.itemCreate.generatePanelFile(panelName,inv,file); file = plugin.itemCreate.generatePanelFile(panelName,inv,file);
try { try {
file.save(new File(plugin.panelsf + File.separator + fileName)); file.save(new File(plugin.panelsf + File.separator + fileName));
p.sendMessage(plugin.papi(tag + ChatColor.GREEN + "Saved Changes!")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Saved Changes!"));
} catch (IOException s) { } catch (IOException s) {
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Could Not Save Changes!")); p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could Not Save Changes!"));
plugin.debug(s); plugin.debug(s);
} }
plugin.reloadPanelFiles(); plugin.reloadPanelFiles();

View File

@ -20,7 +20,6 @@ public class OpenGUI {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public Inventory openGui(String panels, Player p, ConfigurationSection pconfig, int onOpen, int animateValue) { public Inventory openGui(String panels, Player p, ConfigurationSection pconfig, int onOpen, int animateValue) {
String tag = plugin.config.getString("config.format.tag") + " ";
if (Integer.parseInt(Objects.requireNonNull(pconfig.getString("rows"))) < 7 && Integer.parseInt(Objects.requireNonNull(pconfig.getString("rows"))) > 0) { if (Integer.parseInt(Objects.requireNonNull(pconfig.getString("rows"))) < 7 && Integer.parseInt(Objects.requireNonNull(pconfig.getString("rows"))) > 0) {
Inventory i; Inventory i;
if (onOpen != 3) { if (onOpen != 3) {
@ -99,7 +98,7 @@ public class OpenGUI {
} catch (ArrayIndexOutOfBoundsException var24) { } catch (ArrayIndexOutOfBoundsException var24) {
plugin.debug(var24); plugin.debug(var24);
if (plugin.debug) { if (plugin.debug) {
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " item: One of the items does not fit in the Panel!")); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " item: One of the items does not fit in the Panel!"));
p.closeInventory(); p.closeInventory();
plugin.openPanels.closePanelForLoader(p.getName(),panels); plugin.openPanels.closePanelForLoader(p.getName(),panels);
} }
@ -131,7 +130,7 @@ public class OpenGUI {
} }
} catch (IllegalArgumentException | NullPointerException var26) { } catch (IllegalArgumentException | NullPointerException var26) {
plugin.debug(var26); plugin.debug(var26);
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " empty: " + pconfig.getString("empty"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " empty: " + pconfig.getString("empty")));
p.closeInventory(); p.closeInventory();
plugin.openPanels.closePanelForLoader(p.getName(),panels); plugin.openPanels.closePanelForLoader(p.getName(),panels);
return null; return null;
@ -162,7 +161,7 @@ public class OpenGUI {
} }
return i; return i;
} else { } else {
p.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.error") + " rows: " + pconfig.getString("rows"))); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " rows: " + pconfig.getString("rows")));
p.closeInventory(); p.closeInventory();
plugin.openPanels.closePanelForLoader(p.getName(),panels); plugin.openPanels.closePanelForLoader(p.getName(),panels);
return null; return null;

View File

@ -21,18 +21,17 @@ public class Commandpanelblocks implements CommandExecutor {
@EventHandler @EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
if (label.equalsIgnoreCase("cpb") || label.equalsIgnoreCase("commandpanelsblock") || label.equalsIgnoreCase("cpanelb")) { if (label.equalsIgnoreCase("cpb") || label.equalsIgnoreCase("commandpanelsblock") || label.equalsIgnoreCase("cpanelb")) {
if(args.length == 2) { if(args.length == 2) {
if (args[0].equalsIgnoreCase("add")) { if (args[0].equalsIgnoreCase("add")) {
if(!(sender instanceof Player)) { if(!(sender instanceof Player)) {
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Please execute command as a Player!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
return true; return true;
} }
Player p = (Player)sender; Player p = (Player)sender;
if(p.hasPermission("commandpanel.block.add")){ if(p.hasPermission("commandpanel.block.add")){
if(Objects.requireNonNull(plugin.config.getString("config.panel-blocks")).equalsIgnoreCase("false")){ if(Objects.requireNonNull(plugin.config.getString("config.panel-blocks")).equalsIgnoreCase("false")){
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Panel blocks disabled in config!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
return true; return true;
} }
boolean foundPanel = false; boolean foundPanel = false;
@ -43,12 +42,12 @@ public class Commandpanelblocks implements CommandExecutor {
} }
} }
if(!foundPanel){ if(!foundPanel){
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.nopanel"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
return true; return true;
} }
Block blockType = p.getTargetBlock(null, 5); Block blockType = p.getTargetBlock(null, 5);
if(blockType.getType() == Material.AIR){ if(blockType.getType() == Material.AIR){
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Look at a block to add a panel!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Look at a block to add a panel!"));
return true; return true;
} }
Location blockLocation = blockType.getLocation(); Location blockLocation = blockType.getLocation();
@ -58,16 +57,16 @@ public class Commandpanelblocks implements CommandExecutor {
plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml")); plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));
} catch (IOException e) { } catch (IOException e) {
plugin.debug(e); plugin.debug(e);
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Could not save to file!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could not save to file!"));
return true; return true;
} }
//make the material name look okay //make the material name look okay
String materialNameFormatted = blockType.getType().toString().substring(0, 1).toUpperCase() + blockType.getType().toString().substring(1).toLowerCase(); String materialNameFormatted = blockType.getType().toString().substring(0, 1).toUpperCase() + blockType.getType().toString().substring(1).toLowerCase();
materialNameFormatted = materialNameFormatted.replaceAll("_"," "); materialNameFormatted = materialNameFormatted.replaceAll("_"," ");
sender.sendMessage(plugin.papi(tag + ChatColor.WHITE + args[1] + ChatColor.GREEN + " will now open when right clicking " + ChatColor.WHITE + materialNameFormatted)); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + args[1] + ChatColor.GREEN + " will now open when right clicking " + ChatColor.WHITE + materialNameFormatted));
return true; return true;
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
return true; return true;
} }
} }
@ -75,13 +74,13 @@ public class Commandpanelblocks implements CommandExecutor {
if(args.length == 1){ if(args.length == 1){
if (args[0].equalsIgnoreCase("remove")) { if (args[0].equalsIgnoreCase("remove")) {
if(!(sender instanceof Player)) { if(!(sender instanceof Player)) {
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Please execute command as a Player!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
return true; return true;
} }
Player p = (Player)sender; Player p = (Player)sender;
if(p.hasPermission("commandpanel.block.remove")){ if(p.hasPermission("commandpanel.block.remove")){
if(Objects.requireNonNull(plugin.config.getString("config.panel-blocks")).equalsIgnoreCase("false")){ if(Objects.requireNonNull(plugin.config.getString("config.panel-blocks")).equalsIgnoreCase("false")){
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Panel blocks disabled in config!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
return true; return true;
} }
Block blockType = p.getTargetBlock(null, 5); Block blockType = p.getTargetBlock(null, 5);
@ -93,40 +92,40 @@ public class Commandpanelblocks implements CommandExecutor {
plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml")); plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));
} catch (IOException e) { } catch (IOException e) {
plugin.debug(e); plugin.debug(e);
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Could not save to file!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could not save to file!"));
return true; return true;
} }
sender.sendMessage(plugin.papi(tag + ChatColor.GREEN + "Panel has been removed from block.")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Panel has been removed from block."));
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.nopanel"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
} }
return true; return true;
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
return true; return true;
} }
} }
if (args[0].equalsIgnoreCase("list")) { if (args[0].equalsIgnoreCase("list")) {
if(sender.hasPermission("commandpanel.block.list")){ if(sender.hasPermission("commandpanel.block.list")){
if(Objects.requireNonNull(plugin.config.getString("config.panel-blocks")).equalsIgnoreCase("false")){ if(Objects.requireNonNull(plugin.config.getString("config.panel-blocks")).equalsIgnoreCase("false")){
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Panel blocks disabled in config!")); sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
return true; return true;
} }
if(plugin.blockConfig.contains("blocks")){ if(plugin.blockConfig.contains("blocks")){
if(Objects.requireNonNull(plugin.blockConfig.getConfigurationSection("blocks")).getKeys(false).size() == 0){ if(Objects.requireNonNull(plugin.blockConfig.getConfigurationSection("blocks")).getKeys(false).size() == 0){
sender.sendMessage(plugin.papi(tag) + ChatColor.RED + "No panel blocks found."); sender.sendMessage(plugin.papi(plugin.tag) + ChatColor.RED + "No panel blocks found.");
return true; return true;
} }
sender.sendMessage(plugin.papi(tag) + ChatColor.DARK_AQUA + "Panel Block Locations:"); sender.sendMessage(plugin.papi(plugin.tag) + ChatColor.DARK_AQUA + "Panel Block Locations:");
for (String location : Objects.requireNonNull(plugin.blockConfig.getConfigurationSection("blocks")).getKeys(false)) { for (String location : Objects.requireNonNull(plugin.blockConfig.getConfigurationSection("blocks")).getKeys(false)) {
sender.sendMessage(ChatColor.GREEN + location.replaceAll("_"," ") + ": " + ChatColor.WHITE + plugin.blockConfig.getString("blocks." + location + ".panel")); sender.sendMessage(ChatColor.GREEN + location.replaceAll("_"," ") + ": " + ChatColor.WHITE + plugin.blockConfig.getString("blocks." + location + ".panel"));
} }
}else{ }else{
sender.sendMessage(plugin.papi(tag) + ChatColor.RED + "No panel blocks found."); sender.sendMessage(plugin.papi(plugin.tag) + ChatColor.RED + "No panel blocks found.");
} }
return true; return true;
}else{ }else{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms"))); sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
return true; return true;
} }
} }