3.9.2 Fixes

This commit is contained in:
rockyhawk64 2020-08-17 21:53:53 +10:00
parent f6f3ff0313
commit b3176751d1
3 changed files with 8 additions and 26 deletions

View File

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

View File

@ -995,7 +995,6 @@ public class commandpanels extends JavaPlugin {
//look through all files in all folders //look through all files in all folders
public void fileNamesFromDirectory(File directory) { public void fileNamesFromDirectory(File directory) {
int count = 0;
for (String fileName : Objects.requireNonNull(directory.list())) { for (String fileName : Objects.requireNonNull(directory.list())) {
if(new File(directory + File.separator + fileName).isDirectory()){ if(new File(directory + File.separator + fileName).isDirectory()){
fileNamesFromDirectory(new File(directory + File.separator + fileName)); fileNamesFromDirectory(new File(directory + File.separator + fileName));
@ -1012,33 +1011,20 @@ public class commandpanels extends JavaPlugin {
} }
panelFiles.add((directory + File.separator + fileName).replace(panelsf.toString() + File.separator,"")); panelFiles.add((directory + File.separator + fileName).replace(panelsf.toString() + File.separator,""));
for (String tempName : Objects.requireNonNull(YamlConfiguration.loadConfiguration(new File(directory + File.separator + fileName)).getConfigurationSection("panels")).getKeys(false)) { for (String tempName : Objects.requireNonNull(YamlConfiguration.loadConfiguration(new File(directory + File.separator + fileName)).getConfigurationSection("panels")).getKeys(false)) {
panelNames.add(new String[]{tempName, Integer.toString(count)}); panelNames.add(new String[]{tempName, Integer.toString(panelFiles.size()-1)});
if(YamlConfiguration.loadConfiguration(new File(directory + File.separator + fileName)).contains("panels." + tempName + ".open-with-item")) {
openWithItem = true;
}
} }
count += 1;
} }
} }
public void reloadPanelFiles() { public void reloadPanelFiles() {
panelFiles.clear(); panelFiles.clear();
panelNames.clear(); panelNames.clear();
openWithItem = false;
//load panel files //load panel files
fileNamesFromDirectory(panelsf); fileNamesFromDirectory(panelsf);
//this bit will set openWithItem to false/true upson reload
YamlConfiguration tempFile;
String tempName;
openWithItem = false;
for(String[] panelName : panelNames){
tempFile = YamlConfiguration.loadConfiguration(new File(panelsf + File.separator + panelFiles.get(Integer.parseInt(panelName[1]))));
if(!checkPanels(tempFile)){
this.getServer().getConsoleSender().sendMessage("[CommandPanels] Error in: " + panelFiles.get(Integer.parseInt(panelName[1])));
continue;
}
tempName = panelName[0];
if(tempFile.contains("panels." + tempName + ".open-with-item")) {
openWithItem = true;
break;
}
}
} }
public void debug(Exception e) { public void debug(Exception e) {

View File

@ -1,7 +1,6 @@
package me.rockyhawk.commandPanels.openWithItem; package me.rockyhawk.commandPanels.openWithItem;
import me.rockyhawk.commandPanels.commandpanels; import me.rockyhawk.commandPanels.commandpanels;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -177,7 +176,6 @@ public class utilsOpenWithItem implements Listener {
}catch(Exception b){ }catch(Exception b){
return; return;
} }
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files String tpanels; //tpanels is the temp to check through the files
for(String fileName : 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)); YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
@ -210,7 +208,7 @@ public class utilsOpenWithItem implements Listener {
//if none of the panels have open-with-item //if none of the panels have open-with-item
return; return;
} }
Player p = (Player)e.getEntity(); Player p = e.getEntity();
try { try {
if (plugin.panelFiles == null) { if (plugin.panelFiles == null) {
return; return;
@ -218,7 +216,6 @@ public class utilsOpenWithItem implements Listener {
}catch(Exception b){ }catch(Exception b){
return; return;
} }
YamlConfiguration cf; //this is the file to use for any panel.* requests
String tpanels; //tpanels is the temp to check through the files String tpanels; //tpanels is the temp to check through the files
for(String fileName : 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)); YamlConfiguration temp = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + fileName));
@ -245,7 +242,6 @@ public class utilsOpenWithItem implements Listener {
return; return;
} }
Player p = e.getPlayer(); Player p = e.getPlayer();
String tag = plugin.config.getString("config.format.tag") + " ";
try { try {
if (plugin.panelFiles == null) { if (plugin.panelFiles == null) {
return; return;