3.2.2 Fixes

This commit is contained in:
rockyhawk64 2020-07-07 19:47:14 +10:00
parent 32c4b96894
commit a8bc43be1c
11 changed files with 100 additions and 84 deletions

View File

@ -1,4 +1,4 @@
version: 3.2.1
version: 3.2.2
main: me.rockyhawk.commandPanels.commandpanels
name: CommandPanels
author: RockyHawk

View File

@ -54,7 +54,7 @@ public class commandpanels extends JavaPlugin {
public List<String> panelRunning = new ArrayList();
public List<String[]> userInputStrings = new ArrayList();
public List<String[]> editorInputStrings = new ArrayList();
public ArrayList<YamlConfiguration> panelFiles = new ArrayList<YamlConfiguration>();
public ArrayList<String> panelFiles = new ArrayList<String>(); //names of all the files in the panels folder including extension
public ArrayList<String[]> panelNames = new ArrayList<String[]>(); //this will return something like {"mainMenuPanel","4"} which means the 4 is for panelFiles.get(4). So you know which file it is for
public File panelsf;
@ -1127,8 +1127,12 @@ public class commandpanels extends JavaPlugin {
panelNames.clear();
int count = 0;
for (String fileName : Objects.requireNonNull(panelsf.list())) {
panelFiles.add(YamlConfiguration.loadConfiguration(new File(panelsf + File.separator + fileName)));
for (String tempName : Objects.requireNonNull(panelFiles.get(count).getConfigurationSection("panels")).getKeys(false)) {
int ind = fileName.lastIndexOf(".");
if(!fileName.substring(ind).equalsIgnoreCase(".yml") && !fileName.substring(ind).equalsIgnoreCase(".yaml")){
continue;
}
panelFiles.add(fileName);
for (String tempName : Objects.requireNonNull(YamlConfiguration.loadConfiguration(new File(panelsf + File.separator + fileName)).getConfigurationSection("panels")).getKeys(false)) {
panelNames.add(new String[]{tempName, Integer.toString(count)});
}
count += 1;
@ -1196,7 +1200,8 @@ public class commandpanels extends JavaPlugin {
ArrayList<String> panelTitles = new ArrayList<String>(); //all panels from ALL files (panel titles)
ArrayList<Material> panelItems = new ArrayList<Material>(); //all panels from ALL files (panel materials)
try {
for (YamlConfiguration temp : panelFiles) { //will loop through all the files in folder
for(String fileName : panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(panelsf + File.separator + fileName));
String key;
if (!checkPanels(temp)) {
return;

View File

@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import java.io.File;
import java.util.*;
public class commandpanel implements CommandExecutor {
@ -32,7 +33,8 @@ public class commandpanel implements CommandExecutor {
boolean found = false;
//below is going to go through the files and find the right one
if (args.length != 0) { //check to make sure the person hasn't just left it empty
for (YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
if(!plugin.checkPanels(temp)){
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',tag + plugin.config.getString("config.format.error") + ": Panel with syntax error found!"));
return true;

View File

@ -38,7 +38,8 @@ public class commandpanelcustom implements Listener {
ArrayList<String> apanels = new ArrayList<String>(); //all panels from all files (panel names)
String tpanels; //tpanels is the temp to check through the files
String panel = null;
for (YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){

View File

@ -24,10 +24,9 @@ public class commandpanelslist implements CommandExecutor {
if (label.equalsIgnoreCase("cpl") || label.equalsIgnoreCase("commandpanellist") || label.equalsIgnoreCase("cpanell")) {
if (sender.hasPermission("commandpanel.list")) {
//command /cpl
File panelsf = new File(plugin.getDataFolder() + File.separator + "panels");
//check to make sure the panels folder isn't empty
//check to make sure the panels isn't empty
try {
if (panelsf.list() == null || panelsf.list().length == 0) {
if (plugin.panelFiles == null) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',tag + ChatColor.RED + "No panels found!"));
return true;
}
@ -35,15 +34,14 @@ public class commandpanelslist implements CommandExecutor {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',tag + ChatColor.RED + "No panels found!"));
return true;
}
ArrayList<String> filenames = new ArrayList<String>(Arrays.asList(panelsf.list()));
ArrayList<String> apanels = new ArrayList<String>(); //all panels from all files (panel names)
String tpanels; //tpanels is the temp to check through the files
for (int f = 0; filenames.size() > f; f++) { //will loop through all the files in folder
for (int f = 0; plugin.panelFiles.size() > f; f++) { //will loop through all the files in folder
String key;
YamlConfiguration temp;
tpanels = "";
temp = YamlConfiguration.loadConfiguration(new File(panelsf + File.separator + filenames.get(f)));
apanels.add("%file%" + filenames.get(f));
temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(f)));
apanels.add("%file%" + plugin.panelFiles.get(f));
if(!plugin.checkPanels(temp)){
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',tag + plugin.config.getString("config.format.error") + ": File with no Panels found!"));
return true;

View File

@ -7,6 +7,7 @@ import org.bukkit.command.TabCompleter;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -23,7 +24,8 @@ public class cpTabComplete implements TabCompleter {
ArrayList<String> apanels = new ArrayList<String>(); //all panels
String tpanels; //tpanels is the temp to check through the files
try {
for (YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){

View File

@ -39,7 +39,8 @@ public class newGenUtils implements Listener {
YamlConfiguration cf;
ArrayList<String> apanels = new ArrayList<String>(); //all panels from all files (panel names)
try {
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
if(!plugin.checkPanels(temp)){
continue;
}

View File

@ -7,6 +7,7 @@ import org.bukkit.command.TabCompleter;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -23,7 +24,8 @@ public class cpTabCompleteIngame implements TabCompleter {
ArrayList<String> apanels = new ArrayList<String>(); //all panels
String tpanels; //tpanels is the temp to check through the files
try {
for (YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){

View File

@ -17,6 +17,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;
public class editorUtils implements Listener {
public YamlConfiguration tempEdit;
@ -31,7 +32,7 @@ public class editorUtils implements Listener {
Player p = (Player)e.getWhoClicked();
//if the inventory isn't the editor main window
try {
if (e.getClickedInventory().getType() != InventoryType.CHEST) {
if (Objects.requireNonNull(e.getClickedInventory()).getType() != InventoryType.CHEST) {
return;
}
}catch(NullPointerException nu){return;}
@ -46,15 +47,16 @@ public class editorUtils implements Listener {
ArrayList<String> panelTitles = new ArrayList<String>(); //all panels from ALL files (panel titles)
ArrayList<YamlConfiguration> panelYaml = new ArrayList<YamlConfiguration>(); //all panels from ALL files (panel yaml files)
try {
for (YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
if(!plugin.checkPanels(temp)){
return;
}
for (Iterator var10 = temp.getConfigurationSection("panels").getKeys(false).iterator(); var10.hasNext();) {
key = (String) var10.next();
for (String s : Objects.requireNonNull(temp.getConfigurationSection("panels")).getKeys(false)) {
key = s;
panelNames.add(ChatColor.translateAlternateColorCodes('&', key));
panelTitles.add(ChatColor.translateAlternateColorCodes('&', temp.getString("panels." + key + ".title")));
panelTitles.add(ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(temp.getString("panels." + key + ".title"))));
panelYaml.add(temp);
}
}
@ -66,16 +68,16 @@ public class editorUtils implements Listener {
if(e.getSlot() == 48){
//previous page button
try {
if (e.getCurrentItem().getType() == Material.PAPER) {
if (Objects.requireNonNull(e.getCurrentItem()).getType() == Material.PAPER) {
plugin.openEditorGui(p, -1);
p.updateInventory();
return;
}
}catch(NullPointerException nu){}
}catch(NullPointerException ignored){}
}
if(e.getSlot() == 49){
//sunflower page index
if(e.getCurrentItem().getType() == Material.SUNFLOWER){
if(Objects.requireNonNull(e.getCurrentItem()).getType() == Material.SUNFLOWER){
p.updateInventory();
return;
}
@ -83,12 +85,12 @@ public class editorUtils implements Listener {
if(e.getSlot() == 50){
//next page button
try{
if(e.getCurrentItem().getType() == Material.PAPER){
if(Objects.requireNonNull(e.getCurrentItem()).getType() == Material.PAPER){
plugin.openEditorGui(p, 1);
p.updateInventory();
return;
}
}catch(NullPointerException nu){}
}catch(NullPointerException ignored){}
}
if(e.getSlot() == 45){
//exit button
@ -104,7 +106,7 @@ public class editorUtils implements Listener {
//if left click
int count = 0;
for(String panelName : panelNames){
if(panelName.equals(ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()))){
if(panelName.equals(ChatColor.stripColor(Objects.requireNonNull(e.getCurrentItem().getItemMeta()).getDisplayName()))){
plugin.openGui(panelName, p, panelYaml.get(count),3,0);
return;
}
@ -114,7 +116,7 @@ public class editorUtils implements Listener {
//if right click
int count = 0;
for(String panelName : panelNames){
if(panelName.equals(ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()))){
if(panelName.equals(ChatColor.stripColor(Objects.requireNonNull(e.getCurrentItem().getItemMeta()).getDisplayName()))){
plugin.openPanelSettings(p,panelName,panelYaml.get(count));
return;
}
@ -123,7 +125,7 @@ public class editorUtils implements Listener {
p.updateInventory();
}
}
}catch(NullPointerException nu){}
}catch(NullPointerException ignored){}
}
p.updateInventory();
}
@ -142,17 +144,17 @@ public class editorUtils implements Listener {
boolean found = false;
try {
//neew to loop through files to get file names
for (File tempFile : plugin.panelsf.listFiles()) { //will loop through all the files in folder
for(String fileTempName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
YamlConfiguration temp = YamlConfiguration.loadConfiguration(tempFile);
if(!plugin.checkPanels(temp)){
return;
}
for (Iterator var10 = temp.getConfigurationSection("panels").getKeys(false).iterator(); var10.hasNext();) {
key = (String) var10.next();
if(e.getView().getTitle().equals(ChatColor.GRAY + "Editing Panel: " + ChatColor.translateAlternateColorCodes('&', temp.getString("panels." + key + ".title")))){
for (String s : Objects.requireNonNull(temp.getConfigurationSection("panels")).getKeys(false)) {
key = s;
if (e.getView().getTitle().equals(ChatColor.GRAY + "Editing Panel: " + ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(temp.getString("panels." + key + ".title"))))) {
panelName = key;
fileName = tempFile.getName();
fileName = fileTempName;
file = temp;
found = true;
break;
@ -328,7 +330,8 @@ public class editorUtils implements Listener {
boolean found = false;
try {
//neew to loop through files to get file names
for (YamlConfiguration temp : plugin.panelFiles) { //will loop through all configs
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
if(!plugin.checkPanels(temp)){
return;
}
@ -425,7 +428,8 @@ public class editorUtils implements Listener {
boolean found = false;
try {
//neew to loop through files to get file names
for (YamlConfiguration temp : plugin.panelFiles) { //will loop through all configs
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
if(!plugin.checkPanels(temp)){
return;
}

View File

@ -12,9 +12,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Objects;
public class commandpanelrefresher implements Listener {
commandpanels plugin;
@ -28,7 +26,7 @@ public class commandpanelrefresher implements Listener {
public void onInventoryOpen(InventoryOpenEvent e){ //Handles when Players open inventory
//I have to convert HumanEntity to a player
if (plugin.config.contains("config.refresh-panels")) {
if (plugin.config.getString("config.refresh-panels").trim().equalsIgnoreCase("false")) {
if (Objects.requireNonNull(plugin.config.getString("config.refresh-panels")).trim().equalsIgnoreCase("false")) {
return;
}
}
@ -44,28 +42,27 @@ public class commandpanelrefresher implements Listener {
YamlConfiguration cf = null;
String panel = null;
String panelTitle = null;
ArrayList<String> filenames = new ArrayList<String>(Arrays.asList(plugin.panelsf.list()));
try {
boolean foundPanel = false;
for (int f = 0; filenames.size() > f; f++) { //will loop through all the files in folder
for (String fileName : plugin.panelFiles) { //will loop through all the files in folder
String key;
YamlConfiguration temp;
temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + filenames.get(f)));
if(!plugin.checkPanels(temp)){
p.sendMessage(ChatColor.translateAlternateColorCodes('&',tag + plugin.papi(p, plugin.config.getString("config.format.error") + ": File with no Panels found or Panel with syntax error Found!")));
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
if (!plugin.checkPanels(temp)) {
assert p != null;
p.sendMessage(ChatColor.translateAlternateColorCodes('&', tag + plugin.papi(p, plugin.config.getString("config.format.error") + ": File with no Panels found or Panel with syntax error Found!")));
return;
}
for (Iterator var10 = temp.getConfigurationSection("panels").getKeys(false).iterator(); var10.hasNext();) {
key = (String) var10.next();
if(ChatColor.translateAlternateColorCodes('&',temp.getString("panels." + key + ".title")).equals(e.getView().getTitle())){
for (String s : Objects.requireNonNull(temp.getConfigurationSection("panels")).getKeys(false)) {
key = s;
if (ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(temp.getString("panels." + key + ".title"))).equals(e.getView().getTitle())) {
panel = key;
panelTitle = ChatColor.translateAlternateColorCodes('&',temp.getString("panels." + key + ".title"));
cf = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + filenames.get(f)));
foundPanel= true;
panelTitle = ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(temp.getString("panels." + key + ".title")));
cf = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
foundPanel = true;
break;
}
}
if(foundPanel){
if (foundPanel) {
//this is to avoid the plugin to continue looking when it was already found
break;
}
@ -77,15 +74,17 @@ public class commandpanelrefresher implements Listener {
return;
}
//there is already a runnable running for this player
assert p != null;
if(plugin.panelRunning.contains(p.getName() + ";" + panel)){
return;
}
plugin.panelRunning.add(p.getName() + ";" + panel);
if (plugin.config.contains("config.panel-snooper")) {
if (plugin.config.getString("config.panel-snooper").trim().equalsIgnoreCase("true")) {
if (Objects.requireNonNull(plugin.config.getString("config.panel-snooper")).trim().equalsIgnoreCase("true")) {
Bukkit.getConsoleSender().sendMessage("[CommandPanels] " + p.getName() + " Opened " + panel);
}
}
assert cf != null;
if(cf.contains("panels." + panel + ".animatevalue")){
animatevalue = cf.getInt("panels." + panel + ".animatevalue");
}
@ -98,7 +97,7 @@ public class commandpanelrefresher implements Listener {
@Override
public void run() {
//counter counts to refresh delay (in seconds) then restarts
if(c < Double.parseDouble(plugin.config.getString("config.refresh-delay").trim())){
if(c < Double.parseDouble(Objects.requireNonNull(plugin.config.getString("config.refresh-delay")).trim())){
c+=1;
}else{
c=0;
@ -121,9 +120,9 @@ public class commandpanelrefresher implements Listener {
}
}
}else{
if(plugin.config.getString("config.stop-sound").trim().equalsIgnoreCase("true")){
if(Objects.requireNonNull(plugin.config.getString("config.stop-sound")).trim().equalsIgnoreCase("true")){
try {
p.stopSound(Sound.valueOf(cfFinal.getString("panels." + fpanel + ".sound-on-open").toUpperCase()));
p.stopSound(Sound.valueOf(Objects.requireNonNull(cfFinal.getString("panels." + fpanel + ".sound-on-open")).toUpperCase()));
}catch(Exception sou){
//skip
}
@ -162,7 +161,7 @@ public class commandpanelrefresher implements Listener {
}
plugin.panelRunning.remove(p.getName() + ";" + fpanel);
if (plugin.config.contains("config.panel-snooper")) {
if (plugin.config.getString("config.panel-snooper").trim().equalsIgnoreCase("true")) {
if (Objects.requireNonNull(plugin.config.getString("config.panel-snooper")).trim().equalsIgnoreCase("true")) {
Bukkit.getConsoleSender().sendMessage("[CommandPanels] " + p.getName() + " Closed " + fpanel);
}
}

View File

@ -32,8 +32,8 @@ public class utils implements Listener {
if(e.getAction() == InventoryAction.NOTHING){return;}
if (e.getRawSlot() == -999) {return;}
if (e.getSlotType() != InventoryType.SlotType.QUICKBAR) {return;}
for(String[] panelName : plugin.panelNames){
YamlConfiguration tempFile = plugin.panelFiles.get(Integer.parseInt(panelName[1]));
for(String[] panelName : plugin.panelNames){
YamlConfiguration tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1]))));
String tempName = panelName[0];
if(tempFile.contains("panels." + tempName + ".open-with-item") && Objects.requireNonNull(e.getClickedInventory()).getType() == InventoryType.PLAYER) {
try{
@ -73,7 +73,7 @@ public class utils implements Listener {
//if the inventory is just a chest that has no panel
return;
}
if (plugin.panelsf.list() == null || Objects.requireNonNull(plugin.panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
//if no panels are present
return;
}
@ -288,7 +288,7 @@ public class utils implements Listener {
if(e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK && Objects.requireNonNull(e.getItem()).getType() == Material.AIR){
return;
}
if (plugin.panelsf.list() == null || Objects.requireNonNull(plugin.panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
@ -297,7 +297,7 @@ public class utils implements Listener {
ItemStack clicked = e.getItem();
Player p = e.getPlayer();
for(String[] panelName : plugin.panelNames){
YamlConfiguration tempFile = plugin.panelFiles.get(Integer.parseInt(panelName[1]));
YamlConfiguration tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1]))));
String tempName = panelName[0];
if(tempFile.contains("panels." + tempName + ".open-with-item")) {
try{
@ -336,7 +336,7 @@ public class utils implements Listener {
*/
Player p = e.getPlayer();
try {
if (plugin.panelsf.list() == null || Objects.requireNonNull(plugin.panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
@ -344,7 +344,8 @@ public class utils implements Listener {
}
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){
@ -380,7 +381,7 @@ public class utils implements Listener {
public void onPlayerRespawn(PlayerRespawnEvent e){
Player p = e.getPlayer();
try {
if (plugin.panelsf.list() == null || Objects.requireNonNull(plugin.panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
@ -388,7 +389,8 @@ public class utils implements Listener {
}
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){
@ -421,9 +423,8 @@ public class utils implements Listener {
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e){
Player p = (Player)e.getEntity();
File panelsf = new File(plugin.getDataFolder() + File.separator + "panels");
try {
if (panelsf.list() == null || Objects.requireNonNull(panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
@ -431,7 +432,8 @@ public class utils implements Listener {
}
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){
@ -457,7 +459,6 @@ public class utils implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
File panelsf = new File(plugin.getDataFolder() + File.separator + "panels");
String tag = plugin.config.getString("config.format.tag") + " ";
if(p.isOp() || p.hasPermission("*.*")){
if(plugin.update) {
@ -466,14 +467,15 @@ public class utils implements Listener {
}
}
try {
if (panelsf.list() == null || Objects.requireNonNull(panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
return;
}
String tpanels; //tpanels is the temp to check through the files
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){
@ -526,9 +528,8 @@ public class utils implements Listener {
public void onPlayerDropItem(PlayerDropItemEvent e){
//if item dropped
Player p = e.getPlayer();
File panelsf = new File(plugin.getDataFolder() + File.separator + "panels");
try {
if (panelsf.list() == null || Objects.requireNonNull(panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
@ -537,7 +538,8 @@ public class utils implements Listener {
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files
ItemStack clicked = e.getItemDrop().getItemStack();
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){
@ -574,9 +576,8 @@ public class utils implements Listener {
@EventHandler
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent e){
Player p = e.getPlayer();
File panelsf = new File(plugin.getDataFolder() + File.separator + "panels");
try {
if (panelsf.list() == null || Objects.requireNonNull(panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
@ -585,7 +586,8 @@ public class utils implements Listener {
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files
ItemStack clicked = e.getOffHandItem();
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){
@ -645,9 +647,8 @@ public class utils implements Listener {
public void onInteractEntity(PlayerInteractEntityEvent e){
//cancel everything if holding item (item frames eg)
Player p = (Player)e.getPlayer();
File panelsf = new File(plugin.getDataFolder() + File.separator + "panels");
try {
if (panelsf.list() == null || Objects.requireNonNull(panelsf.list()).length == 0) {
if (plugin.panelFiles == null) {
return;
}
}catch(Exception b){
@ -656,7 +657,8 @@ public class utils implements Listener {
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files
ItemStack clicked = e.getPlayer().getInventory().getItemInMainHand();
for(YamlConfiguration temp : plugin.panelFiles) { //will loop through all the files in folder
for(String fileName : plugin.panelFiles) { //will loop through all the files in folder
YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
String key;
tpanels = "";
if(!plugin.checkPanels(temp)){