forked from Upstream/CommandPanels
3.15.4.0
This commit is contained in:
parent
b26a880b00
commit
1a42ecfb02
@ -1,4 +1,4 @@
|
||||
version: 3.15.3.1
|
||||
version: 3.15.4.0
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
@ -7,14 +7,14 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.rockyhawk.commandpanels.api.CommandPanelsAPI;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import me.rockyhawk.commandpanels.classresources.*;
|
||||
import me.rockyhawk.commandpanels.classresources.item_fall.ItemFallManager;
|
||||
import me.rockyhawk.commandpanels.classresources.placeholders.CreateText;
|
||||
import me.rockyhawk.commandpanels.classresources.placeholders.Placeholders;
|
||||
import me.rockyhawk.commandpanels.commands.*;
|
||||
import me.rockyhawk.commandpanels.completetabs.CpTabComplete;
|
||||
import me.rockyhawk.commandpanels.customcommands.CommandPlaceholderLoader;
|
||||
import me.rockyhawk.commandpanels.customcommands.Commandpanelcustom;
|
||||
import me.rockyhawk.commandpanels.datamanager.DebugManager;
|
||||
import me.rockyhawk.commandpanels.datamanager.PanelDataLoader;
|
||||
@ -75,6 +75,7 @@ public class CommandPanels extends JavaPlugin{
|
||||
public PanelDataLoader panelData = new PanelDataLoader(this);
|
||||
public Placeholders placeholders = new Placeholders(this);
|
||||
public DebugManager debug = new DebugManager(this);
|
||||
public CreateText tex = new CreateText(this);
|
||||
|
||||
public OpenEditorGuis editorGuis = new OpenEditorGuis(this);
|
||||
public ExecuteOpenVoids openVoids = new ExecuteOpenVoids(this);
|
||||
@ -87,7 +88,6 @@ public class CommandPanels extends JavaPlugin{
|
||||
public OpenPanelsLoader openPanels = new OpenPanelsLoader(this);
|
||||
public OpenGUI createGUI = new OpenGUI(this);
|
||||
public PanelPermissions panelPerms = new PanelPermissions(this);
|
||||
public CommandPlaceholderLoader customCommand = new CommandPlaceholderLoader(this);
|
||||
public HotbarItemLoader hotbar = new HotbarItemLoader(this);
|
||||
|
||||
public File panelsf;
|
||||
@ -221,7 +221,10 @@ public class CommandPanels extends JavaPlugin{
|
||||
}));
|
||||
|
||||
//get tag
|
||||
tag = papi(config.getString("config.format.tag") + " ");
|
||||
tag = tex.papi(config.getString("config.format.tag") + " ");
|
||||
|
||||
//set version to latest version
|
||||
updater.githubNewUpdate(false);
|
||||
|
||||
Bukkit.getLogger().info("[CommandPanels] RockyHawk's CommandPanels v" + this.getDescription().getVersion() + " Plugin Loaded!");
|
||||
}
|
||||
@ -238,15 +241,15 @@ public class CommandPanels extends JavaPlugin{
|
||||
return new CommandPanelsAPI(JavaPlugin.getPlugin(CommandPanels.class));
|
||||
}
|
||||
|
||||
public void setName(ItemStack renamed, String customName, List<String> lore, Player p, Boolean usePlaceholders, Boolean useColours, Boolean hideAttributes) {
|
||||
public void setName(Panel panel, ItemStack renamed, String customName, List<String> lore, Player p, Boolean usePlaceholders, Boolean useColours, Boolean hideAttributes) {
|
||||
try {
|
||||
ItemMeta renamedMeta = renamed.getItemMeta();
|
||||
//set cp placeholders
|
||||
if(usePlaceholders){
|
||||
customName = papiNoColour(p,customName);
|
||||
customName = tex.papiNoColour(panel,p,customName);
|
||||
}
|
||||
if(useColours){
|
||||
customName = papi(customName);
|
||||
customName = tex.papi(customName);
|
||||
}
|
||||
|
||||
assert renamedMeta != null;
|
||||
@ -261,11 +264,11 @@ public class CommandPanels extends JavaPlugin{
|
||||
List<String> clore;
|
||||
if (lore != null) {
|
||||
if(usePlaceholders && useColours){
|
||||
clore = papi(p, lore, true);
|
||||
clore = tex.papi(panel, p, lore, true);
|
||||
}else if(usePlaceholders){
|
||||
clore = papiNoColour(p, lore);
|
||||
clore = tex.papiNoColour(panel,p, lore);
|
||||
}else if(useColours){
|
||||
clore = papi(p, lore, false);
|
||||
clore = tex.papi(panel, p, lore, false);
|
||||
}else{
|
||||
clore = lore;
|
||||
}
|
||||
@ -296,94 +299,6 @@ public class CommandPanels extends JavaPlugin{
|
||||
}
|
||||
}
|
||||
|
||||
//regular string papi
|
||||
public String papi(Player p, String setpapi) {
|
||||
try {
|
||||
setpapi = placeholders.setCpPlaceholders(p,setpapi);
|
||||
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
setpapi = translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', setpapi));
|
||||
return setpapi;
|
||||
}catch(NullPointerException e){
|
||||
return setpapi;
|
||||
}
|
||||
}
|
||||
|
||||
//string papi with no colours
|
||||
public String papiNoColour(Player p, String setpapi) {
|
||||
try {
|
||||
setpapi = placeholders.setCpPlaceholders(p,setpapi);
|
||||
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
return setpapi;
|
||||
}catch(NullPointerException e){
|
||||
return setpapi;
|
||||
}
|
||||
}
|
||||
|
||||
//regular string papi, but only colours so Player doesn't need to be there
|
||||
public String papi(String setpapi) {
|
||||
try {
|
||||
setpapi = translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', setpapi));
|
||||
return setpapi;
|
||||
}catch(NullPointerException e){
|
||||
return setpapi;
|
||||
}
|
||||
}
|
||||
|
||||
//papi except if it is a String List
|
||||
public List<String> papi(Player p, List<String> setpapi, boolean placeholder) {
|
||||
try {
|
||||
if(placeholder) {
|
||||
int tempInt = 0;
|
||||
for (String temp : setpapi) {
|
||||
setpapi.set(tempInt, placeholders.setCpPlaceholders(p, temp));
|
||||
tempInt += 1;
|
||||
}
|
||||
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
}
|
||||
}catch(Exception ignore){
|
||||
//this will be ignored as it is probably a null
|
||||
return null;
|
||||
}
|
||||
int tempInt = 0;
|
||||
//change colour
|
||||
for(String temp : setpapi){
|
||||
try {
|
||||
setpapi.set(tempInt, translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', temp)));
|
||||
}catch(NullPointerException ignore){
|
||||
}
|
||||
tempInt += 1;
|
||||
}
|
||||
return setpapi;
|
||||
}
|
||||
|
||||
//papi except if it is a String List
|
||||
public List<String> papiNoColour(Player p, List<String> setpapi) {
|
||||
try {
|
||||
int tempInt = 0;
|
||||
for (String temp : setpapi) {
|
||||
setpapi.set(tempInt, placeholders.setCpPlaceholders(p, temp));
|
||||
tempInt += 1;
|
||||
}
|
||||
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
}catch(Exception ignore){
|
||||
//this will be ignored as it is probably a null
|
||||
return null;
|
||||
}
|
||||
return setpapi;
|
||||
}
|
||||
|
||||
//check for duplicate panel names
|
||||
public boolean checkDuplicatePanel(CommandSender sender){
|
||||
ArrayList<String> apanels = new ArrayList<>();
|
||||
@ -398,7 +313,7 @@ public class CommandPanels extends JavaPlugin{
|
||||
ArrayList<String> opanelsTemp = new ArrayList<String>();
|
||||
for(String tempName : apanels){
|
||||
if(opanelsTemp.contains(tempName)){
|
||||
sender.sendMessage(papi(tag) + ChatColor.RED + " Error duplicate panel name: " + tempName);
|
||||
sender.sendMessage(tex.papi(tag) + ChatColor.RED + " Error duplicate panel name: " + tempName);
|
||||
return false;
|
||||
}
|
||||
opanelsTemp.add(tempName);
|
||||
@ -462,7 +377,7 @@ public class CommandPanels extends JavaPlugin{
|
||||
}
|
||||
|
||||
public void helpMessage(CommandSender p) {
|
||||
p.sendMessage(papi( tag + ChatColor.GREEN + "Commands:"));
|
||||
p.sendMessage(tex.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")) {
|
||||
p.sendMessage(ChatColor.GOLD + "/cpr " + ChatColor.WHITE + "Reloads plugin config.");
|
||||
|
@ -59,7 +59,7 @@ public class Utils implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String section = plugin.itemCreate.hasSection(panel.getConfig().getConfigurationSection("item." + e.getSlot()), p);
|
||||
String section = plugin.itemCreate.hasSection(panel,panel.getConfig().getConfigurationSection("item." + e.getSlot()), p);
|
||||
|
||||
if(panel.getConfig().contains("item." + e.getSlot() + section + ".itemType")){
|
||||
if(panel.getConfig().getStringList("item." + e.getSlot() + section + ".itemType").contains("placeable")){
|
||||
@ -153,10 +153,10 @@ public class Utils implements Listener {
|
||||
String command;
|
||||
if(commands.get(i).split("\\s")[0].equalsIgnoreCase("nopapi=")){
|
||||
//won't parse PAPI placeholders
|
||||
command = plugin.papi(plugin.placeholders.setCpPlaceholders(p,commands.get(i))).replace("nopapi=","").trim();
|
||||
command = plugin.tex.papi(plugin.placeholders.setCpPlaceholders(panel,p,commands.get(i))).replace("nopapi=","").trim();
|
||||
}else{
|
||||
//will parse every placeholder
|
||||
command = plugin.papi(p,commands.get(i));
|
||||
command = plugin.tex.papi(panel,p,commands.get(i));
|
||||
}
|
||||
|
||||
int val = plugin.commandTags.commandPayWall(p,command);
|
||||
@ -164,7 +164,7 @@ public class Utils implements Listener {
|
||||
return;
|
||||
}
|
||||
if(val == 2){
|
||||
plugin.commandTags.commandTags(p, command, commands.get(i));
|
||||
plugin.commandTags.commandTags(panel, p, command, commands.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class CommandPanelsAPI {
|
||||
|
||||
//make custom item using items section
|
||||
public ItemStack makeItem(Player p, ConfigurationSection itemSection){
|
||||
return plugin.itemCreate.makeCustomItemFromConfig(itemSection, p, true, true, false);
|
||||
return plugin.itemCreate.makeCustomItemFromConfig(null,itemSection, p, true, true, false);
|
||||
}
|
||||
|
||||
//will return item slots of hotbar stationary items
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.rockyhawk.commandpanels.api;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.customcommands.PanelPlaceholders;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,6 +18,7 @@ public class Panel{
|
||||
private ConfigurationSection panelConfig;
|
||||
private String panelName;
|
||||
private File panelFile;
|
||||
public PanelPlaceholders placeholders = new PanelPlaceholders();
|
||||
|
||||
//make the object, using a file is recommended
|
||||
public Panel(File file, String name){
|
||||
@ -67,17 +69,17 @@ public class Panel{
|
||||
|
||||
public ItemStack getItem(Player p, int slot){
|
||||
ConfigurationSection itemSection = panelConfig.getConfigurationSection("item." + slot);
|
||||
return plugin.itemCreate.makeItemFromConfig(itemSection, p, true, true, false);
|
||||
return plugin.itemCreate.makeItemFromConfig(this,itemSection, p, true, true, false);
|
||||
}
|
||||
|
||||
public ItemStack getCustomItem(Player p, String itemName){
|
||||
ConfigurationSection itemSection = panelConfig.getConfigurationSection("custom-item." + itemName);
|
||||
return plugin.itemCreate.makeCustomItemFromConfig(itemSection, p, true, true, false);
|
||||
return plugin.itemCreate.makeCustomItemFromConfig(this,itemSection, p, true, true, false);
|
||||
}
|
||||
|
||||
public ItemStack getHotbarItem(Player p){
|
||||
ConfigurationSection itemSection = panelConfig.getConfigurationSection("open-with-item");
|
||||
return plugin.itemCreate.makeItemFromConfig(itemSection, p, true, true, false);
|
||||
return plugin.itemCreate.makeItemFromConfig(this,itemSection, p, true, true, false);
|
||||
}
|
||||
|
||||
public boolean hasHotbarItem(){
|
||||
@ -96,4 +98,12 @@ public class Panel{
|
||||
}
|
||||
plugin.openVoids.openCommandPanel(p, p, this, false);
|
||||
}
|
||||
|
||||
//create blank clone
|
||||
public Panel copy(){
|
||||
if(panelFile != null){
|
||||
return new Panel(panelFile, panelName);
|
||||
}
|
||||
return new Panel(panelConfig, panelName);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -25,7 +24,7 @@ public class CommandTags {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void commandTags(Player p, String command, String commandRAW) {
|
||||
public void commandTags(Panel panel, Player p, String command, String commandRAW) {
|
||||
//commandRAW is without placeholders
|
||||
switch(command.split("\\s")[0]){
|
||||
case "server=":{
|
||||
@ -51,29 +50,29 @@ public class CommandTags {
|
||||
}
|
||||
case "set-data=":{
|
||||
if(command.split("\\s").length == 4){
|
||||
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],command.split("\\s")[2],true);
|
||||
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],plugin.tex.papiNoColour(panel,p,command.split("\\s")[2]),true);
|
||||
break;
|
||||
}
|
||||
//this will overwrite data. set-data= [data point] [data value] [optional player]
|
||||
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2],true);
|
||||
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],plugin.tex.papiNoColour(panel,p,command.split("\\s")[2]),true);
|
||||
break;
|
||||
}
|
||||
case "add-data=":{
|
||||
if(command.split("\\s").length == 4){
|
||||
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],command.split("\\s")[2],false);
|
||||
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],plugin.tex.papiNoColour(panel,p,command.split("\\s")[2]),false);
|
||||
break;
|
||||
}
|
||||
//this will not overwrite existing data. add-data= [data point] [data value] [optional player]
|
||||
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2],false);
|
||||
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],plugin.tex.papiNoColour(panel,p,command.split("\\s")[2]),false);
|
||||
break;
|
||||
}
|
||||
case "math-data=":{
|
||||
if(command.split("\\s").length == 4){
|
||||
plugin.panelData.doDataMath(getOffline(command.split("\\s")[3]),command.split("\\s")[1],command.split("\\s")[2]);
|
||||
plugin.panelData.doDataMath(getOffline(command.split("\\s")[3]),command.split("\\s")[1],plugin.tex.papiNoColour(panel,p,command.split("\\s")[2]));
|
||||
break;
|
||||
}
|
||||
//only works if data is number, goes math-data= [data point] [operator:number] [optional player] eg, math-data= -1 OR /3
|
||||
plugin.panelData.doDataMath(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2]);
|
||||
plugin.panelData.doDataMath(p.getUniqueId(),command.split("\\s")[1],plugin.tex.papiNoColour(panel,p,command.split("\\s")[2]));
|
||||
break;
|
||||
}
|
||||
case "clear-data=":{
|
||||
@ -92,7 +91,7 @@ public class CommandTags {
|
||||
}
|
||||
case "give-item=":{
|
||||
//this will remove data. give-item= [custom item].
|
||||
ItemStack itm = plugin.itemCreate.makeCustomItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, false);
|
||||
ItemStack itm = plugin.itemCreate.makeCustomItemFromConfig(null,plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, false);
|
||||
p.getInventory().addItem(itm);
|
||||
break;
|
||||
}
|
||||
@ -100,7 +99,17 @@ public class CommandTags {
|
||||
//if player uses open= it will open the panel, with the option to add custom placeholders
|
||||
String panelName = commandRAW.split("\\s")[1];
|
||||
String cmd = commandRAW.replace("open= " + panelName,"");
|
||||
panelName = plugin.papi(p,panelName);
|
||||
panelName = plugin.tex.papi(panel,p,panelName);
|
||||
|
||||
Panel openPanel = null;
|
||||
for(Panel pane : plugin.panelList){
|
||||
if(pane.getName().equals(panelName)){
|
||||
openPanel = pane.copy();
|
||||
}
|
||||
}
|
||||
if(openPanel == null){
|
||||
break;
|
||||
}
|
||||
|
||||
Character[] cm = ArrayUtils.toObject(cmd.toCharArray());
|
||||
for(int i = 0; i < cm.length; i++){
|
||||
@ -109,18 +118,12 @@ public class CommandTags {
|
||||
//do not change the placeholder
|
||||
String placeholder = contents.substring(0,contents.indexOf(':'));
|
||||
//only convert placeholders for the value
|
||||
String value = plugin.papi(p,contents.substring(contents.indexOf(':')+1));
|
||||
plugin.customCommand.addCCP(panelName,p.getName(),placeholder,value);
|
||||
String value = plugin.tex.papi(openPanel,p,contents.substring(contents.indexOf(':')+1));
|
||||
openPanel.placeholders.addPlaceholder(placeholder,value);
|
||||
i = i+contents.length()-1;
|
||||
}
|
||||
}
|
||||
|
||||
for(Panel panel : plugin.panelList){
|
||||
if(panel.getName().equals(panelName)){
|
||||
panel.open(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
openPanel.open(p);
|
||||
break;
|
||||
}
|
||||
case "console=":{
|
||||
@ -129,13 +132,14 @@ public class CommandTags {
|
||||
break;
|
||||
}
|
||||
case "placeholder=":{
|
||||
//if player uses placeholder= it will only change the placeholders for the panel
|
||||
String panelName = plugin.openPanels.getOpenPanelName(p.getName());
|
||||
|
||||
//placeholder is now placeholder= [place]. Not placeholder= panel [place] which is why this is here
|
||||
//placeholder is now placeholder= [place] [value]
|
||||
String cmd;
|
||||
cmd = commandRAW.replace("placeholder= ","");
|
||||
|
||||
if(panel == null){
|
||||
break;
|
||||
}
|
||||
|
||||
Character[] cm = ArrayUtils.toObject(cmd.toCharArray());
|
||||
for(int i = 0; i < cm.length; i++){
|
||||
if(cm[i].equals('[')){
|
||||
@ -143,8 +147,8 @@ public class CommandTags {
|
||||
//do not change the placeholder
|
||||
String placeholder = contents.substring(0,contents.indexOf(':'));
|
||||
//only convert placeholders for the value
|
||||
String value = plugin.papi(p,contents.substring(contents.indexOf(':')+1));
|
||||
plugin.customCommand.editCCP(panelName,p.getName(),placeholder,value);
|
||||
String value = plugin.tex.papi(panel,p,contents.substring(contents.indexOf(':')+1));
|
||||
panel.placeholders.addPlaceholder(placeholder,value);
|
||||
i = i+contents.length()-1;
|
||||
}
|
||||
}
|
||||
@ -154,7 +158,7 @@ public class CommandTags {
|
||||
//if player uses setitem= [custom item] [slot] it will change the item slot to something, used for placeable items
|
||||
//make a section in the panel called "custom-item" then whatever the title of the item is, put that here
|
||||
ConfigurationSection panelCF = plugin.openPanels.getOpenPanel(p.getName()).getConfig();
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(panelCF.getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, true);
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(null,panelCF.getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, true);
|
||||
p.getOpenInventory().getTopInventory().setItem(Integer.parseInt(command.split("\\s")[2]), s);
|
||||
break;
|
||||
}
|
||||
@ -173,7 +177,7 @@ public class CommandTags {
|
||||
} catch (Exception exc) {
|
||||
p.setOp(isop);
|
||||
plugin.debug(exc,p);
|
||||
p.sendMessage(plugin.tag + plugin.papi( plugin.config.getString("config.format.error") + " op=: Error in op command!"));
|
||||
p.sendMessage(plugin.tag + plugin.tex.papi( plugin.config.getString("config.format.error") + " op=: Error in op command!"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -185,7 +189,7 @@ public class CommandTags {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
commandTags(p, finalCommand, commandRAW);
|
||||
commandTags(panel, p, finalCommand, commandRAW);
|
||||
}catch (Exception ex){
|
||||
//if there are any errors, cancel so that it doesn't loop errors
|
||||
plugin.debug(ex,p);
|
||||
@ -202,7 +206,7 @@ public class CommandTags {
|
||||
if (plugin.econ != null) {
|
||||
if (plugin.econ.getBalance(p) >= Double.parseDouble(command.split("\\s")[1])) {
|
||||
plugin.econ.withdrawPlayer(p, Double.parseDouble(command.split("\\s")[1]));
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.currency.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.currency.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
//legacy ID
|
||||
byte id = 0;
|
||||
if(plugin.legacy.isLegacy()) {
|
||||
@ -219,14 +223,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( plugin.tag + plugin.config.getString("purchase.currency.failure")));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + plugin.config.getString("purchase.currency.failure")));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
}
|
||||
} catch (Exception buy) {
|
||||
plugin.debug(buy,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -239,7 +243,7 @@ public class CommandTags {
|
||||
int balance = Integer.parseInt(Long.toString(api.getTokens(p).orElse(0)));
|
||||
if (balance >= Double.parseDouble(command.split("\\s")[1])) {
|
||||
api.removeTokens(p, Long.parseLong(command.split("\\s")[1]));
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.tokens.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.tokens.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
//legacy ID
|
||||
byte id = 0;
|
||||
if(plugin.legacy.isLegacy()) {
|
||||
@ -256,14 +260,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( plugin.tag + plugin.config.getString("purchase.tokens.failure")));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + plugin.config.getString("purchase.tokens.failure")));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires TokenManager to work!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Buying Requires TokenManager to work!"));
|
||||
}
|
||||
} catch (Exception buy) {
|
||||
plugin.debug(buy,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -323,16 +327,16 @@ public class CommandTags {
|
||||
}
|
||||
}
|
||||
if (!sold) {
|
||||
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("purchase.item.failure")));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + plugin.config.getString("purchase.item.failure")));
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%", command.split("\\s")[2])));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%", command.split("\\s")[2])));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Selling Requires Vault and an Economy to work!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Selling Requires Vault and an Economy to work!"));
|
||||
}
|
||||
} catch (Exception sell) {
|
||||
plugin.debug(sell,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -368,7 +372,7 @@ public class CommandTags {
|
||||
PotionMeta potionMeta = (PotionMeta) itm.getItemMeta();
|
||||
assert potionMeta != null;
|
||||
if (!potionMeta.getBasePotionData().getType().name().equalsIgnoreCase(potion)) {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Your item has the wrong potion effect"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Your item has the wrong potion effect"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -395,16 +399,16 @@ public class CommandTags {
|
||||
}
|
||||
}
|
||||
if (!sold) {
|
||||
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("purchase.item.failure")));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + plugin.config.getString("purchase.item.failure")));
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%", command.split("\\s")[2])));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%", command.split("\\s")[2])));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Selling Requires TokenManager to work!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Selling Requires TokenManager to work!"));
|
||||
}
|
||||
} catch (Exception sell) {
|
||||
plugin.debug(sell,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -419,7 +423,7 @@ public class CommandTags {
|
||||
p.playSound(p.getLocation(), Sound.valueOf(command.split("\\s")[1]), 1F, 1F);
|
||||
} catch (Exception s) {
|
||||
plugin.debug(s,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -434,17 +438,17 @@ public class CommandTags {
|
||||
commandp = commandp.replace("buycommand=", "").trim();
|
||||
String price = commandp.split(" ", 2)[0];
|
||||
commandp = commandp.split(" ", 2)[1];
|
||||
commandTags(p,commandp,commandRAW);
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.currency.success")).replaceAll("%cp-args%", price)));
|
||||
commandTags(panel,p,commandp,commandRAW);
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.currency.success")).replaceAll("%cp-args%", price)));
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("purchase.currency.failure")));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + plugin.config.getString("purchase.currency.failure")));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -462,17 +466,17 @@ public class CommandTags {
|
||||
commandp = commandp.replace("tokenbuycommand=", "").trim();
|
||||
String price = commandp.split(" ", 2)[0];
|
||||
commandp = commandp.split(" ", 2)[1];
|
||||
commandTags(p,commandp,commandRAW);
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.token.success")).replaceAll("%cp-args%", price)));
|
||||
commandTags(panel,p,commandp,commandRAW);
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("purchase.token.success")).replaceAll("%cp-args%", price)));
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("purchase.token.failure")));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + plugin.config.getString("purchase.token.failure")));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -523,7 +527,7 @@ public class CommandTags {
|
||||
p.stopSound(Sound.valueOf(command.split("\\s")[1]));
|
||||
} catch (Exception ss) {
|
||||
plugin.debug(ss,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -548,19 +552,19 @@ public class CommandTags {
|
||||
if (plugin.econ != null) {
|
||||
if (plugin.econ.getBalance(p) >= Double.parseDouble(command.split("\\s")[1])) {
|
||||
plugin.econ.withdrawPlayer(p, Double.parseDouble(command.split("\\s")[1]));
|
||||
p.sendMessage(plugin.papi(Objects.requireNonNull(plugin.config.getString("purchase.currency.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
p.sendMessage(plugin.tex.papi(Objects.requireNonNull(plugin.config.getString("purchase.currency.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
return 1;
|
||||
} else {
|
||||
p.sendMessage(plugin.papi(plugin.config.getString("purchase.currency.failure")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.config.getString("purchase.currency.failure")));
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Paying Requires Vault and an Economy to work!"));
|
||||
p.sendMessage(plugin.tex.papi( tag + ChatColor.RED + "Paying Requires Vault and an Economy to work!"));
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc,p);
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -574,19 +578,19 @@ public class CommandTags {
|
||||
if (balance >= Double.parseDouble(command.split("\\s")[1])) {
|
||||
api.removeTokens(p, Long.parseLong(command.split("\\s")[1]));
|
||||
//if the message is empty don't send
|
||||
p.sendMessage(plugin.papi(Objects.requireNonNull(plugin.config.getString("purchase.tokens.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
p.sendMessage(plugin.tex.papi(Objects.requireNonNull(plugin.config.getString("purchase.tokens.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
return 1;
|
||||
} else {
|
||||
p.sendMessage(plugin.papi(plugin.config.getString("purchase.tokens.failure")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.config.getString("purchase.tokens.failure")));
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Needs TokenManager to work!"));
|
||||
p.sendMessage(plugin.tex.papi( tag + ChatColor.RED + "Needs TokenManager to work!"));
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc,p);
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -602,7 +606,7 @@ public class CommandTags {
|
||||
//create the item to be removed
|
||||
ItemStack sellItem;
|
||||
if(command.split("\\s").length == 2) {
|
||||
sellItem = plugin.itemCreate.makeCustomItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, false);
|
||||
sellItem = plugin.itemCreate.makeCustomItemFromConfig(null,plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + command.split("\\s")[1]), p, true, true, false);
|
||||
}else{
|
||||
sellItem = new ItemStack(Objects.requireNonNull(Material.matchMaterial(command.split("\\s")[1])), Integer.parseInt(command.split("\\s")[2]), id);
|
||||
}
|
||||
@ -659,14 +663,14 @@ public class CommandTags {
|
||||
|
||||
//send message and return
|
||||
if(removedItem == 0){
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("purchase.item.failure")));
|
||||
p.sendMessage(plugin.tex.papi( tag + plugin.config.getString("purchase.item.failure")));
|
||||
}else{
|
||||
p.sendMessage(plugin.papi(Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%",sellItem.getType().toString())));
|
||||
p.sendMessage(plugin.tex.papi(Objects.requireNonNull(plugin.config.getString("purchase.item.success")).replaceAll("%cp-args%",sellItem.getType().toString())));
|
||||
}
|
||||
return removedItem;
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc,p);
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -677,15 +681,15 @@ public class CommandTags {
|
||||
if (balance >= Integer.parseInt(command.split("\\s")[1])) {
|
||||
p.setLevel(p.getLevel() - Integer.parseInt(command.split("\\s")[1]));
|
||||
//if the message is empty don't send
|
||||
p.sendMessage(plugin.papi(Objects.requireNonNull(plugin.config.getString("purchase.xp.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
p.sendMessage(plugin.tex.papi(Objects.requireNonNull(plugin.config.getString("purchase.xp.success")).replaceAll("%cp-args%", command.split("\\s")[1])));
|
||||
return 1;
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.config.getString("purchase.xp.failure")));
|
||||
p.sendMessage(plugin.tex.papi( plugin.config.getString("purchase.xp.failure")));
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc,p);
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
p.sendMessage(plugin.tex.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -33,14 +33,14 @@ public class ExecuteOpenVoids {
|
||||
panel.setConfig(YamlConfiguration.loadConfiguration(panel.getFile()));
|
||||
}
|
||||
if (!sender.hasPermission("commandpanel.panel." + panel.getConfig().getString("perm"))) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
return;
|
||||
}
|
||||
//if the sender has OTHER perms, or if sendOpenedMessage is false, implying it is not for another person
|
||||
if(sender.hasPermission("commandpanel.other") || !openForOtherUser) {
|
||||
//check for disabled worlds
|
||||
if(!plugin.panelPerms.isPanelWorldEnabled(p,panel.getConfig())){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,27 +56,30 @@ public class ExecuteOpenVoids {
|
||||
return;
|
||||
}
|
||||
|
||||
//do these commands before the panel loads
|
||||
beforeLoadCommands(panel,p);
|
||||
|
||||
try {
|
||||
//create and open the GUI
|
||||
plugin.createGUI.openGui(panel, p,1,0);
|
||||
//open the panel
|
||||
plugin.openPanels.openPanelForLoader(p.getName(), panel);
|
||||
|
||||
//execute commands on panel open
|
||||
//execute commands once the panel opens
|
||||
if (panel.getConfig().contains("commands-on-open")) {
|
||||
try {
|
||||
List<String> commands = panel.getConfig().getStringList("commands-on-open");
|
||||
for (int i = 0; commands.size() - 1 >= i; i++) {
|
||||
int val = plugin.commandTags.commandPayWall(p,commands.get(i));
|
||||
if(val == 0){
|
||||
for (String command : commands) {
|
||||
int val = plugin.commandTags.commandPayWall(p, command);
|
||||
if (val == 0) {
|
||||
break;
|
||||
}
|
||||
if(val == 2){
|
||||
plugin.commandTags.commandTags(p, plugin.papi(p,commands.get(i)),commands.get(i));
|
||||
if (val == 2) {
|
||||
plugin.commandTags.commandTags(panel,p, plugin.tex.papi(panel,p, command), command);
|
||||
}
|
||||
}
|
||||
}catch(Exception s){
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands-on-open: " + panel.getConfig().getString("commands-on-open")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands-on-open: " + panel.getConfig().getString("commands-on-open")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,22 +89,22 @@ public class ExecuteOpenVoids {
|
||||
try {
|
||||
p.playSound(p.getLocation(), Sound.valueOf(Objects.requireNonNull(panel.getConfig().getString("sound-on-open")).toUpperCase()), 1F, 1F);
|
||||
} catch (Exception s) {
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "sound-on-open: " + panel.getConfig().getString("sound-on-open")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "sound-on-open: " + panel.getConfig().getString("sound-on-open")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(openForOtherUser) {
|
||||
sender.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Panel Opened for " + p.getDisplayName()));
|
||||
sender.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Panel Opened for " + p.getDisplayName()));
|
||||
}
|
||||
} catch (Exception r) {
|
||||
plugin.debug(r,null);
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error")));
|
||||
plugin.openPanels.closePanelForLoader(p.getName());
|
||||
p.closeInventory();
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,18 +113,18 @@ public class ExecuteOpenVoids {
|
||||
if (sender.hasPermission("commandpanel.item." + cf.getString("perm")) && cf.contains("open-with-item")) {
|
||||
//check for disabled worlds
|
||||
if(!plugin.panelPerms.isPanelWorldEnabled(p,cf)){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack s;
|
||||
try {
|
||||
s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(cf.getConfigurationSection("open-with-item")), p, false, true, false);
|
||||
s = plugin.itemCreate.makeItemFromConfig(null,Objects.requireNonNull(cf.getConfigurationSection("open-with-item")), p, false, true, false);
|
||||
}catch(Exception n){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " open-with-item: material"));
|
||||
sender.sendMessage(plugin.tex.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, true);
|
||||
plugin.setName(null,s, cf.getString("open-with-item.name"), cf.getStringList("open-with-item.lore"),p,false, true, true);
|
||||
//if the sender has OTHER perms, or if sendGiveMessage is false, implying it is not for another person
|
||||
if(sender.hasPermission("commandpanel.other") || !sendGiveMessage) {
|
||||
try {
|
||||
@ -131,20 +134,40 @@ public class ExecuteOpenVoids {
|
||||
p.getInventory().addItem(s);
|
||||
}
|
||||
if(sendGiveMessage) {
|
||||
sender.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Item Given to " + p.getDisplayName()));
|
||||
sender.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Item Given to " + p.getDisplayName()));
|
||||
}
|
||||
} catch (Exception r) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.notitem")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.notitem")));
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!cf.contains("open-with-item")) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.noitem")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.noitem")));
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
|
||||
public void beforeLoadCommands(Panel panel, Player p){
|
||||
if (panel.getConfig().contains("pre-load-commands")) {
|
||||
try {
|
||||
List<String> commands = panel.getConfig().getStringList("pre-load-commands");
|
||||
for (String command : commands) {
|
||||
int val = plugin.commandTags.commandPayWall(p, command);
|
||||
if (val == 0) {
|
||||
break;
|
||||
}
|
||||
if (val == 2) {
|
||||
plugin.commandTags.commandTags(panel,p, plugin.tex.papi(panel,p, command), command);
|
||||
}
|
||||
}
|
||||
}catch(Exception s){
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "pre-load-commands: " + panel.getConfig().getString("pre-load-commands")));
|
||||
plugin.debug(s,p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package me.rockyhawk.commandpanels.classresources;
|
||||
import com.jojodmo.customitems.api.CustomItemsAPI;
|
||||
import me.arcaniax.hdb.api.HeadDatabaseAPI;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import me.rockyhawk.commandpanels.ioclasses.NBTEditor;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
@ -36,15 +37,15 @@ public class ItemCreation {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public ItemStack makeItemFromConfig(ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours, boolean addNBT){
|
||||
String material = plugin.papiNoColour(p,itemSection.getString("material"));
|
||||
public ItemStack makeItemFromConfig(Panel panel, ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours, boolean addNBT){
|
||||
String material = plugin.tex.papiNoColour(panel,p,itemSection.getString("material"));
|
||||
try {
|
||||
if (Objects.requireNonNull(material).equalsIgnoreCase("AIR")) {
|
||||
return null;
|
||||
}
|
||||
}catch(NullPointerException e){
|
||||
plugin.debug(e,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: could not load material!"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: could not load material!"));
|
||||
return null;
|
||||
}
|
||||
ItemStack s = null;
|
||||
@ -78,7 +79,7 @@ public class ItemCreation {
|
||||
if(itemSection.contains("ID")){
|
||||
id = Short.parseShort(itemSection.getString("ID"));
|
||||
}
|
||||
if (matraw.split("\\s")[0].toLowerCase().equals("cps=") || matraw.split("\\s")[0].toLowerCase().equals("cpo=")) {
|
||||
if (matraw.split("\\s")[0].equalsIgnoreCase("cps=") || matraw.split("\\s")[0].toLowerCase().equals("cpo=")) {
|
||||
skullname = p.getUniqueId().toString();
|
||||
mat = plugin.getHeads.playerHeadString();
|
||||
if(plugin.legacy.isLegacy()){
|
||||
@ -86,7 +87,7 @@ public class ItemCreation {
|
||||
}
|
||||
}
|
||||
|
||||
if (matraw.split("\\s")[0].toLowerCase().equals("hdb=")) {
|
||||
if (matraw.split("\\s")[0].equalsIgnoreCase("hdb=")) {
|
||||
skullname = "hdb";
|
||||
mat = plugin.getHeads.playerHeadString();
|
||||
if(plugin.legacy.isLegacy()){
|
||||
@ -95,7 +96,7 @@ public class ItemCreation {
|
||||
}
|
||||
|
||||
//creates custom MMOItems items
|
||||
if(matraw.split("\\s")[0].toLowerCase().equals("mmo=") && plugin.getServer().getPluginManager().isPluginEnabled("MMOItems")){
|
||||
if(matraw.split("\\s")[0].equalsIgnoreCase("mmo=") && plugin.getServer().getPluginManager().isPluginEnabled("MMOItems")){
|
||||
String itemType = matraw.split("\\s")[1];
|
||||
String itemID = matraw.split("\\s")[2];
|
||||
ItemManager itemManager = MMOItems.plugin.getItems();
|
||||
@ -105,18 +106,18 @@ public class ItemCreation {
|
||||
}
|
||||
|
||||
//creates Custom Items items
|
||||
if(matraw.split("\\s")[0].toLowerCase().equals("cui=") && plugin.getServer().getPluginManager().isPluginEnabled("CustomItems")){
|
||||
if(matraw.split("\\s")[0].equalsIgnoreCase("cui=") && plugin.getServer().getPluginManager().isPluginEnabled("CustomItems")){
|
||||
s = CustomItemsAPI.getCustomItem("cui:" + matraw.split("\\s")[1]);
|
||||
normalCreation = false;
|
||||
}
|
||||
|
||||
//creates a written book item
|
||||
if(matraw.split("\\s")[0].toLowerCase().equals("book=")){
|
||||
if(matraw.split("\\s")[0].equalsIgnoreCase("book=")){
|
||||
s = new ItemStack(Material.WRITTEN_BOOK);
|
||||
BookMeta bookMeta = (BookMeta) s.getItemMeta();
|
||||
bookMeta.setTitle(matraw.split("\\s")[1]);
|
||||
bookMeta.setAuthor(matraw.split("\\s")[1]);
|
||||
List<String> bookLines = plugin.papi(p,itemSection.getStringList("write"),true);
|
||||
List<String> bookLines = plugin.tex.papi(panel,p,itemSection.getStringList("write"),true);
|
||||
String result = bookLines.stream().map(String::valueOf).collect(Collectors.joining("\n" + ChatColor.RESET, "", ""));
|
||||
bookMeta.setPages(result);
|
||||
s.setItemMeta(bookMeta);
|
||||
@ -124,8 +125,8 @@ public class ItemCreation {
|
||||
}
|
||||
|
||||
//creates item from custom-items section of panel
|
||||
if(matraw.split("\\s")[0].toLowerCase().equals("cpi=")){
|
||||
s = makeCustomItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + matraw.split("\\s")[1]), p, true, true, true);
|
||||
if(matraw.split("\\s")[0].equalsIgnoreCase("cpi=")){
|
||||
s = makeCustomItemFromConfig(panel,plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + matraw.split("\\s")[1]), p, true, true, true);
|
||||
normalCreation = false;
|
||||
}
|
||||
|
||||
@ -144,22 +145,22 @@ public class ItemCreation {
|
||||
assert meta != null;
|
||||
meta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(skullname)));
|
||||
} catch (Exception var23) {
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: cps= self"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: cps= self"));
|
||||
plugin.debug(var23,p);
|
||||
}
|
||||
}else{
|
||||
meta.setOwner(p.getName());
|
||||
}
|
||||
s.setItemMeta(meta);
|
||||
}else if (plugin.papiNoColour(p,matraw.split("\\s")[1]).length() <= 16) {
|
||||
}else if (plugin.tex.papiNoColour(panel,p,matraw.split("\\s")[1]).length() <= 16) {
|
||||
//if cps= username
|
||||
s = plugin.customHeads.getPlayerHead(plugin.papiNoColour(p,matraw.split("\\s")[1]));
|
||||
s = plugin.customHeads.getPlayerHead(plugin.tex.papiNoColour(panel,p,matraw.split("\\s")[1]));
|
||||
} else {
|
||||
//custom data cps= base64
|
||||
s = plugin.customHeads.getCustomHead(plugin.papiNoColour(p,matraw.split("\\s")[1]));
|
||||
s = plugin.customHeads.getCustomHead(plugin.tex.papiNoColour(panel,p,matraw.split("\\s")[1]));
|
||||
}
|
||||
} catch (Exception var32) {
|
||||
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.error") + " head material: Could not load skull"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + plugin.config.getString("config.format.error") + " head material: Could not load skull"));
|
||||
plugin.debug(var32,p);
|
||||
}
|
||||
}
|
||||
@ -177,11 +178,11 @@ public class ItemCreation {
|
||||
try {
|
||||
s = api.getItemHead(matraw.split("\\s")[1].trim());
|
||||
} catch (Exception var22) {
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " hdb: could not load skull!"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " hdb: could not load skull!"));
|
||||
plugin.debug(var22,p);
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi(plugin.tag + "Download HeadDatabaseHook from Spigot to use this feature!"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + "Download HeadDatabaseHook from Spigot to use this feature!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,10 +232,10 @@ public class ItemCreation {
|
||||
meta.setMapView(map);
|
||||
s.setItemMeta(meta);
|
||||
}else{
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " map: File not found."));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " map: File not found."));
|
||||
}
|
||||
}catch(Exception map){
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " map: " + itemSection.getString("map")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " map: " + itemSection.getString("map")));
|
||||
plugin.debug(map,p);
|
||||
}
|
||||
}
|
||||
@ -254,7 +255,7 @@ public class ItemCreation {
|
||||
s.setItemMeta(EnchantMeta);
|
||||
}
|
||||
} catch (Exception ench) {
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " enchanted: " + itemSection.getString("enchanted")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " enchanted: " + itemSection.getString("enchanted")));
|
||||
plugin.debug(ench,p);
|
||||
}
|
||||
}
|
||||
@ -306,7 +307,7 @@ public class ItemCreation {
|
||||
} catch (Exception er) {
|
||||
//don't colour the armor
|
||||
plugin.debug(er,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " leatherarmor: " + itemSection.getString("leatherarmor")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " leatherarmor: " + itemSection.getString("leatherarmor")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +324,7 @@ public class ItemCreation {
|
||||
} catch (Exception er) {
|
||||
//don't add the effect
|
||||
plugin.debug(er,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + plugin.config.getString("config.format.error") + " potion: " + itemSection.getString("potion")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + plugin.config.getString("config.format.error") + " potion: " + itemSection.getString("potion")));
|
||||
}
|
||||
}
|
||||
if (itemSection.contains("damage")) {
|
||||
@ -331,10 +332,10 @@ public class ItemCreation {
|
||||
//if the damage is not unbreakable and should be a value
|
||||
if (plugin.legacy.isLegacy()) {
|
||||
try {
|
||||
s.setDurability(Short.parseShort(Objects.requireNonNull(plugin.papi(p, itemSection.getString("damage")))));
|
||||
s.setDurability(Short.parseShort(Objects.requireNonNull(plugin.tex.papi(panel,p, itemSection.getString("damage")))));
|
||||
} catch (Exception e) {
|
||||
plugin.debug(e, p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage")));
|
||||
}
|
||||
} else {
|
||||
if(itemSection.getString("damage").equalsIgnoreCase("-1")){
|
||||
@ -346,38 +347,38 @@ public class ItemCreation {
|
||||
|
||||
try {
|
||||
Damageable itemDamage = (Damageable) s.getItemMeta();
|
||||
itemDamage.setDamage(Integer.parseInt(Objects.requireNonNull(plugin.papi(p, itemSection.getString("damage")))));
|
||||
itemDamage.setDamage(Integer.parseInt(Objects.requireNonNull(plugin.tex.papi(panel,p, itemSection.getString("damage")))));
|
||||
s.setItemMeta((ItemMeta) itemDamage);
|
||||
} catch (Exception e) {
|
||||
plugin.debug(e, p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " damage: " + itemSection.getString("damage")));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemSection.contains("stack")) {
|
||||
//change the stack amount (placeholders accepted)
|
||||
s.setAmount((int)Double.parseDouble(Objects.requireNonNull(plugin.papi(p,itemSection.getString("stack")))));
|
||||
s.setAmount((int)Double.parseDouble(Objects.requireNonNull(plugin.tex.papi(panel,p,itemSection.getString("stack")))));
|
||||
}
|
||||
} catch (IllegalArgumentException | NullPointerException var33) {
|
||||
plugin.debug(var33,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " material: " + itemSection.getString("material")));
|
||||
p.sendMessage(plugin.tex.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, hideAttributes);
|
||||
plugin.setName(panel,s, itemSection.getString("name"), itemSection.getStringList("lore"), p, placeholders, colours, hideAttributes);
|
||||
return s;
|
||||
}
|
||||
|
||||
//do custom-item items, they have an additional hasSection requirement
|
||||
public ItemStack makeCustomItemFromConfig(ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours, boolean addNBT){
|
||||
String section = plugin.itemCreate.hasSection(itemSection,p);
|
||||
public ItemStack makeCustomItemFromConfig(Panel panel, ConfigurationSection itemSection, Player p, boolean placeholders, boolean colours, boolean addNBT){
|
||||
String section = plugin.itemCreate.hasSection(panel,itemSection,p);
|
||||
if(!section.equals("")){
|
||||
itemSection = itemSection.getConfigurationSection(section.substring(1));
|
||||
}
|
||||
return plugin.itemCreate.makeItemFromConfig(itemSection, p, placeholders, colours, addNBT);
|
||||
return plugin.itemCreate.makeItemFromConfig(panel,itemSection, p, placeholders, colours, addNBT);
|
||||
}
|
||||
|
||||
//hasperm hasvalue, etc sections will be done here
|
||||
public String hasSection(ConfigurationSection cf, Player p){
|
||||
public String hasSection(Panel panel, ConfigurationSection cf, Player p){
|
||||
if (cf.isSet("hasvalue")) {
|
||||
//this will do the hasvalue without any numbers
|
||||
boolean outputValue = true;
|
||||
@ -386,11 +387,11 @@ public class ItemCreation {
|
||||
//if output is true, and values match it will be this item, vice versa
|
||||
outputValue = cf.getBoolean("hasvalue.output");
|
||||
}
|
||||
String value = ChatColor.stripColor(plugin.papi(p,plugin.placeholders.setCpPlaceholders(p,cf.getString("hasvalue.value"))));
|
||||
String compare = ChatColor.stripColor(plugin.papi(p,plugin.placeholders.setCpPlaceholders(p,cf.getString("hasvalue.compare"))));
|
||||
String value = ChatColor.stripColor(plugin.tex.papi(panel,p,cf.getString("hasvalue.value")));
|
||||
String compare = ChatColor.stripColor(plugin.tex.papi(panel,p,cf.getString("hasvalue.compare")));
|
||||
if (compare.equals(value) == outputValue) {
|
||||
//onOpen being 3 means it is the editor panel.. hasvalue items cannot be included to avoid item breaking
|
||||
String section = hasSection(Objects.requireNonNull(cf.getConfigurationSection("hasvalue")), p);
|
||||
String section = hasSection(panel,Objects.requireNonNull(cf.getConfigurationSection("hasvalue")), p);
|
||||
//string section, it executes itself to check for subsections
|
||||
return ".hasvalue" + section;
|
||||
}
|
||||
@ -403,18 +404,18 @@ public class ItemCreation {
|
||||
//if output is true, and values match it will be this item, vice versa
|
||||
outputValue = cf.getBoolean("hasvalue" + count + ".output");
|
||||
}
|
||||
value = ChatColor.stripColor(plugin.papi(p,plugin.placeholders.setCpPlaceholders(p,cf.getString("hasvalue" + count + ".value"))));
|
||||
compare = ChatColor.stripColor(plugin.papi(p,plugin.placeholders.setCpPlaceholders(p,cf.getString("hasvalue" + count + ".compare"))));
|
||||
value = ChatColor.stripColor(plugin.tex.papi(panel,p,cf.getString("hasvalue" + count + ".value")));
|
||||
compare = ChatColor.stripColor(plugin.tex.papi(panel,p,cf.getString("hasvalue" + count + ".compare")));
|
||||
if (compare.equals(value) == outputValue) {
|
||||
//onOpen being 3 means it is the editor panel.. hasvalue items cannot be included to avoid item breaking
|
||||
String section = hasSection(Objects.requireNonNull(cf.getConfigurationSection("hasvalue" + count)), p);
|
||||
String section = hasSection(panel,Objects.requireNonNull(cf.getConfigurationSection("hasvalue" + count)), p);
|
||||
//string section, it executes itself to check for subsections
|
||||
return ".hasvalue" + count + section;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cf.contains("hasgreater")) {
|
||||
if (cf.isSet("hasgreater")) {
|
||||
//this will do the hasgreater without any numbers
|
||||
boolean outputValue = true;
|
||||
//outputValue will default to true
|
||||
@ -422,11 +423,11 @@ public class ItemCreation {
|
||||
//if output is true, and values match it will be this item, vice versa
|
||||
outputValue = cf.getBoolean("hasgreater.output");
|
||||
}
|
||||
double value = Double.parseDouble(ChatColor.stripColor(plugin.papiNoColour(p,cf.getString("hasgreater.value"))));
|
||||
double compare = Double.parseDouble(ChatColor.stripColor(plugin.papiNoColour(p,cf.getString("hasgreater.compare"))));
|
||||
double value = Double.parseDouble(ChatColor.stripColor(plugin.tex.papiNoColour(panel,p,cf.getString("hasgreater.value"))));
|
||||
double compare = Double.parseDouble(ChatColor.stripColor(plugin.tex.papiNoColour(panel,p,cf.getString("hasgreater.compare"))));
|
||||
if ((compare >= value) == outputValue) {
|
||||
//onOpen being 3 means it is the editor panel.. hasgreater items cannot be included to avoid item breaking
|
||||
String section = hasSection(Objects.requireNonNull(cf.getConfigurationSection("hasgreater")), p);
|
||||
String section = hasSection(panel,Objects.requireNonNull(cf.getConfigurationSection("hasgreater")), p);
|
||||
return ".hasgreater" + section;
|
||||
}
|
||||
//loop through possible hasgreater 1,2,3,etc
|
||||
@ -438,17 +439,17 @@ public class ItemCreation {
|
||||
//if output is true, and values match it will be this item, vice versa
|
||||
outputValue = cf.getBoolean("hasgreater" + count + ".output");
|
||||
}
|
||||
value = Double.parseDouble(ChatColor.stripColor(plugin.papiNoColour(p,cf.getString("hasgreater" + count + ".value"))));
|
||||
compare = Double.parseDouble(ChatColor.stripColor(plugin.papiNoColour(p,cf.getString("hasgreater" + count + ".compare"))));
|
||||
value = Double.parseDouble(ChatColor.stripColor(plugin.tex.papiNoColour(panel,p,cf.getString("hasgreater" + count + ".value"))));
|
||||
compare = Double.parseDouble(ChatColor.stripColor(plugin.tex.papiNoColour(panel,p,cf.getString("hasgreater" + count + ".compare"))));
|
||||
if ((compare >= value) == outputValue) {
|
||||
//onOpen being 3 means it is the editor panel.. hasgreater items cannot be included to avoid item breaking
|
||||
String section = hasSection(Objects.requireNonNull(cf.getConfigurationSection("hasgreater" + count)), p);
|
||||
String section = hasSection(panel,Objects.requireNonNull(cf.getConfigurationSection("hasgreater" + count)), p);
|
||||
return ".hasgreater" + count + section;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cf.contains("hasperm")) {
|
||||
if (cf.isSet("hasperm")) {
|
||||
//this will do hasperm with no numbers
|
||||
boolean outputValue = true;
|
||||
//outputValue will default to true
|
||||
@ -457,7 +458,7 @@ public class ItemCreation {
|
||||
outputValue = cf.getBoolean("hasperm.output");
|
||||
}
|
||||
if (p.hasPermission(Objects.requireNonNull(cf.getString("hasperm.perm"))) == outputValue) {
|
||||
String section = hasSection(Objects.requireNonNull(cf.getConfigurationSection("hasperm")), p);
|
||||
String section = hasSection(panel,Objects.requireNonNull(cf.getConfigurationSection("hasperm")), p);
|
||||
return ".hasperm" + section;
|
||||
}
|
||||
for(int count = 0; cf.getKeys(false).size() > count; count++){
|
||||
@ -469,7 +470,7 @@ public class ItemCreation {
|
||||
outputValue = cf.getBoolean("hasperm" + count + ".output");
|
||||
}
|
||||
if (p.hasPermission(Objects.requireNonNull(cf.getString("hasperm" + count + ".perm"))) == outputValue) {
|
||||
String section = hasSection(Objects.requireNonNull(cf.getConfigurationSection("hasperm" + count)), p);
|
||||
String section = hasSection(panel,Objects.requireNonNull(cf.getConfigurationSection("hasperm" + count)), p);
|
||||
return ".hasperm" + count + section;
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ public class OpenEditorGuis {
|
||||
ArrayList<ItemStack> panelItems = new ArrayList<>(); //all panels from ALL files (panel materials)
|
||||
try {
|
||||
for(Panel panel : plugin.panelList) { //will loop through all the files in folder
|
||||
panelNames.add(plugin.papi(panel.getName()));
|
||||
panelTitles.add(plugin.papi(panel.getConfig().getString("title")));
|
||||
panelNames.add(plugin.tex.papi(panel.getName()));
|
||||
panelTitles.add(plugin.tex.papi(panel.getConfig().getString("title")));
|
||||
if (panel.getConfig().contains("open-with-item.material")) {
|
||||
panelItems.add(panel.getHotbarItem(p));
|
||||
} else {
|
||||
@ -56,10 +56,10 @@ public class OpenEditorGuis {
|
||||
//make all the bottom bar items
|
||||
ItemStack temp;
|
||||
temp = new ItemStack(Material.SLIME_BALL, 1);
|
||||
plugin.setName(temp, ChatColor.WHITE + "Page " + pageNumber, null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Page " + pageNumber, null, p, true, true, true);
|
||||
i.setItem(49, temp);
|
||||
temp = new ItemStack(Material.BARRIER, 1);
|
||||
plugin.setName(temp, ChatColor.RED + "Exit Menu", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.RED + "Exit Menu", null, p, true, true, true);
|
||||
i.setItem(45, temp);
|
||||
temp = new ItemStack(Material.BOOK, 1);
|
||||
List<String> lore = new ArrayList();
|
||||
@ -71,18 +71,18 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.GRAY + " type 'remove' to set a");
|
||||
lore.add(ChatColor.GRAY + " value to default, and use");
|
||||
lore.add(ChatColor.GRAY + " '" + plugin.config.getString("config.input-cancel") + "' to cancel.");
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Editor Tips", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Editor Tips", lore, p, true, true, true);
|
||||
i.setItem(53, temp);
|
||||
if (pageNumber != 1) {
|
||||
//only show previous page button if number is not one
|
||||
temp = new ItemStack(Material.PAPER, 1);
|
||||
plugin.setName(temp, ChatColor.WHITE + "Previous Page", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Previous Page", null, p, true, true, true);
|
||||
i.setItem(48, temp);
|
||||
}
|
||||
if (pageNumber < pagesAmount) {
|
||||
//if page number is under pages amount
|
||||
temp = new ItemStack(Material.PAPER, 1);
|
||||
plugin.setName(temp, ChatColor.WHITE + "Next Page", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Next Page", null, p, true, true, true);
|
||||
i.setItem(50, temp);
|
||||
}
|
||||
int count = 0;
|
||||
@ -92,7 +92,7 @@ public class OpenEditorGuis {
|
||||
//count is +1 because count starts at 0 not 1
|
||||
if ((pageNumber * 45 - 45) < (count + 1) && (pageNumber * 45) > (count)) {
|
||||
temp = panelItems.get(count);
|
||||
plugin.setName(temp, ChatColor.WHITE + panelName, lore, p, false, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + panelName, lore, p, false, true, true);
|
||||
i.setItem(slot, temp);
|
||||
slot += 1;
|
||||
}
|
||||
@ -121,7 +121,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "--------------------------------");
|
||||
lore.add(ChatColor.WHITE + "commandpanel.panel." + cf.getString("perm"));
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Permission", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Permission", lore, p, true, true, true);
|
||||
i.setItem(1, temp);
|
||||
|
||||
temp = new ItemStack(Material.NAME_TAG, 1);
|
||||
@ -131,7 +131,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "------------------");
|
||||
lore.add(ChatColor.WHITE + cf.getString("title"));
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Title", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Title", lore, p, true, true, true);
|
||||
i.setItem(3, temp);
|
||||
|
||||
temp = new ItemStack(Material.JUKEBOX, 1);
|
||||
@ -141,7 +141,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "------------------------");
|
||||
lore.add(ChatColor.WHITE + Objects.requireNonNull(cf.getString("sound-on-open")).toUpperCase());
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Sound", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Sound", lore, p, true, true, true);
|
||||
i.setItem(5, temp);
|
||||
|
||||
temp = new ItemStack(Material.IRON_DOOR, 1);
|
||||
@ -157,20 +157,20 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Command", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Command", lore, p, true, true, true);
|
||||
i.setItem(7, temp);
|
||||
|
||||
temp = new ItemStack(Material.LAVA_BUCKET, 1);
|
||||
lore.clear();
|
||||
lore.add(ChatColor.DARK_RED + "Permanently delete Panel");
|
||||
plugin.setName(temp, ChatColor.RED + "Delete Panel", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.RED + "Delete Panel", lore, p, true, true, true);
|
||||
i.setItem(21, temp);
|
||||
|
||||
temp = new ItemStack(Material.LADDER, 1);
|
||||
lore.clear();
|
||||
lore.add(ChatColor.GRAY + "How many rows the panel will be");
|
||||
lore.add(ChatColor.GRAY + "choose an integer from 1 to 6");
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Rows", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Rows", lore, p, true, true, true);
|
||||
i.setItem(23, temp);
|
||||
|
||||
temp = new ItemStack(Material.STONE, 1);
|
||||
@ -186,7 +186,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Disabled Worlds", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Disabled Worlds", lore, p, true, true, true);
|
||||
i.setItem(25, temp);
|
||||
|
||||
temp = new ItemStack(Material.GLASS, 1);
|
||||
@ -196,7 +196,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "-----------------------");
|
||||
lore.add(ChatColor.WHITE + Objects.requireNonNull(cf.getString("empty")).toUpperCase());
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Empty Item", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Empty Item", lore, p, true, true, true);
|
||||
i.setItem(13, temp);
|
||||
|
||||
temp = new ItemStack(Material.ANVIL, 1);
|
||||
@ -212,7 +212,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Commands", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Commands", lore, p, true, true, true);
|
||||
i.setItem(15, temp);
|
||||
|
||||
temp = new ItemStack(Material.STRING, 1);
|
||||
@ -228,7 +228,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Types", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Types", lore, p, true, true, true);
|
||||
i.setItem(17, temp);
|
||||
|
||||
temp = new ItemStack(Material.ITEM_FRAME, 1);
|
||||
@ -237,11 +237,11 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.GRAY + "/cp [name]");
|
||||
lore.add(ChatColor.WHITE + "-----------------------");
|
||||
lore.add(ChatColor.WHITE + panelName);
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Name", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Name", lore, p, true, true, true);
|
||||
i.setItem(11, temp);
|
||||
|
||||
temp = new ItemStack(Material.BARRIER, 1);
|
||||
plugin.setName(temp, ChatColor.RED + "Back", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.RED + "Back", null, p, true, true, true);
|
||||
i.setItem(18, temp);
|
||||
|
||||
//This will create a wall of glass panes, separating panel settings with hotbar settings
|
||||
@ -250,7 +250,7 @@ public class OpenEditorGuis {
|
||||
}else{
|
||||
temp = new ItemStack(Material.matchMaterial("BLACK_STAINED_GLASS_PANE"), 1);
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "", null, p,false, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "", null, p,false, true, true);
|
||||
for(int d = 27; d < 36; d++){
|
||||
i.setItem(d, temp);
|
||||
}
|
||||
@ -259,7 +259,7 @@ public class OpenEditorGuis {
|
||||
|
||||
if(cf.contains("open-with-item.material")){
|
||||
hotbarItems = true;
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf.getConfigurationSection("open-with-item"), p, false, true, false);
|
||||
temp = plugin.itemCreate.makeItemFromConfig(null,cf.getConfigurationSection("open-with-item"), p, false, true, false);
|
||||
}else{
|
||||
temp = new ItemStack(Material.REDSTONE_BLOCK, 1);
|
||||
}
|
||||
@ -272,7 +272,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "-----------------------");
|
||||
lore.add(ChatColor.RED + "DISABLED");
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Hotbar Item", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Panel Hotbar Item", lore, p, true, true, true);
|
||||
i.setItem(40, temp);
|
||||
|
||||
if(hotbarItems) {
|
||||
@ -283,7 +283,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "----------");
|
||||
lore.add(ChatColor.WHITE + Objects.requireNonNull(cf.getString("open-with-item.name")));
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Hotbar Item Name", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Hotbar Item Name", lore, p, true, true, true);
|
||||
i.setItem(38, temp);
|
||||
|
||||
temp = new ItemStack(Material.FEATHER, 1);
|
||||
@ -299,7 +299,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Hotbar Lore", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Hotbar Lore", lore, p, true, true, true);
|
||||
i.setItem(36, temp);
|
||||
|
||||
temp = new ItemStack(Material.BEDROCK, 1);
|
||||
@ -311,7 +311,7 @@ public class OpenEditorGuis {
|
||||
int location = cf.getInt("open-with-item.stationary");
|
||||
lore.add(ChatColor.WHITE + String.valueOf(location));
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Hotbar Item Location", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Hotbar Item Location", lore, p, true, true, true);
|
||||
i.setItem(42, temp);
|
||||
|
||||
temp = new ItemStack(Material.BOOK, 1);
|
||||
@ -329,7 +329,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Hotbar Item Commands", lore, p, true, true,true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Hotbar Item Commands", lore, p, true, true,true);
|
||||
i.setItem(44, temp);
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + cf.getString("name"));
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Name", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Name", lore, p, true, true, true);
|
||||
i.setItem(1, temp);
|
||||
|
||||
temp = new ItemStack(Material.ANVIL, 1);
|
||||
@ -373,7 +373,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Commands", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Commands", lore, p, true, true, true);
|
||||
i.setItem(3, temp);
|
||||
|
||||
temp = new ItemStack(Material.ENCHANTED_BOOK, 1);
|
||||
@ -388,7 +388,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "--------------------------------");
|
||||
lore.add(ChatColor.WHITE + "false");
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Enchantment", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Enchantment", lore, p, true, true, true);
|
||||
i.setItem(5, temp);
|
||||
|
||||
temp = new ItemStack(Material.POTION, 1);
|
||||
@ -400,7 +400,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + cf.getString("potion"));
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Potion Effect", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Potion Effect", lore, p, true, true, true);
|
||||
i.setItem(7, temp);
|
||||
|
||||
temp = new ItemStack(Material.PAPER, 1);
|
||||
@ -416,7 +416,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Duplicates", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Duplicates", lore, p, true, true, true);
|
||||
i.setItem(13, temp);
|
||||
|
||||
temp = new ItemStack(Material.FEATHER, 1);
|
||||
@ -432,7 +432,7 @@ public class OpenEditorGuis {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Lores", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Lores", lore, p, true, true, true);
|
||||
i.setItem(19, temp);
|
||||
|
||||
temp = new ItemStack(Material.ITEM_FRAME, 2);
|
||||
@ -448,7 +448,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + cf.getString("stack"));
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Stack Size", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Stack Size", lore, p, true, true, true);
|
||||
i.setItem(21, temp);
|
||||
|
||||
if(!plugin.legacy.isLegacy()) {
|
||||
@ -461,7 +461,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + cf.getString("customdata"));
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Custom Model Data", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Custom Model Data", lore, p, true, true, true);
|
||||
i.setItem(23, temp);
|
||||
}
|
||||
|
||||
@ -476,7 +476,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.GRAY + "Sections and add complex values.");
|
||||
lore.add(ChatColor.WHITE + "--------------------------------");
|
||||
lore.add(ChatColor.WHITE + section);
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Sections", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Sections", lore, p, true, true, true);
|
||||
i.setItem(31, temp);
|
||||
|
||||
temp = new ItemStack(Material.LEATHER_HELMET, 1);
|
||||
@ -489,18 +489,18 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + cf.getString("leatherarmor"));
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Leather Armor Colour", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Leather Armor Colour", lore, p, true, true, true);
|
||||
i.setItem(25, temp);
|
||||
|
||||
temp = new ItemStack(Material.BARRIER, 1);
|
||||
plugin.setName(temp, ChatColor.RED + "Back", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.RED + "Back", null, p, true, true, true);
|
||||
i.setItem(27, temp);
|
||||
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf,p,false,false, false);
|
||||
temp = plugin.itemCreate.makeItemFromConfig(null,cf,p,false,false, false);
|
||||
lore.clear();
|
||||
lore.add(ChatColor.GRAY + "Click to set custom material");
|
||||
lore.add(ChatColor.GRAY + "typically for custom heads");
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Section " + section + " Preview", lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Section " + section + " Preview", lore, p, true, true, true);
|
||||
i.setItem(35, temp);
|
||||
|
||||
p.openInventory(i);
|
||||
@ -535,23 +535,23 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.WHITE + "Compare: " + ChatColor.GRAY + cf.getString(section + ".compare"));
|
||||
}
|
||||
|
||||
temp = plugin.itemCreate.makeItemFromConfig(cf.getConfigurationSection(section),p,false,false, false);
|
||||
plugin.setName(temp, ChatColor.AQUA + section, lore, p,false, true, true);
|
||||
temp = plugin.itemCreate.makeItemFromConfig(null,cf.getConfigurationSection(section),p,false,false, false);
|
||||
plugin.setName(null,temp, ChatColor.AQUA + section, lore, p,false, true, true);
|
||||
i.setItem(slot, temp);
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
|
||||
temp = new ItemStack(Material.REDSTONE, 1);
|
||||
plugin.setName(temp, ChatColor.WHITE + "Remove Section", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Remove Section", null, p, true, true, true);
|
||||
i.setItem(38, temp);
|
||||
|
||||
temp = new ItemStack(Material.SLIME_BALL, 1);
|
||||
plugin.setName(temp, ChatColor.WHITE + "Add Section", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Add Section", null, p, true, true, true);
|
||||
i.setItem(42, temp);
|
||||
|
||||
temp = new ItemStack(Material.BARRIER, 1);
|
||||
plugin.setName(temp, ChatColor.RED + "Back", null, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.RED + "Back", null, p, true, true, true);
|
||||
i.setItem(36, temp);
|
||||
|
||||
temp = new ItemStack(Material.BOOK, 1);
|
||||
@ -560,7 +560,7 @@ public class OpenEditorGuis {
|
||||
lore.add(ChatColor.GRAY + "- hasperm");
|
||||
lore.add(ChatColor.GRAY + "- hasvalue");
|
||||
lore.add(ChatColor.GRAY + "- hasgreater");
|
||||
plugin.setName(temp, ChatColor.WHITE + "Item Section " + itemSection, lore, p, true, true, true);
|
||||
plugin.setName(null,temp, ChatColor.WHITE + "Item Section " + itemSection, lore, p, true, true, true);
|
||||
i.setItem(44, temp);
|
||||
|
||||
p.openInventory(i);
|
||||
|
@ -0,0 +1,106 @@
|
||||
package me.rockyhawk.commandpanels.classresources.placeholders;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CreateText {
|
||||
CommandPanels plugin;
|
||||
public CreateText(CommandPanels pl) {
|
||||
this.plugin = pl;
|
||||
}
|
||||
|
||||
|
||||
//papi except if it is a String List
|
||||
public List<String> papiNoColour(Panel panel, Player p, List<String> setpapi) {
|
||||
try {
|
||||
int tempInt = 0;
|
||||
for (String temp : setpapi) {
|
||||
setpapi.set(tempInt, plugin.placeholders.setCpPlaceholders(panel, p, temp));
|
||||
tempInt += 1;
|
||||
}
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = plugin.getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
}catch(Exception ignore){
|
||||
//this will be ignored as it is probably a null
|
||||
return null;
|
||||
}
|
||||
return setpapi;
|
||||
}
|
||||
|
||||
//papi except if it is a String List
|
||||
public List<String> papi(Panel panel, Player p, List<String> setpapi, boolean placeholder) {
|
||||
try {
|
||||
if(placeholder) {
|
||||
int tempInt = 0;
|
||||
for (String temp : setpapi) {
|
||||
setpapi.set(tempInt, plugin.placeholders.setCpPlaceholders(panel, p, temp));
|
||||
tempInt += 1;
|
||||
}
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = plugin.getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
}
|
||||
}catch(Exception ignore){
|
||||
//this will be ignored as it is probably a null
|
||||
return null;
|
||||
}
|
||||
int tempInt = 0;
|
||||
//change colour
|
||||
for(String temp : setpapi){
|
||||
try {
|
||||
setpapi.set(tempInt, plugin.translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', temp)));
|
||||
}catch(NullPointerException ignore){
|
||||
}
|
||||
tempInt += 1;
|
||||
}
|
||||
return setpapi;
|
||||
}
|
||||
|
||||
//regular string papi, but only colours so Player doesn't need to be there
|
||||
public String papi(String setpapi) {
|
||||
try {
|
||||
setpapi = plugin.translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', setpapi));
|
||||
return setpapi;
|
||||
}catch(NullPointerException e){
|
||||
return setpapi;
|
||||
}
|
||||
}
|
||||
|
||||
//string papi with no colours
|
||||
public String papiNoColour(Panel panel, Player p, String setpapi) {
|
||||
try {
|
||||
setpapi = plugin.placeholders.setCpPlaceholders(panel, p,setpapi);
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = plugin.getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
return setpapi;
|
||||
}catch(NullPointerException e){
|
||||
return setpapi;
|
||||
}
|
||||
}
|
||||
|
||||
//regular string papi
|
||||
public String papi(Panel panel, Player p, String setpapi) {
|
||||
try {
|
||||
setpapi = plugin.placeholders.setCpPlaceholders(panel, p,setpapi);
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
OfflinePlayer offp = plugin.getServer().getOfflinePlayer(p.getUniqueId());
|
||||
setpapi = PlaceholderAPI.setPlaceholders(offp, setpapi);
|
||||
}
|
||||
setpapi = plugin.translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', setpapi));
|
||||
return setpapi;
|
||||
}catch(NullPointerException e){
|
||||
return setpapi;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
package me.rockyhawk.commandpanels.classresources;
|
||||
package me.rockyhawk.commandpanels.classresources.placeholders;
|
||||
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import me.realized.tokenmanager.api.TokenManager;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -22,7 +23,7 @@ public class Placeholders {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public String setCpPlaceholders(Player p, String str){
|
||||
public String setCpPlaceholders(Panel panel, Player p, String str){
|
||||
//replace nodes with PlaceHolders
|
||||
str = str.replaceAll("%cp-player-displayname%", p.getDisplayName());
|
||||
str = str.replaceAll("%cp-player-name%", p.getName());
|
||||
@ -31,18 +32,20 @@ public class Placeholders {
|
||||
str = str.replaceAll("%cp-player-y%", String.valueOf(Math.round(p.getLocation().getY())));
|
||||
str = str.replaceAll("%cp-player-z%", String.valueOf(Math.round(p.getLocation().getZ())));
|
||||
str = str.replaceAll("%cp-online-players%", Integer.toString(Bukkit.getServer().getOnlinePlayers().size()));
|
||||
str = str.replaceAll("%cp-tag%", plugin.papi(plugin.tag));
|
||||
str = str.replaceAll("%cp-tag%", plugin.tex.papi(plugin.tag));
|
||||
|
||||
//set custom placeholders to their values
|
||||
for(String[] placeholder : plugin.customCommand.getCCP(p.getName())){
|
||||
while (str.contains(placeholder[0])) {
|
||||
try {
|
||||
int start = str.indexOf(placeholder[0]);
|
||||
int end = start + placeholder[0].length() - 1;
|
||||
str = str.replace(str.substring(start, end) + "%", placeholder[1]);
|
||||
}catch (Exception ex){
|
||||
plugin.debug(ex,p);
|
||||
break;
|
||||
if(panel != null) {
|
||||
for (String placeholder : panel.placeholders.keys.keySet()) {
|
||||
while (str.contains(placeholder)) {
|
||||
try {
|
||||
int start = str.indexOf(placeholder);
|
||||
int end = start + placeholder.length() - 1;
|
||||
str = str.replace(str.substring(start, end) + "%", panel.placeholders.keys.get(placeholder));
|
||||
} catch (Exception ex) {
|
||||
plugin.debug(ex, p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,6 +106,24 @@ public class Placeholders {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//get stack amount from slot in current open inventory (panel)
|
||||
while (str.contains("%cp-modeldata-")) {
|
||||
try {
|
||||
int start = str.indexOf("%cp-modeldata-");
|
||||
int end = str.indexOf("%", str.indexOf("%cp-modeldata-") + 1);
|
||||
String matNumber = str.substring(start, end).replace("%cp-modeldata-", "").replace("%", "");
|
||||
int modelData;
|
||||
try {
|
||||
modelData = p.getOpenInventory().getTopInventory().getItem(Integer.parseInt(matNumber)).getItemMeta().getCustomModelData();
|
||||
} catch (NullPointerException er) {
|
||||
modelData = 0;
|
||||
}
|
||||
str = str.replace(str.substring(start, end) + "%", String.valueOf(modelData));
|
||||
}catch(Exception ex){
|
||||
plugin.debug(ex,p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//is an item damaged
|
||||
while (str.contains("%cp-damaged-")) {
|
||||
try {
|
||||
@ -148,7 +169,7 @@ public class Placeholders {
|
||||
|
||||
try {
|
||||
//if it is a regular custom item
|
||||
ItemStack confItm = plugin.itemCreate.makeItemFromConfig(plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + matLoc),p,true,true, false);
|
||||
ItemStack confItm = plugin.itemCreate.makeItemFromConfig(panel,plugin.openPanels.getOpenPanel(p.getName()).getConfig().getConfigurationSection("custom-item." + matLoc),p,true,true, false);
|
||||
if(plugin.itemCreate.isIdentical(confItm,itm)){
|
||||
isIdentical = true;
|
||||
}
|
||||
@ -214,7 +235,7 @@ public class Placeholders {
|
||||
int end = str.indexOf("%", str.indexOf("%cp-setdata-") + 1);
|
||||
String point_value = str.substring(start, end).replace("%cp-setdata-", "").replace("%", "");
|
||||
String command = "set-data= " + point_value.split(",")[0] + " " + point_value.split(",")[1];
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
plugin.commandTags.commandTags(panel,p, plugin.tex.papi(panel,p,command),command);
|
||||
str = str.replace(str.substring(start, end) + "%", "");
|
||||
}catch (Exception ex){
|
||||
plugin.debug(ex,p);
|
||||
@ -228,7 +249,7 @@ public class Placeholders {
|
||||
int end = str.indexOf("%", str.indexOf("%cp-mathdata-") + 1);
|
||||
String point_value = str.substring(start, end).replace("%cp-mathdata-", "").replace("%", "");
|
||||
String command = "math-data= " + point_value.split(",")[0] + " " + point_value.split(",")[1];
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
plugin.commandTags.commandTags(panel,p, plugin.tex.papi(panel,p,command),command);
|
||||
str = str.replace(str.substring(start, end) + "%", "");
|
||||
}catch (Exception ex){
|
||||
plugin.debug(ex,p);
|
||||
@ -244,7 +265,7 @@ public class Placeholders {
|
||||
String playerLocation = str.substring(start, end).replace("%cp-player-online-", "");
|
||||
Player[] playerFind = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]);
|
||||
if (Integer.parseInt(playerLocation) > playerFind.length) {
|
||||
str = str.replace(str.substring(start, end) + "-find%", plugin.papi(Objects.requireNonNull(plugin.config.getString("config.format.offline"))));
|
||||
str = str.replace(str.substring(start, end) + "-find%", plugin.tex.papi(Objects.requireNonNull(plugin.config.getString("config.format.offline"))));
|
||||
} else {
|
||||
str = str.replace(str.substring(start, end) + "-find%", playerFind[Integer.parseInt(playerLocation) - 1].getName());
|
||||
}
|
||||
@ -280,7 +301,7 @@ public class Placeholders {
|
||||
List<String> inputMessages = new ArrayList<String>(plugin.config.getStringList("config.input-message"));
|
||||
for (String temp : inputMessages) {
|
||||
temp = temp.replaceAll("%cp-args%", Objects.requireNonNull(plugin.config.getString("config.input-cancel")));
|
||||
p.sendMessage(plugin.papi(p, temp));
|
||||
p.sendMessage(plugin.tex.papi(panel,p, temp));
|
||||
}
|
||||
str = "cpc";
|
||||
}
|
@ -32,7 +32,7 @@ public class Commandpanel implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if(panel == null){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
|
||||
return true;
|
||||
}
|
||||
boolean disableCommand = false;
|
||||
@ -49,21 +49,21 @@ public class Commandpanel implements CommandExecutor {
|
||||
if(args.length == 2){
|
||||
if(!args[1].equals("item")){
|
||||
if(!disableCommand) {
|
||||
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panel, true);
|
||||
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panel.copy(), true);
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> [item] [player]"));
|
||||
sender.sendMessage(plugin.tex.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]),panel.getConfig(),true);
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> item [player]"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> item [player]"));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please execute command directed to a Player!"));
|
||||
sender.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Please execute command directed to a Player!"));
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
@ -72,7 +72,7 @@ public class Commandpanel implements CommandExecutor {
|
||||
//do player command
|
||||
if (args.length == 1) {
|
||||
if(!disableCommand) {
|
||||
plugin.openVoids.openCommandPanel(sender, p, panel, false);
|
||||
plugin.openVoids.openCommandPanel(sender, p, panel.copy(), false);
|
||||
}
|
||||
return true;
|
||||
}else if(args.length == 2){
|
||||
@ -80,7 +80,7 @@ public class Commandpanel implements CommandExecutor {
|
||||
plugin.openVoids.giveHotbarItem(sender, p, panel.getConfig(), false);
|
||||
}else{
|
||||
if(!disableCommand) {
|
||||
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panel, true);
|
||||
plugin.openVoids.openCommandPanel(sender, plugin.getServer().getPlayer(args[1]), panel.copy(), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -90,7 +90,7 @@ public class Commandpanel implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> [player:item] [player]"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cp <panel> [player:item] [player]"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -20,27 +20,27 @@ public class Commandpanelsdebug implements CommandExecutor {
|
||||
//command /cpd
|
||||
if(!(sender instanceof Player)) {
|
||||
plugin.debug.consoleDebug = !plugin.debug.consoleDebug;
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Global Debug Mode: " + plugin.debug.consoleDebug));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.GREEN + "Global Debug Mode: " + plugin.debug.consoleDebug));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = (Player)sender;
|
||||
if(plugin.debug.isEnabled(p)){
|
||||
plugin.debug.debugSet.remove(p);
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Personal Debug Mode Disabled!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.GREEN + "Personal Debug Mode Disabled!"));
|
||||
}else{
|
||||
plugin.debug.debugSet.add(p);
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Personal Debug Mode Enabled!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.GREEN + "Personal Debug Mode Enabled!"));
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cpd"));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -23,11 +23,11 @@ public class Commandpanelslist implements CommandExecutor {
|
||||
//check to make sure the panels isn't empty
|
||||
try {
|
||||
if (plugin.panelList == null) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "No panels found!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "No panels found!"));
|
||||
return true;
|
||||
}
|
||||
}catch(Exception b){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "No panels found!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "No panels found!"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -39,10 +39,10 @@ public class Commandpanelslist implements CommandExecutor {
|
||||
page = Integer.parseInt(args[0]);
|
||||
skip = page*8-8;
|
||||
}catch (Exception e){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Inaccessible Page"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Inaccessible Page"));
|
||||
}
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.DARK_AQUA + "Panels: (Page " + page + ")"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.DARK_AQUA + "Panels: (Page " + page + ")"));
|
||||
for (int f = skip; panels.size() > f && skip+8 > f; f++) {
|
||||
sender.sendMessage(ChatColor.DARK_GREEN + panels.get(f).getFile().getAbsolutePath().replace(plugin.panelsf.getAbsolutePath(),"") + ChatColor.GREEN + " " + panels.get(f).getName());
|
||||
if(panels.size()-1 == f){
|
||||
@ -51,11 +51,11 @@ public class Commandpanelslist implements CommandExecutor {
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "Type /cpl " + (page+1) + " to read next page");
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpl"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cpl"));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -42,14 +42,14 @@ public class Commandpanelsreload implements CommandExecutor {
|
||||
registerCommands();
|
||||
}
|
||||
|
||||
plugin.tag = plugin.papi(plugin.config.getString("config.format.tag") + " ");
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.reload")));
|
||||
plugin.tag = plugin.tex.papi(plugin.config.getString("config.format.tag") + " ");
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.reload")));
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpr"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cpr"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -19,29 +19,29 @@ public class Commandpanelversion implements CommandExecutor {
|
||||
if (sender.hasPermission("commandpanel.version")) {
|
||||
//version command
|
||||
String latestVersion = plugin.updater.githubNewUpdate(false);
|
||||
sender.sendMessage(plugin.papi(plugin.tag));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag));
|
||||
sender.sendMessage(ChatColor.GREEN + "This Version " + ChatColor.GRAY + plugin.getDescription().getVersion());
|
||||
sender.sendMessage(ChatColor.GREEN + "Latest Version " + ChatColor.GRAY + latestVersion);
|
||||
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(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
}else if(args.length == 1){
|
||||
if (sender.hasPermission("commandpanel.update")) {
|
||||
if (args[0].equals("cancel")) {
|
||||
plugin.updater.downloadVersionManually = null;
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Will not download a new version on restart."));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.GREEN + "Will not download a new version on restart."));
|
||||
} else {
|
||||
plugin.updater.downloadVersionManually = args[0];
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Downloading version " + ChatColor.GRAY + args[0] + ChatColor.GREEN + " upon server restart."));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.GREEN + "Downloading version " + ChatColor.GRAY + args[0] + ChatColor.GREEN + " upon server restart."));
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpv [update:latest:cancel]"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cpv [update:latest:cancel]"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
package me.rockyhawk.commandpanels.customcommands;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CommandPlaceholderLoader {
|
||||
CommandPanels plugin;
|
||||
public CommandPlaceholderLoader(CommandPanels pl) {
|
||||
this.plugin = pl;
|
||||
}
|
||||
|
||||
ArrayList<String[]> pendingPlaceholders = new ArrayList<>(); //should read: panelName, playerName, placeholder, argument
|
||||
|
||||
//this will be used with the cpPlaceholder void, when the panel is closed it will remove the placeholder
|
||||
public void addCCP(String panelName, String playerName, String placeholder, String argument){
|
||||
pendingPlaceholders.add(new String[]{panelName,playerName,placeholder,argument});
|
||||
}
|
||||
|
||||
//will remove all pending placeholders for a certain player & panel
|
||||
public void removeCCP(String panelName, String playerName){
|
||||
for(int i = 0; i < pendingPlaceholders.size(); i++){
|
||||
if(playerName.equals(pendingPlaceholders.get(i)[1]) && panelName.equals(pendingPlaceholders.get(i)[0])){
|
||||
pendingPlaceholders.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//will return placeholder,argument
|
||||
public ArrayList<String[]> getCCP(String playerName){
|
||||
ArrayList<String[]> returnPlaceholders = new ArrayList<>();
|
||||
for(String[] temp : pendingPlaceholders){
|
||||
if(temp[1].equals(playerName)){
|
||||
returnPlaceholders.add(new String[]{temp[2],temp[3]});
|
||||
}
|
||||
}
|
||||
return returnPlaceholders;
|
||||
}
|
||||
|
||||
//change a placeholder for a panel
|
||||
public void editCCP(String panelName, String playerName, String placeholder, String argument){
|
||||
for(int i = 0; i < pendingPlaceholders.size(); i++){
|
||||
if(playerName.equals(pendingPlaceholders.get(i)[1]) && panelName.equals(pendingPlaceholders.get(i)[0]) && placeholder.equals(pendingPlaceholders.get(i)[2])){
|
||||
pendingPlaceholders.remove(i);
|
||||
pendingPlaceholders.add(new String[]{panelName,playerName,placeholder,argument});
|
||||
return;
|
||||
}
|
||||
}
|
||||
//if it reaches here it has not found the placeholder, add it manually
|
||||
pendingPlaceholders.add(new String[]{panelName,playerName,placeholder,argument});
|
||||
}
|
||||
}
|
@ -44,10 +44,11 @@ public class Commandpanelcustom implements Listener {
|
||||
|
||||
if(correctCommand){
|
||||
e.setCancelled(true);
|
||||
Panel openPanel = panel.copy();
|
||||
for(String[] placeholder : placeholders){
|
||||
plugin.customCommand.addCCP(panel.getName(),e.getPlayer().getName(),placeholder[0],placeholder[1]);
|
||||
openPanel.placeholders.addPlaceholder(placeholder[0],placeholder[1]);
|
||||
}
|
||||
panel.open(e.getPlayer());
|
||||
openPanel.open(e.getPlayer());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package me.rockyhawk.commandpanels.customcommands;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PanelPlaceholders {
|
||||
public HashMap<String,String> keys;
|
||||
|
||||
public void addPlaceholder(String placeholder, String argument){
|
||||
keys.put(placeholder,argument);
|
||||
}
|
||||
|
||||
public PanelPlaceholders(){
|
||||
keys = new HashMap<>();
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ public class PanelDataLoader {
|
||||
originalValue = new BigDecimal(dataConfig.getString("playerData." + playerUUID + "." + dataPoint));
|
||||
}catch(Exception ex){
|
||||
plugin.debug(ex,null);
|
||||
originalValue = BigDecimal.ONE;
|
||||
originalValue = new BigDecimal("1");
|
||||
}
|
||||
|
||||
BigDecimal output;
|
||||
|
@ -18,7 +18,7 @@ public class Commandpanelsgenerate implements CommandExecutor {
|
||||
@EventHandler
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
@ -31,30 +31,30 @@ public class Commandpanelsgenerate implements CommandExecutor {
|
||||
Inventory i = Bukkit.createInventory(null, Integer.parseInt(args[0]) * 9, "Generate New Panel");
|
||||
p.openInventory(i);
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please use integer from 1-6."));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Please use integer from 1-6."));
|
||||
}
|
||||
}catch(Exception exc){
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please use integer from 1-6."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Generate Mode Disabled!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Generate Mode Disabled!"));
|
||||
} else {
|
||||
this.plugin.generateMode.add(p);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Generate Mode Enabled!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Generate Mode Enabled!"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
|
||||
return true;
|
||||
}else{
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cpg [rows]"));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -79,7 +79,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(plugin.tag + ChatColor.RED + "Cancelled Panel!"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Cancelled Panel!"));
|
||||
return;
|
||||
}
|
||||
YamlConfiguration file;
|
||||
@ -111,9 +111,9 @@ public class GenUtils implements Listener {
|
||||
|
||||
try {
|
||||
file.save(new File(plugin.panelsf + File.separator + date + ".yml"));
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Saved Generated File To: " + date + ".yml"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Saved Generated File To: " + date + ".yml"));
|
||||
} catch (IOException var16) {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could Not Save Generated Panel!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could Not Save Generated Panel!"));
|
||||
}
|
||||
plugin.reloadPanelFiles();
|
||||
}
|
||||
|
@ -21,16 +21,16 @@ public class CpIngameEditCommand implements CommandExecutor {
|
||||
@EventHandler
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if(!sender.hasPermission("commandpanel.edit")){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag + ChatColor.RED + "Editor disabled!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Editor disabled!"));
|
||||
return true;
|
||||
}
|
||||
if(!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
sender.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
return true;
|
||||
}
|
||||
Player p = (Player)sender;
|
||||
@ -39,7 +39,7 @@ public class CpIngameEditCommand implements CommandExecutor {
|
||||
for(Panel panel : plugin.panelList){
|
||||
if(panel.getName().equals(args[0])) {
|
||||
//below will start the command, once it got the right file and panel
|
||||
plugin.createGUI.openGui(panel, p,3,0);
|
||||
plugin.createGUI.openGui(panel.copy(), p,3,0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ public class CpIngameEditCommand implements CommandExecutor {
|
||||
plugin.editorGuis.openEditorGui(p,0);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpe <panel>"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Usage: /cpe <panel>"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class EditorUserInput implements Listener {
|
||||
cf = panel.getConfig();
|
||||
cfile = YamlConfiguration.loadConfiguration(panel.getFile());
|
||||
panelFile = panel.getFile();
|
||||
panelTitle = plugin.papi(cf.getString("title"));
|
||||
panelTitle = plugin.tex.papi(cf.getString("title"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class EditorUserInput implements Listener {
|
||||
if(e.getMessage().equalsIgnoreCase(plugin.config.getString("config.input-cancel"))){
|
||||
plugin.editorInputStrings.remove(temp);
|
||||
plugin.reloadPanelFiles();
|
||||
e.getPlayer().sendMessage(plugin.papi( Objects.requireNonNull(plugin.config.getString("config.input-cancelled"))));
|
||||
e.getPlayer().sendMessage(plugin.tex.papi( Objects.requireNonNull(plugin.config.getString("config.input-cancelled"))));
|
||||
return;
|
||||
}
|
||||
plugin.editorInputStrings.remove(temp);
|
||||
@ -121,101 +121,101 @@ public class EditorUserInput implements Listener {
|
||||
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( plugin.tag + ChatColor.GREEN + "Deleted Panel!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Deleted Panel!"));
|
||||
}else{
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could Not Delete Panel!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Deleted Panel!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Deleted Panel!"));
|
||||
}else{
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could Not Delete Panel!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could Not Delete Panel!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "panel.perm":
|
||||
if(e.getMessage().contains(" ")){
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Permission cannot contain spaces!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Permission cannot contain spaces!"));
|
||||
break;
|
||||
}
|
||||
cf.set("perm", e.getMessage());
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Permission required is now " + "commandpanel.panel." + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Choose an integer between 1 to 6!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set Panel to " + rows + " rows!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Set Panel to " + rows + " rows!"));
|
||||
} catch (Exception io) {
|
||||
plugin.debug(io,p);
|
||||
}
|
||||
break;
|
||||
case "panel.title":
|
||||
if(panelTitle.equals(plugin.papi(e.getMessage()))){
|
||||
p.sendMessage(plugin.papi(plugin.tag + e.getMessage() + ChatColor.RED + " is in use from another panel!"));
|
||||
if(panelTitle.equals(plugin.tex.papi(e.getMessage()))){
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set new Title to " + ChatColor.WHITE + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Panel name cannot contain spaces!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Panel name cannot contain spaces!"));
|
||||
break;
|
||||
}
|
||||
if(panelName.equals(e.getMessage())){
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + e.getMessage() + " is in use from another panel!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set new Name to " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Empty materials have been removed."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + e.getMessage() + " is not a valid Material!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set Empty material to " + materialTemp));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Sounds have been removed."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + e.getMessage() + " is not a valid Sound!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Sound when opening is now " + tempSound));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Sound when opening is now " + tempSound));
|
||||
break;
|
||||
case "panel.panelType.add":
|
||||
List<String> typeAdd = new ArrayList<>();
|
||||
@ -225,20 +225,20 @@ public class EditorUserInput implements Listener {
|
||||
typeAdd.add(e.getMessage().toLowerCase());
|
||||
cf.set("panelType", typeAdd);
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new panel type: " + e.getMessage().toLowerCase()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "No types found to remove!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Could not find type!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find type!"));
|
||||
break;
|
||||
}
|
||||
if(typeRemove.size() == 0){
|
||||
@ -247,7 +247,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("panelType", typeRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed panel type " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed panel type " + e.getMessage()));
|
||||
break;
|
||||
case "panel.commands.add":
|
||||
List<String> commandsAdd = new ArrayList<>();
|
||||
@ -257,20 +257,20 @@ public class EditorUserInput implements Listener {
|
||||
commandsAdd.add(e.getMessage());
|
||||
cf.set("commands", commandsAdd);
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "No commands found to remove!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
break;
|
||||
}
|
||||
if(commandsRemove.size() == 0){
|
||||
@ -279,7 +279,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("commands", commandsRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
break;
|
||||
case "panel.commands-on-open.add":
|
||||
List<String> commandsOnOpenAdd = new ArrayList<>();
|
||||
@ -289,20 +289,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( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "No commands found to remove!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
break;
|
||||
}
|
||||
if(commandsOnOpenRemove.size() == 0){
|
||||
@ -311,7 +311,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("commands-on-open", commandsOnOpenRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
break;
|
||||
case "panel.disabled-worlds.add":
|
||||
List<String> disabledWorldsAdd = new ArrayList<>();
|
||||
@ -321,20 +321,20 @@ public class EditorUserInput implements Listener {
|
||||
disabledWorldsAdd.add(e.getMessage());
|
||||
cf.set("disabled-worlds", disabledWorldsAdd);
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new World: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "No Worlds found to remove!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Could not find World!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find World!"));
|
||||
break;
|
||||
}
|
||||
if(disabledWorldsRemove.size() == 0){
|
||||
@ -343,13 +343,13 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("disabled-worlds", disabledWorldsRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed World line " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Hotbar item have been removed."));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Hotbar item have been removed."));
|
||||
//after an open-with-item has been altered, reload after changes
|
||||
plugin.reloadPanelFiles();
|
||||
break;
|
||||
@ -359,7 +359,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("open-with-item.name", panelName + " Item");
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set new Material to " + ChatColor.WHITE + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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;
|
||||
@ -367,17 +367,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( plugin.tag + ChatColor.GREEN + "Hotbar item can now be moved."));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Hotbar item can now be moved."));
|
||||
break;
|
||||
}
|
||||
try {
|
||||
int loc = Integer.parseInt(e.getMessage());
|
||||
if (loc >= 34 || loc <= -1) {
|
||||
//if the number isn't between 1-9
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Choose an integer between 0 to 33!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Choose an integer between 0 to 33!"));
|
||||
return;
|
||||
}
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Set Hotbar Location to " + loc + "!"));
|
||||
p.sendMessage(plugin.tex.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);
|
||||
@ -389,7 +389,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( plugin.tag + ChatColor.GREEN + "Set new Name to " + ChatColor.WHITE + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Set new Name to " + ChatColor.WHITE + e.getMessage()));
|
||||
break;
|
||||
case "panel.hotbar.lore.add":
|
||||
List<String> loreAdd = new ArrayList<>();
|
||||
@ -399,20 +399,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( plugin.tag + ChatColor.GREEN + "Added new lore: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "No lore found to remove!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Could not find lore!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find lore!"));
|
||||
break;
|
||||
}
|
||||
if(loreRemove.size() == 0){
|
||||
@ -421,7 +421,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("open-with-item.lore", loreRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed lore line " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed lore line " + e.getMessage()));
|
||||
break;
|
||||
case "panel.hotbar.commands.add":
|
||||
List<String> commandAdd = new ArrayList<>();
|
||||
@ -431,20 +431,20 @@ public class EditorUserInput implements Listener {
|
||||
commandAdd.add(e.getMessage());
|
||||
cf.set("open-with-item.commands", commandAdd);
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
||||
break;
|
||||
case "panel.hotbar.commands.remove":
|
||||
List<String> commandRemove;
|
||||
if(cf.contains("open-with-item.commands")){
|
||||
commandRemove = cf.getStringList("open-with-item.commands");
|
||||
}else{
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No commands found to remove!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "No commands found to remove!"));
|
||||
break;
|
||||
}
|
||||
try {
|
||||
commandRemove.remove(Integer.parseInt(e.getMessage())-1);
|
||||
}catch (Exception ex){
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
break;
|
||||
}
|
||||
if(commandRemove.size() == 0){
|
||||
@ -453,7 +453,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("open-with-item.commands", commandRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -472,41 +472,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( plugin.tag + ChatColor.GREEN + "Name is now default."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set new name to " + ChatColor.WHITE + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Material is now default."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set Material value to " + ChatColor.WHITE + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Item has been unstacked."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Choose an integer between 1 to 64!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set stack to " + rows + "!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Set stack to " + rows + "!"));
|
||||
} catch (Exception io) {
|
||||
plugin.debug(io,p);
|
||||
}
|
||||
@ -515,45 +515,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( plugin.tag + ChatColor.GREEN + "Enchantments have been removed."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set new Enchantment to " + ChatColor.WHITE + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Potion effects have been removed."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set new Potion to " + e.getMessage().toUpperCase()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Custom Model Data has been removed."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Custom Model Data set to " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Leather armor colour has been removed."));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Leather armor colour set to " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Leather armor colour set to " + e.getMessage()));
|
||||
break;
|
||||
case "commands:add":
|
||||
List<String> commandsOnOpenAdd = new ArrayList<>();
|
||||
@ -563,20 +563,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( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "No commands found to remove!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
plugin.debug(ex,p);
|
||||
break;
|
||||
}
|
||||
@ -586,7 +586,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("item." + itemSlot + ".commands", commandsOnOpenRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
break;
|
||||
case "lore:add":
|
||||
List<String> loreOnOpenAdd = new ArrayList<>();
|
||||
@ -596,20 +596,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( plugin.tag + ChatColor.GREEN + "Added new lore: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "No lore found to remove!"));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.RED + "Could not find lore!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "Could not find lore!"));
|
||||
plugin.debug(ex,p);
|
||||
break;
|
||||
}
|
||||
@ -619,7 +619,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("item." + itemSlot + ".lore", loreOnOpenRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed lore line " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed lore line " + e.getMessage()));
|
||||
break;
|
||||
case "duplicate:add":
|
||||
if(cf.contains("item." + itemSlot + ".duplicate")){
|
||||
@ -628,7 +628,7 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("item." + itemSlot + ".duplicate", e.getMessage());
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new duplicate item/s: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Added new duplicate item/s: " + e.getMessage()));
|
||||
break;
|
||||
case "duplicate:remove":
|
||||
if(cf.contains("item." + itemSlot + ".duplicate")){
|
||||
@ -644,7 +644,7 @@ public class EditorUserInput implements Listener {
|
||||
}
|
||||
cf.set("item." + itemSlot + ".duplicate", items.toString());
|
||||
} catch (Exception ex) {
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could not delete or find item!"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Could not delete or find item!"));
|
||||
plugin.debug(ex,p);
|
||||
break;
|
||||
}
|
||||
@ -655,11 +655,11 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("item." + itemSlot + ".duplicate", null);
|
||||
}
|
||||
}else{
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No items found to remove!"));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.RED + "No items found to remove!"));
|
||||
break;
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed duplicate item/s: " + e.getMessage()));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Removed duplicate item/s: " + e.getMessage()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -682,19 +682,19 @@ public class EditorUserInput implements Listener {
|
||||
cf.set("item." + itemSection + "." + playerMessage + ".name", "");
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
plugin.reloadPanelFiles();
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added Section " + ChatColor.WHITE + playerMessage));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Removed Section " + ChatColor.WHITE + playerMessage));
|
||||
p.sendMessage(plugin.tex.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( plugin.tag + ChatColor.GREEN + "Set " + playerMessage.split(":")[0] + " to " + ChatColor.WHITE + playerMessage.split(":")[1]));
|
||||
p.sendMessage(plugin.tex.papi( plugin.tag + ChatColor.GREEN + "Set " + playerMessage.split(":")[0] + " to " + ChatColor.WHITE + playerMessage.split(":")[1]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class EditorUtils implements Listener {
|
||||
return;
|
||||
}
|
||||
}catch(NullPointerException nu){return;}
|
||||
if(!p.getOpenInventory().getTitle().equals(ChatColor.stripColor(plugin.papi("Command Panels Editor"))) || plugin.openPanels.hasPanelOpen(p.getName())){
|
||||
if(!p.getOpenInventory().getTitle().equals(ChatColor.stripColor(plugin.tex.papi("Command Panels Editor"))) || plugin.openPanels.hasPanelOpen(p.getName())){
|
||||
return;
|
||||
}
|
||||
if(e.getClickedInventory() != e.getView().getTopInventory()){
|
||||
@ -47,8 +47,8 @@ public class EditorUtils implements Listener {
|
||||
ArrayList<ConfigurationSection> panelYaml = new ArrayList<ConfigurationSection>(); //all panels from ALL files (panel yaml files)
|
||||
try {
|
||||
for(Panel panel : plugin.panelList) { //will loop through all the files in folder
|
||||
panelNames.add(plugin.papi(panel.getName()));
|
||||
panelTitles.add(plugin.papi( Objects.requireNonNull(panel.getConfig().getString("title"))));
|
||||
panelNames.add(plugin.tex.papi(panel.getName()));
|
||||
panelTitles.add(plugin.tex.papi( Objects.requireNonNull(panel.getConfig().getString("title"))));
|
||||
panelYaml.add(panel.getConfig());
|
||||
}
|
||||
}catch(Exception fail){
|
||||
@ -337,52 +337,52 @@ public class EditorUtils implements Listener {
|
||||
}
|
||||
if(e.getSlot() == 1){
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.perm"});
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Permission"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Title"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Sound ID"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Command"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter New Command"));
|
||||
}else{
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.commands.remove"});
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Command to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Are you sure? (yes/no)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter Row Amount (1 to 6)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Material ID"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Command"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter Command to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter Command to remove (must be an integer)"));
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
@ -390,10 +390,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(plugin.tag + ChatColor.WHITE + "Enter New Panel type"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter Panel Type to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter Panel Type to remove (must be an integer)"));
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
@ -401,16 +401,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(plugin.tag + ChatColor.WHITE + "Enter New World Name"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter World line to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Name"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter New Name"));
|
||||
p.closeInventory();
|
||||
}
|
||||
if(e.getSlot() == 18){
|
||||
@ -419,38 +419,38 @@ public class EditorUtils implements Listener {
|
||||
}
|
||||
if(e.getSlot() == 40){
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.material"});
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Material"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Name"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Item Lore"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter lore line to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter Location (1 to 9)"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter Location (1 to 9)"));
|
||||
p.closeInventory();
|
||||
}
|
||||
if(e.getSlot() == 44 && hotbarItems){
|
||||
//adds abilities to add and remove lines
|
||||
if(e.getClick().isLeftClick()) {
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.commands.add"});
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Command"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Command"));
|
||||
}else{
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.commands.remove"});
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter command line to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter command line to remove (must be an integer)"));
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
@ -494,38 +494,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(plugin.tag + ChatColor.WHITE + "Enter New Item Name"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Item Command"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter command line to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Item Enchantment"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Item Potion Effect"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter Duplicate Item Location/s"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter Duplicate Item/s to Remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter Duplicate Item/s to Remove (must be an integer)"));
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
@ -533,26 +533,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(plugin.tag + ChatColor.WHITE + "Enter New Item Lore"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter lore line to remove (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Item Stack (must be an integer)"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Custom Model Data"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter New Leather Armor Colour"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter New Leather Armor Colour"));
|
||||
p.closeInventory();
|
||||
}
|
||||
if(e.getSlot() == 31){
|
||||
@ -562,7 +562,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(plugin.tag + ChatColor.WHITE + "Enter New Custom Material (eg. cps= self)"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter New Custom Material (eg. cps= self)"));
|
||||
p.closeInventory();
|
||||
}
|
||||
if(e.getSlot() == 27){
|
||||
@ -627,7 +627,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(plugin.tag + ChatColor.WHITE + "Enter Setting to change, eg, value:500"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter Setting to change, eg, value:500"));
|
||||
p.closeInventory();
|
||||
}
|
||||
}
|
||||
@ -635,13 +635,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(plugin.tag + ChatColor.WHITE + "Enter Section name to remove, eg, hasperm or hasperm0"));
|
||||
p.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + "Enter Section name to add, eg, hasperm or hasperm0"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.WHITE + "Enter Section name to add, eg, hasperm or hasperm0"));
|
||||
p.closeInventory();
|
||||
}
|
||||
|
||||
@ -720,9 +720,9 @@ public class EditorUtils implements Listener {
|
||||
config = plugin.itemCreate.generatePanelFile(panelName,inv,config);
|
||||
try {
|
||||
config.save(file);
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Saved Changes!"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.GREEN + "Saved Changes!"));
|
||||
} catch (IOException s) {
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could Not Save Changes!"));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Could Not Save Changes!"));
|
||||
plugin.debug(s,p);
|
||||
}
|
||||
plugin.reloadPanelFiles();
|
||||
|
@ -19,7 +19,7 @@ public class CommandpanelUserInput implements Listener {
|
||||
if(plugin.userInputStrings.get(o)[0].equals(e.getPlayer().getName())){
|
||||
if(e.getMessage().equalsIgnoreCase(plugin.config.getString("config.input-cancel"))){
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().sendMessage(plugin.papi( Objects.requireNonNull(plugin.config.getString("config.input-cancelled"))));
|
||||
e.getPlayer().sendMessage(plugin.tex.papi( Objects.requireNonNull(plugin.config.getString("config.input-cancelled"))));
|
||||
for(int i = 0; plugin.userInputStrings.size() > i; i++){
|
||||
if(plugin.userInputStrings.get(i)[0].equals(e.getPlayer().getName())){
|
||||
plugin.userInputStrings.remove(i);
|
||||
@ -35,7 +35,7 @@ public class CommandpanelUserInput implements Listener {
|
||||
e.setCancelled(true);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
new CommandTags(plugin).commandTags(e.getPlayer(), plugin.papi(e.getPlayer(),command), command); //I have to do this to run regular Bukkit voids in an ASYNC Event
|
||||
new CommandTags(plugin).commandTags(null,e.getPlayer(), plugin.tex.papi(null,e.getPlayer(),command), command); //I have to do this to run regular Bukkit voids in an ASYNC Event
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class OpenGUI {
|
||||
String title;
|
||||
if (onOpen != 3) {
|
||||
//regular inventory
|
||||
title = plugin.papi(p,pconfig.getString("title"));
|
||||
title = plugin.tex.papi(panel,p,pconfig.getString("title"));
|
||||
} else {
|
||||
//editor inventory
|
||||
title = "Editing Panel: " + panel.getName();
|
||||
@ -46,7 +46,7 @@ public class OpenGUI {
|
||||
String section = "";
|
||||
//onOpen needs to not be 3 so the editor won't include hasperm and hasvalue, etc items
|
||||
if (onOpen != 3) {
|
||||
section = plugin.itemCreate.hasSection(pconfig.getConfigurationSection("item." + Integer.parseInt(item)), p);
|
||||
section = plugin.itemCreate.hasSection(panel,pconfig.getConfigurationSection("item." + Integer.parseInt(item)), p);
|
||||
//This section is for animations below here: VISUAL ONLY
|
||||
|
||||
//check for if there is animations inside the items section
|
||||
@ -59,7 +59,7 @@ public class OpenGUI {
|
||||
}
|
||||
|
||||
//will only add NBT if not an editor GUI
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(Objects.requireNonNull(pconfig.getConfigurationSection("item." + item + section)), p, onOpen != 3, onOpen != 3, onOpen != 3);
|
||||
ItemStack s = plugin.itemCreate.makeItemFromConfig(panel,Objects.requireNonNull(pconfig.getConfigurationSection("item." + item + section)), p, onOpen != 3, onOpen != 3, onOpen != 3);
|
||||
|
||||
//This is for CUSTOM ITEMS
|
||||
if(pconfig.contains("item." + item + section + ".itemType")) {
|
||||
@ -111,7 +111,7 @@ public class OpenGUI {
|
||||
} catch (ArrayIndexOutOfBoundsException var24) {
|
||||
plugin.debug(var24,p);
|
||||
if (plugin.debug.isEnabled(p)) {
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " item: One of the items does not fit in the Panel!"));
|
||||
p.sendMessage(plugin.tex.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());
|
||||
}
|
||||
@ -139,7 +139,7 @@ public class OpenGUI {
|
||||
}
|
||||
} catch (IllegalArgumentException | NullPointerException var26) {
|
||||
plugin.debug(var26,p);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " empty: " + pconfig.getString("empty")));
|
||||
p.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.error") + " empty: " + pconfig.getString("empty")));
|
||||
p.closeInventory();
|
||||
plugin.openPanels.closePanelForLoader(p.getName());
|
||||
return null;
|
||||
|
@ -78,7 +78,6 @@ public class OpenPanelsLoader {
|
||||
return;
|
||||
}
|
||||
panelCloseCommands(playerName,openPanels.get(playerName));
|
||||
plugin.customCommand.removeCCP(openPanels.get(playerName).getName(), playerName);
|
||||
if (plugin.config.contains("config.panel-snooper")) {
|
||||
if (Objects.requireNonNull(plugin.config.getString("config.panel-snooper")).equalsIgnoreCase("true")) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels] " + playerName + " Closed " + openPanels.get(playerName).getName());
|
||||
@ -103,7 +102,7 @@ public class OpenPanelsLoader {
|
||||
break;
|
||||
}
|
||||
if(val == 2){
|
||||
plugin.commandTags.commandTags(Bukkit.getPlayer(playerName), plugin.papi(Bukkit.getPlayer(playerName),command), command);
|
||||
plugin.commandTags.commandTags(panel,Bukkit.getPlayer(playerName), plugin.tex.papi(panel,Bukkit.getPlayer(playerName),command), command);
|
||||
}
|
||||
}
|
||||
}catch(Exception s){
|
||||
|
@ -22,7 +22,7 @@ public class HotbarItemLoader {
|
||||
stationaryItems.clear();
|
||||
for (Panel panel : plugin.panelList) {
|
||||
if(panel.getConfig().contains("open-with-item.stationary")){
|
||||
stationaryItems.put(panel.getConfig().getInt("open-with-item.stationary"), panel);
|
||||
stationaryItems.put(panel.getConfig().getInt("open-with-item.stationary"), panel.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class HotbarItemLoader {
|
||||
}
|
||||
if(panel.getConfig().contains("open-with-item.commands")){
|
||||
for(String command : panel.getConfig().getStringList("open-with-item.commands")){
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
plugin.commandTags.commandTags(panel,p, plugin.tex.papi(null,p,command),command);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -84,7 +84,7 @@ public class HotbarItemLoader {
|
||||
}
|
||||
if(panel.getConfig().contains("open-with-item.commands")){
|
||||
for(String command : panel.getConfig().getStringList("open-with-item.commands")){
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
plugin.commandTags.commandTags(panel,p, plugin.tex.papi(null,p,command),command);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
if(args.length >= 2) {
|
||||
if (args[0].equalsIgnoreCase("add")) {
|
||||
if(!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
|
||||
return true;
|
||||
}
|
||||
boolean foundPanel = false;
|
||||
@ -43,12 +43,12 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
if(!foundPanel){
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag + ChatColor.RED + "Look at a block to add a panel!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Look at a block to add a panel!"));
|
||||
return true;
|
||||
}
|
||||
Location blockLocation = blockType.getLocation();
|
||||
@ -60,16 +60,16 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));
|
||||
} catch (IOException e) {
|
||||
plugin.debug(e,p);
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could not save to file!"));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag + ChatColor.WHITE + args[1] + ChatColor.GREEN + " will now open when right clicking " + ChatColor.WHITE + materialNameFormatted));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -77,13 +77,13 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
if(args.length == 1){
|
||||
if (args[0].equalsIgnoreCase("remove")) {
|
||||
if(!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
|
||||
return true;
|
||||
}
|
||||
Block blockType = p.getTargetBlock(null, 5);
|
||||
@ -95,40 +95,40 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));
|
||||
} catch (IOException e) {
|
||||
plugin.debug(e,p);
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Could not save to file!"));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.RED + "Could not save to file!"));
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Panel has been removed from block."));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + ChatColor.GREEN + "Panel has been removed from block."));
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.nopanel")));
|
||||
}
|
||||
return true;
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag + ChatColor.RED + "Panel blocks disabled in config!"));
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag) + ChatColor.RED + "No panel blocks found.");
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag) + ChatColor.RED + "No panel blocks found.");
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(plugin.papi(plugin.tag) + ChatColor.DARK_AQUA + "Panel Block Locations:");
|
||||
sender.sendMessage(plugin.tex.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(plugin.tag) + ChatColor.RED + "No panel blocks found.");
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag) + ChatColor.RED + "No panel blocks found.");
|
||||
}
|
||||
return true;
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
sender.sendMessage(plugin.tex.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -43,13 +43,13 @@ public class PanelBlockOnClick implements Listener {
|
||||
e.setCancelled(true);
|
||||
if(plugin.blockConfig.contains("blocks." + configLocation + ".commands")){
|
||||
for(String command : plugin.blockConfig.getStringList("blocks." + configLocation + ".commands")){
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
plugin.commandTags.commandTags(null,p, plugin.tex.papi(null,p,command),command);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//uses the open= tag because it will open a panel with panel names, but also works with open= features like placeholders
|
||||
String command = "open= " + plugin.blockConfig.getString("blocks." + configLocation + ".panel");
|
||||
plugin.commandTags.commandTags(p, plugin.papi(p, command), command);
|
||||
plugin.commandTags.commandTags(null,p, plugin.tex.papi(null,p, command), command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package me.rockyhawk.commandpanels.updater;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
@ -19,50 +20,58 @@ public class Updater {
|
||||
//if this is set to something, it will download that version on restart
|
||||
//can be a version number, 'latest' or 'cancel'
|
||||
public String downloadVersionManually = null;
|
||||
public String catchedLatestVersion = "null";
|
||||
|
||||
public String githubNewUpdate(boolean sendMessages){
|
||||
HttpURLConnection connection;
|
||||
String gitVersion;
|
||||
//refresh latest version
|
||||
getLatestVersion(sendMessages);
|
||||
|
||||
if(plugin.getDescription().getVersion().contains("-")){
|
||||
if(sendMessages) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.GREEN + " Running a custom version.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
try{
|
||||
connection = (HttpURLConnection) new URL("https://raw.githubusercontent.com/rockyhawk64/CommandPanels/master/resource/plugin.yml").openConnection();
|
||||
connection.connect();
|
||||
gitVersion = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine().split("\\s")[1];
|
||||
if(gitVersion.contains("-")){
|
||||
if(sendMessages) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " Cannot check for update.");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//if update is true there is a new update
|
||||
boolean update = false;
|
||||
if(!gitVersion.equals(plugin.getDescription().getVersion())){
|
||||
update = true;
|
||||
}
|
||||
|
||||
if(update){
|
||||
if(sendMessages) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.GOLD + " ================================================");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.AQUA + " An update for CommandPanels is available.");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + " Download CommandPanels " + ChatColor.GOLD + gitVersion + ChatColor.WHITE + " using the");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.WHITE + " following command:" + ChatColor.AQUA + " /cpv latest" + ChatColor.WHITE + " and restart the server");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.GOLD + " ================================================");
|
||||
}
|
||||
}
|
||||
return gitVersion;
|
||||
}catch(IOException e){
|
||||
if(sendMessages) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " Error checking for updates online.");
|
||||
}
|
||||
plugin.debug(e,null);
|
||||
//if update is true there is a new update
|
||||
boolean update = false;
|
||||
if(!catchedLatestVersion.equals(plugin.getDescription().getVersion())){
|
||||
update = true;
|
||||
}
|
||||
|
||||
if(update){
|
||||
if(sendMessages) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.GOLD + " ================================================");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.AQUA + " An update for CommandPanels is available.");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + " Download CommandPanels " + ChatColor.GOLD + catchedLatestVersion + ChatColor.WHITE + " using the");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.WHITE + " following command:" + ChatColor.AQUA + " /cpv latest" + ChatColor.WHITE + " and restart the server");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.GOLD + " ================================================");
|
||||
}
|
||||
}
|
||||
return catchedLatestVersion;
|
||||
}
|
||||
|
||||
public void getLatestVersion(boolean sendMessages){
|
||||
//using an array allows editing while still being final
|
||||
new BukkitRunnable(){
|
||||
public void run(){
|
||||
HttpURLConnection connection;
|
||||
try {
|
||||
connection = (HttpURLConnection) new URL("https://raw.githubusercontent.com/rockyhawk64/CommandPanels/master/resource/plugin.yml").openConnection();
|
||||
connection.connect();
|
||||
catchedLatestVersion = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine().split("\\s")[1];
|
||||
connection.disconnect();
|
||||
} catch (IOException ignore) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " Could not access github.");
|
||||
}
|
||||
}
|
||||
}.runTask(plugin);
|
||||
|
||||
if(catchedLatestVersion.contains("-")){
|
||||
if(sendMessages) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.RED + " Cannot check for update.");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//the pluginFileName can only be obtained from the main class
|
||||
|
Loading…
Reference in New Issue
Block a user