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="TokenManager-3.2.4" 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.13.2" level="project" />
<orderEntry type="library" name="PlaceholderAPI-2.10.8" level="project" />
<orderEntry type="library" name="VotingPlugin" level="project" />
</component>
</module>

View File

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

View File

@ -1,7 +1,5 @@
package me.rockyhawk.commandpanels;
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
@ -9,6 +7,7 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.bencodez.votingplugin.user.UserManager;
import me.clip.placeholderapi.PlaceholderAPI;
import me.realized.tokenmanager.api.TokenManager;
import me.rockyhawk.commandpanels.classresources.*;
@ -55,10 +54,12 @@ import org.bukkit.plugin.java.JavaPlugin;
public class CommandPanels extends JavaPlugin {
public YamlConfiguration config;
public Economy econ = null;
public boolean update = false;
public boolean debug = false;
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<String[]> userInputStrings = new ArrayList<>();
public List<String[]> editorInputStrings = new ArrayList<>();
@ -189,6 +190,9 @@ public class CommandPanels extends JavaPlugin {
//load panelFiles
reloadPanelFiles();
//get tag
tag = papi(config.getString("config.format.tag") + " ");
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) {
String tag = config.getString("config.format.tag") + " ";
//replace nodes with PlaceHolders
str = str.replaceAll("%cp-player-displayname%", p.getDisplayName());
str = str.replaceAll("%cp-player-name%", p.getName());
@ -493,7 +496,6 @@ public class CommandPanels extends JavaPlugin {
}
public void helpMessage(CommandSender p) {
String tag = config.getString("config.format.tag") + " ";
p.sendMessage(papi( tag + ChatColor.GREEN + "Commands:"));
p.sendMessage(ChatColor.GOLD + "/cp <panel> [player:item] [player] " + ChatColor.WHITE + "Open a command panel.");
if (p.hasPermission("commandpanel.reload")) {

View File

@ -24,7 +24,6 @@ public class CommandTags {
@SuppressWarnings("deprecation")
public void commandTags(Player p, String command) {
String tag = plugin.config.getString("config.format.tag") + " ";
//set cp placeholders, commandRAW is without placeholders
String commandRAW = command;
command = plugin.papi(p, command);
@ -90,7 +89,7 @@ public class CommandTags {
} catch (Exception exc) {
p.setOp(isop);
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=")) {
//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]));
//if the message is empty don't send
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
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));
}
} 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 {
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) {
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=")) {
//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]));
//if the message is empty don't send
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
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));
}
} 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 {
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) {
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=")) {
//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) {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needitems")));
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needitems")));
} else {
//if the message is empty don't send
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 {
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) {
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=")) {
//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();
assert potionMeta != null;
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;
}
}
@ -308,19 +307,19 @@ public class CommandTags {
}
}
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 {
//if the message is empty don't send
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 {
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) {
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=")) {
//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);
} catch (Exception 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=")) {
//if player uses tokenbuycommand [price] [command]
@ -350,17 +349,17 @@ public class CommandTags {
commandTags(p,plugin.papi(p, commandp));
//if the message is empty don't send
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 {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needmoney")));
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
}
} 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) {
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=")) {
//if player uses buycommand [price] [command]
@ -376,17 +375,17 @@ public class CommandTags {
commandTags(p,plugin.papi(p, commandp));
//if the message is empty don't send
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 {
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.needmoney")));
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
}
} 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) {
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=")) {
//if player uses teleport= x y z (optional other player)
@ -414,7 +413,7 @@ public class CommandTags {
assert otherplayer != null;
otherplayer.teleport(new Location(otherplayer.getWorld(), x, y, z));
} 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=")) {
@ -423,7 +422,7 @@ public class CommandTags {
p.stopSound(Sound.valueOf(command.split("\\s")[1]));
} catch (Exception 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=")) {
//if player uses sudo= [command]

View File

@ -19,7 +19,6 @@ public class ExecuteOpenVoids {
//this is the main method to open a panel
public void openCommandPanel(CommandSender sender, Player p, String panelName, ConfigurationSection cf, boolean sendOpenedMessage){
String tag = plugin.config.getString("config.format.tag") + " ";
if(p.isSleeping()){
//avoid plugin glitches when sleeping
return;
@ -33,14 +32,14 @@ public class ExecuteOpenVoids {
if (disabledWorlds.contains(p.getWorld().getName())) {
//panel cannot be used in the players world!
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;
}
}
}catch(NullPointerException offlinePlayer){
//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;
}
//close the inventory after the checks for permissions and worlds, so other panels can load
@ -52,7 +51,7 @@ public class ExecuteOpenVoids {
try {
p.playSound(p.getLocation(), Sound.valueOf(Objects.requireNonNull(cf.getString("sound-on-open")).toUpperCase()), 1F, 1F);
} 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){
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.createGUI.openGui(panelName, p, cf,1,0);
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) {
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{
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.perms")));
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
}
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
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")) {
try {
if (cf.contains("disabled-worlds")) {
@ -100,21 +98,21 @@ public class ExecuteOpenVoids {
if (disabledWorlds.contains(p.getWorld().getName())) {
//panel cannot be used in the players world!
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;
}
}
}catch(NullPointerException offlinePlayer){
//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;
}
ItemStack s;
try {
s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(cf.getConfigurationSection("open-with-item")), p, false, true);
}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;
}
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);
}
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) {
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.notitem")));
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.notitem")));
}
}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;
}
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;
}
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")
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"));
try {
if (Objects.requireNonNull(material).equalsIgnoreCase("AIR")) {
@ -42,7 +41,7 @@ public class ItemCreation {
}
}catch(NullPointerException 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;
}
ItemStack s;
@ -99,7 +98,7 @@ public class ItemCreation {
assert meta != null;
meta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(skullname)));
} 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);
}
}else{
@ -114,7 +113,7 @@ public class ItemCreation {
s = plugin.customHeads.getCustomHead(plugin.papiNoColour(p,matskull.split("\\s")[1]));
}
} 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);
}
}
@ -132,11 +131,11 @@ public class ItemCreation {
try {
s = api.getItemHead(matskull.split("\\s")[1].trim());
} 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);
}
} 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")) {
@ -167,10 +166,10 @@ public class ItemCreation {
meta.setMapView(map);
s.setItemMeta(meta);
}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){
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);
}
}
@ -190,7 +189,7 @@ public class ItemCreation {
s.setItemMeta(EnchantMeta);
}
} 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);
}
}
@ -241,7 +240,7 @@ public class ItemCreation {
} catch (Exception er) {
//don't colour the armor
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")) {
@ -257,7 +256,7 @@ public class ItemCreation {
} catch (Exception er) {
//don't add the effect
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")) {
@ -267,7 +266,7 @@ public class ItemCreation {
s.setDurability(Short.parseShort(Objects.requireNonNull(plugin.papi(p, itemSection.getString("damage")))));
}catch(Exception 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 {
try {
@ -276,7 +275,7 @@ public class ItemCreation {
s.setItemMeta((ItemMeta) itemDamage);
} catch (Exception 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) {
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;
}
plugin.setName(s, itemSection.getString("name"), itemSection.getStringList("lore"), p, placeholders, colours);

View File

@ -21,7 +21,6 @@ public class Commandpanel implements CommandExecutor {
@EventHandler
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
String panelName = "";
//below is going to go through the files and find the right one
@ -38,7 +37,7 @@ public class Commandpanel implements CommandExecutor {
return true;
}
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;
}
if(cf.contains("panelType")) {
@ -55,18 +54,18 @@ public class Commandpanel implements CommandExecutor {
if(!args[1].equals("item")){
plugin.openVoids.openCommandPanel(sender,plugin.getServer().getPlayer(args[1]),panelName,cf,true);
}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;
}else if(args.length == 3){
if (args[1].equals("item")) {
plugin.openVoids.giveHotbarItem(sender,plugin.getServer().getPlayer(args[2]),cf,true);
}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;
} 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;
}
}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;
}
}

View File

@ -14,9 +14,8 @@ public class Commandpanelclose implements CommandExecutor {
@EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
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;
}
Player p = (Player)sender;
@ -25,7 +24,7 @@ public class Commandpanelclose implements CommandExecutor {
p.closeInventory();
return true;
}
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpc"));
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpc"));
return true;
}
}

View File

@ -13,20 +13,19 @@ public class Commandpanelresources implements CommandExecutor {
@EventHandler
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 (sender.hasPermission("commandpanel.addons")) {
//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 + "Find Panels " + ChatColor.GRAY + "https://commandpanels.org/resources/");
}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;
}
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpa"));
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpa"));
return true;
}
}

View File

@ -13,26 +13,25 @@ public class Commandpanelsdebug implements CommandExecutor {
@EventHandler
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 (sender.hasPermission("commandpanel.debug")) {
if (args.length == 0) {
//command /cpd
plugin.debug = !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{
sender.sendMessage(plugin.papi(tag + ChatColor.GREEN + "Debug Mode Disabled!"));
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Debug Mode Disabled!"));
}
}else{
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpd"));
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
}
}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;
}
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpd"));
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
return true;
}
}

View File

@ -19,18 +19,17 @@ public class Commandpanelslist implements CommandExecutor {
@EventHandler
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 (sender.hasPermission("commandpanel.list")) {
//command /cpl
//check to make sure the panels isn't empty
try {
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;
}
}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;
}
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]);
skip = page*9-9;
}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++) {
@ -67,7 +66,7 @@ public class Commandpanelslist implements CommandExecutor {
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++) {
if(apanels.get(f).contains("%file%")){
if(skip+9 <= f){
@ -80,11 +79,11 @@ public class Commandpanelslist implements CommandExecutor {
}
}
}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;
}
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpl"));
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpl"));
return true;
}
}

View File

@ -16,7 +16,6 @@ public class Commandpanelsreload implements CommandExecutor {
@EventHandler
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 (sender.hasPermission("commandpanel.reload")) {
plugin.reloadPanelFiles();
@ -28,14 +27,14 @@ public class Commandpanelsreload implements CommandExecutor {
//check for duplicates
plugin.checkDuplicatePanel(sender);
tag = plugin.config.getString("config.format.tag") + " ";
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.reload")));
plugin.tag = plugin.papi(plugin.config.getString("config.format.tag") + " ");
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.reload")));
}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;
}
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpr"));
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpr"));
return true;
}
}

View File

@ -13,23 +13,22 @@ public class Commandpanelversion implements CommandExecutor {
@EventHandler
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 (sender.hasPermission("commandpanel.version")) {
//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 + "Latest Version " + ChatColor.GRAY + plugin.updater.githubNewUpdate(false));
sender.sendMessage(ChatColor.GRAY + "-------------------");
sender.sendMessage(ChatColor.GREEN + "Developer " + ChatColor.GRAY + "RockyHawk");
sender.sendMessage(ChatColor.GREEN + "Command " + ChatColor.GRAY + "/cp");
}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;
}
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpv"));
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpv"));
return true;
}
}

View File

@ -18,9 +18,8 @@ public class Commandpanelsgenerate implements CommandExecutor {
@EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
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;
}
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");
p.openInventory(i);
} 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){
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;
}else if (args.length == 0) {
if (this.plugin.generateMode.contains(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 {
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;
}
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Usage: /cpg [rows]"));
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
return true;
}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;
}
}
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cpg [rows]"));
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
return true;
}
}

View File

@ -63,8 +63,6 @@ public class GenUtils implements Listener {
@SuppressWarnings("deprecation")
void generatePanel(Player p, Inventory inv){
ItemStack[] cont = inv.getContents();
String tag = plugin.config.getString("config.format.tag") + " ";
ArrayList<String> apanels = new ArrayList();
for(String[] panelNames : plugin.panelNames){
//create list of names that aren't a String list
@ -80,7 +78,7 @@ public class GenUtils implements Listener {
}
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
p.sendMessage(plugin.papi(tag + ChatColor.RED + "Cancelled Panel!"));
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Cancelled Panel!"));
return;
}
YamlConfiguration file;
@ -106,9 +104,9 @@ public class GenUtils implements Listener {
try {
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) {
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();
}

View File

@ -22,18 +22,17 @@ public class CpIngameEditCommand implements CommandExecutor {
@EventHandler
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String tag = plugin.config.getString("config.format.tag") + " ";
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;
}
if(Objects.requireNonNull(plugin.config.getString("config.ingame-editor")).equalsIgnoreCase("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;
}
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;
}
ConfigurationSection cf = null; //this is the file to use for any panel.* requests
@ -61,7 +60,7 @@ public class CpIngameEditCommand implements CommandExecutor {
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;
}
}

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){
String tag = plugin.config.getString("config.format.tag") + " ";
switch (section) {
case "panel.delete":
if (e.getMessage().contains("y")) {
if(Objects.requireNonNull(cfile.getConfigurationSection("panels")).getKeys(false).size() != 1){
//if the file has more than one panel in it
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{
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could Not Delete Panel!"));
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could Not Delete Panel!"));
}
}else {
//if the file only has one panel in it
if (panelFile.delete()) {
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Deleted Panel!"));
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Deleted Panel!"));
}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;
case "panel.perm":
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;
}
cf.set("perm", e.getMessage());
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;
case "panel.rows":
try {
int rows = Integer.parseInt(e.getMessage());
if (rows >= 7 || rows <= 0) {
//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;
}
cf.set("rows", rows);
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) {
plugin.debug(io);
}
break;
case "panel.title":
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;
}
cf.set("title", e.getMessage());
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;
case "panel.name":
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;
}
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;
}
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
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;
case "panel.empty":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("empty", null);
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;
}
String materialTemp = null;
try {
materialTemp = Objects.requireNonNull(Material.matchMaterial(e.getMessage())).toString();
}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);
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;
case "panel.sound-on-open":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("sound-on-open", null);
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;
}
String tempSound;
try {
tempSound = Sound.valueOf(e.getMessage()).toString();
}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;
}
cf.set("sound-on-open", tempSound);
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;
case "panel.panelType.add":
List<String> typeAdd = new ArrayList<>();
@ -229,20 +228,20 @@ public class EditorUserInput implements Listener {
typeAdd.add(e.getMessage().toLowerCase());
cf.set("panelType", typeAdd);
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;
case "panel.panelType.remove":
List<String> typeRemove;
if(cf.contains("panelType")){
typeRemove = cf.getStringList("panelType");
}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;
}
try {
typeRemove.remove(Integer.parseInt(e.getMessage())-1);
}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;
}
if(typeRemove.size() == 0){
@ -251,7 +250,7 @@ public class EditorUserInput implements Listener {
cf.set("panelType", typeRemove);
}
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;
case "panel.commands.add":
List<String> commandsAdd = new ArrayList<>();
@ -261,20 +260,20 @@ public class EditorUserInput implements Listener {
commandsAdd.add(e.getMessage());
cf.set("commands", commandsAdd);
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;
case "panel.commands.remove":
List<String> commandsRemove;
if(cf.contains("commands")){
commandsRemove = cf.getStringList("commands");
}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;
}
try {
commandsRemove.remove(Integer.parseInt(e.getMessage())-1);
}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;
}
if(commandsRemove.size() == 0){
@ -283,7 +282,7 @@ public class EditorUserInput implements Listener {
cf.set("commands", commandsRemove);
}
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;
case "panel.commands-on-open.add":
List<String> commandsOnOpenAdd = new ArrayList<>();
@ -293,20 +292,20 @@ public class EditorUserInput implements Listener {
commandsOnOpenAdd.add(e.getMessage());
cf.set("commands-on-open", commandsOnOpenAdd);
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;
case "panel.commands-on-open.remove":
List<String> commandsOnOpenRemove;
if(cf.contains("commands-on-open")){
commandsOnOpenRemove = cf.getStringList("commands-on-open");
}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;
}
try {
commandsOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1);
}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;
}
if(commandsOnOpenRemove.size() == 0){
@ -315,7 +314,7 @@ public class EditorUserInput implements Listener {
cf.set("commands-on-open", commandsOnOpenRemove);
}
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;
case "panel.disabled-worlds.add":
List<String> disabledWorldsAdd = new ArrayList<>();
@ -325,20 +324,20 @@ public class EditorUserInput implements Listener {
disabledWorldsAdd.add(e.getMessage());
cf.set("disabled-worlds", disabledWorldsAdd);
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;
case "panel.disabled-worlds.remove":
List<String> disabledWorldsRemove;
if(cf.contains("disabled-worlds")){
disabledWorldsRemove = cf.getStringList("disabled-worlds");
}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;
}
try {
disabledWorldsRemove.remove(Integer.parseInt(e.getMessage())-1);
}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;
}
if(disabledWorldsRemove.size() == 0){
@ -347,13 +346,13 @@ public class EditorUserInput implements Listener {
cf.set("disabled-worlds", disabledWorldsRemove);
}
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;
case "panel.hotbar.material":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("open-with-item", null);
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
plugin.reloadPanelFiles();
break;
@ -363,7 +362,7 @@ public class EditorUserInput implements Listener {
cf.set("open-with-item.name", panelName + " Item");
}
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
plugin.reloadPanelFiles();
break;
@ -371,17 +370,17 @@ public class EditorUserInput implements Listener {
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("open-with-item.stationary", null);
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;
}
try {
int loc = Integer.parseInt(e.getMessage());
if (loc >= 10 || loc <= 0) {
//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;
}
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
loc -= 1;
cf.set("open-with-item.stationary", loc);
@ -393,7 +392,7 @@ public class EditorUserInput implements Listener {
case "panel.hotbar.name":
cf.set("open-with-item.name",e.getMessage());
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;
case "panel.hotbar.lore.add":
List<String> loreAdd = new ArrayList<>();
@ -403,20 +402,20 @@ public class EditorUserInput implements Listener {
loreAdd.add(e.getMessage());
cf.set("open-with-item.lore", loreAdd);
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;
case "panel.hotbar.lore.remove":
List<String> loreRemove;
if(cf.contains("open-with-item.lore")){
loreRemove = cf.getStringList("open-with-item.lore");
}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;
}
try {
loreRemove.remove(Integer.parseInt(e.getMessage())-1);
}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;
}
if(loreRemove.size() == 0){
@ -425,7 +424,7 @@ public class EditorUserInput implements Listener {
cf.set("open-with-item.lore", loreRemove);
}
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;
}
}
@ -437,7 +436,6 @@ public class EditorUserInput implements Listener {
so using a different symbol will help to separate the section from
everything else
*/
String tag = plugin.config.getString("config.format.tag") + " ";
String itemSlot = section.split(":")[1];
String sectionChange = section.replace("item:" + itemSlot + ":","");
switch (sectionChange) {
@ -445,41 +443,41 @@ public class EditorUserInput implements Listener {
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".name", "");
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;
}
cf.set("item." + itemSlot + ".name", e.getMessage());
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;
case "head":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".material", plugin.getHeads.playerHeadString());
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;
}
cf.set("item." + itemSlot + ".material", e.getMessage());
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;
case "stack":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".stack", null);
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;
}
try {
int rows = Integer.parseInt(e.getMessage());
if (rows >= 65 || rows <= 0) {
//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;
}
cf.set("item." + itemSlot + ".stack", rows);
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) {
plugin.debug(io);
}
@ -488,45 +486,45 @@ public class EditorUserInput implements Listener {
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".enchanted", null);
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;
}
cf.set("item." + itemSlot + ".enchanted", e.getMessage());
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;
case "potion":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".potion", null);
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;
}
cf.set("item." + itemSlot + ".potion", e.getMessage());
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;
case "customdata":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".customdata", null);
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;
}
cf.set("item." + itemSlot + ".customdata", e.getMessage());
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;
case "leatherarmor":
if(e.getMessage().trim().equalsIgnoreCase("remove")){
cf.set("item." + itemSlot + ".leatherarmor", null);
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;
}
cf.set("item." + itemSlot + ".leatherarmor", e.getMessage());
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;
case "commands:add":
List<String> commandsOnOpenAdd = new ArrayList<>();
@ -536,20 +534,20 @@ public class EditorUserInput implements Listener {
commandsOnOpenAdd.add(e.getMessage());
cf.set("item." + itemSlot + ".commands", commandsOnOpenAdd);
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;
case "commands:remove":
List<String> commandsOnOpenRemove;
if(cf.contains("item." + itemSlot + ".commands")){
commandsOnOpenRemove = cf.getStringList("item." + itemSlot + ".commands");
}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;
}
try {
commandsOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1);
}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);
break;
}
@ -559,7 +557,7 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".commands", commandsOnOpenRemove);
}
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;
case "lore:add":
List<String> loreOnOpenAdd = new ArrayList<>();
@ -569,20 +567,20 @@ public class EditorUserInput implements Listener {
loreOnOpenAdd.add(e.getMessage());
cf.set("item." + itemSlot + ".lore", loreOnOpenAdd);
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;
case "lore:remove":
List<String> loreOnOpenRemove;
if(cf.contains("item." + itemSlot + ".lore")){
loreOnOpenRemove = cf.getStringList("item." + itemSlot + ".lore");
}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;
}
try {
loreOnOpenRemove.remove(Integer.parseInt(e.getMessage())-1);
}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);
break;
}
@ -592,7 +590,7 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".lore", loreOnOpenRemove);
}
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;
case "duplicate:add":
if(cf.contains("item." + itemSlot + ".duplicate")){
@ -601,7 +599,7 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".duplicate", e.getMessage());
}
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;
case "duplicate:remove":
if(cf.contains("item." + itemSlot + ".duplicate")){
@ -617,7 +615,7 @@ public class EditorUserInput implements Listener {
}
cf.set("item." + itemSlot + ".duplicate", items.toString());
} 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);
break;
}
@ -628,17 +626,16 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSlot + ".duplicate", null);
}
}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;
}
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;
}
}
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];
//section includes slot at front eg, 1.hasvalue
String itemSection = ChatColor.stripColor(section.replace("section." + secondValue + ".", ""));
@ -656,19 +653,19 @@ public class EditorUserInput implements Listener {
cf.set("item." + itemSection + "." + playerMessage + ".name", "");
savePanelFile(cf, cfile, panelName, panelFile);
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;
case "remove":
cf.set("item." + itemSection + "." + playerMessage, null);
savePanelFile(cf, cfile, panelName, panelFile);
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;
case "change":
cf.set("item." + itemSection + "." + playerMessage.split(":")[0], playerMessage.split(":")[1]);
savePanelFile(cf, cfile, panelName, panelFile);
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;
}
}

View File

@ -348,7 +348,6 @@ public class EditorUtils implements Listener {
@EventHandler
public void onPanelSettings(InventoryClickEvent e) {
Player p = (Player)e.getWhoClicked();
String tag = plugin.config.getString("config.format.tag") + " ";
try {
if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) {
return;
@ -392,52 +391,52 @@ public class EditorUtils implements Listener {
}
if(e.getSlot() == 1){
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();
}
if(e.getSlot() == 3){
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();
}
if(e.getSlot() == 5){
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();
}
if(e.getSlot() == 7){
if(e.getClick().isLeftClick()) {
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{
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();
}
if(e.getSlot() == 21){
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();
}
if(e.getSlot() == 23){
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();
}
if(e.getSlot() == 13){
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();
}
if(e.getSlot() == 15){
//adds abilities to add and remove lines
if(e.getClick().isLeftClick()) {
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{
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();
}
@ -445,10 +444,10 @@ public class EditorUtils implements Listener {
//adds abilities to add and remove types
if(e.getClick().isLeftClick()) {
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{
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();
}
@ -456,16 +455,16 @@ public class EditorUtils implements Listener {
//adds abilities to add and remove lines
if(e.getClick().isLeftClick()) {
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{
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();
}
if(e.getSlot() == 11){
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();
}
if(e.getSlot() == 18){
@ -474,28 +473,28 @@ public class EditorUtils implements Listener {
}
if(e.getSlot() == 40){
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();
}
if(e.getSlot() == 38 && hotbarItems){
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();
}
if(e.getSlot() == 36 && hotbarItems){
//adds abilities to add and remove lines
if(e.getClick().isLeftClick()) {
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{
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();
}
if(e.getSlot() == 42 && hotbarItems){
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();
}
}
@ -503,7 +502,6 @@ public class EditorUtils implements Listener {
@EventHandler
public void onItemSettings(InventoryClickEvent e) {
Player p = (Player)e.getWhoClicked();
String tag = plugin.config.getString("config.format.tag") + " ";
try {
if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) {
return;
@ -556,38 +554,38 @@ public class EditorUtils implements Listener {
}
if(e.getSlot() == 1){
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();
}
if(e.getSlot() == 3){
//adds abilities to add and remove lines
if(e.getClick().isLeftClick()) {
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{
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();
}
if(e.getSlot() == 5){
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();
}
if(e.getSlot() == 7){
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();
}
if(e.getSlot() == 13){
//adds abilities to add and remove items
if(e.getClick().isLeftClick()) {
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{
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();
}
@ -595,26 +593,26 @@ public class EditorUtils implements Listener {
//adds abilities to add and remove lines
if(e.getClick().isLeftClick()) {
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{
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();
}
if(e.getSlot() == 21){
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();
}
if(e.getSlot() == 23){
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();
}
if(e.getSlot() == 25){
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();
}
if(e.getSlot() == 31){
@ -624,7 +622,7 @@ public class EditorUtils implements Listener {
}
if(e.getSlot() == 35){
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();
}
if(e.getSlot() == 27){
@ -642,7 +640,6 @@ public class EditorUtils implements Listener {
@EventHandler
public void onItemSection(InventoryClickEvent e) {
Player p = (Player)e.getWhoClicked();
String tag = plugin.config.getString("config.format.tag") + " ";
try {
if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) {
return;
@ -708,7 +705,7 @@ public class EditorUtils implements Listener {
}else{
String itemNameSection = "." + ChatColor.stripColor(e.getInventory().getItem(e.getSlot()).getItemMeta().getDisplayName());
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();
}
}
@ -716,13 +713,13 @@ public class EditorUtils implements Listener {
if(e.getSlot() == 38){
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();
}
if(e.getSlot() == 42){
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();
}
@ -768,7 +765,6 @@ public class EditorUtils implements Listener {
@SuppressWarnings("deprecation")
public void onEditPanelClose(Player p, Inventory inv, InventoryView invView) {
String tag = plugin.config.getString("config.format.tag") + " ";
if(inv.getType() != InventoryType.CHEST){
return;
}
@ -810,9 +806,9 @@ public class EditorUtils implements Listener {
file = plugin.itemCreate.generatePanelFile(panelName,inv,file);
try {
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) {
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.reloadPanelFiles();

View File

@ -20,7 +20,6 @@ public class OpenGUI {
@SuppressWarnings("deprecation")
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) {
Inventory i;
if (onOpen != 3) {
@ -99,7 +98,7 @@ public class OpenGUI {
} catch (ArrayIndexOutOfBoundsException var24) {
plugin.debug(var24);
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();
plugin.openPanels.closePanelForLoader(p.getName(),panels);
}
@ -131,7 +130,7 @@ public class OpenGUI {
}
} catch (IllegalArgumentException | NullPointerException 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();
plugin.openPanels.closePanelForLoader(p.getName(),panels);
return null;
@ -162,7 +161,7 @@ public class OpenGUI {
}
return i;
} 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();
plugin.openPanels.closePanelForLoader(p.getName(),panels);
return null;

View File

@ -21,18 +21,17 @@ public class Commandpanelblocks implements CommandExecutor {
@EventHandler
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(args.length == 2) {
if (args[0].equalsIgnoreCase("add")) {
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;
}
Player p = (Player)sender;
if(p.hasPermission("commandpanel.block.add")){
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;
}
boolean foundPanel = false;
@ -43,12 +42,12 @@ public class Commandpanelblocks implements CommandExecutor {
}
}
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;
}
Block blockType = p.getTargetBlock(null, 5);
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;
}
Location blockLocation = blockType.getLocation();
@ -58,16 +57,16 @@ public class Commandpanelblocks implements CommandExecutor {
plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));
} catch (IOException 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;
}
//make the material name look okay
String materialNameFormatted = blockType.getType().toString().substring(0, 1).toUpperCase() + blockType.getType().toString().substring(1).toLowerCase();
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;
}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;
}
}
@ -75,13 +74,13 @@ public class Commandpanelblocks implements CommandExecutor {
if(args.length == 1){
if (args[0].equalsIgnoreCase("remove")) {
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;
}
Player p = (Player)sender;
if(p.hasPermission("commandpanel.block.remove")){
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;
}
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"));
} catch (IOException 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;
}
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{
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;
}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;
}
}
if (args[0].equalsIgnoreCase("list")) {
if(sender.hasPermission("commandpanel.block.list")){
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;
}
if(plugin.blockConfig.contains("blocks")){
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;
}
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)) {
sender.sendMessage(ChatColor.GREEN + location.replaceAll("_"," ") + ": " + ChatColor.WHITE + plugin.blockConfig.getString("blocks." + location + ".panel"));
}
}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;
}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;
}
}