Fixes v3.12.6

This commit is contained in:
rockyhawk64 2020-10-27 11:20:31 +11:00
parent 0201b7b7cb
commit d44c72a68b
5 changed files with 26 additions and 22 deletions

View File

@ -129,6 +129,5 @@ panels:
- gamemode creative - gamemode creative
- commandpanels:commandpanelclose - commandpanels:commandpanelclose
- console= title %cp-player-name% times 20 60 20 - console= title %cp-player-name% times 20 60 20
- console= title %cp-player-name% subtitle {"text":"You are now in creative - console= title %cp-player-name% subtitle {"text":"You are now in creative mode!","color":"green"}
mode!","color":"green"}
- console= title %cp-player-name% title {"text":"Awesome %cp-player-displayname%"} - console= title %cp-player-name% title {"text":"Awesome %cp-player-displayname%"}

View File

@ -131,6 +131,5 @@ panels:
- gamemode creative - gamemode creative
- commandpanels:commandpanelclose - commandpanels:commandpanelclose
- console= title %cp-player-name% times 20 60 20 - console= title %cp-player-name% times 20 60 20
- console= title %cp-player-name% subtitle {"text":"You are now in creative - console= title %cp-player-name% subtitle {"text":"You are now in creative mode!","color":"green"}
mode!","color":"green"}
- console= title %cp-player-name% title {"text":"Awesome %cp-player-displayname%"} - console= title %cp-player-name% title {"text":"Awesome %cp-player-displayname%"}

View File

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

View File

@ -476,6 +476,7 @@ public class CommandPanels extends JavaPlugin {
public void debug(Exception e) { public void debug(Exception e) {
if (debug) { if (debug) {
getServer().getConsoleSender().sendMessage(ChatColor.DARK_RED + "[CommandPanels] The plugin has generated a debug error, find the error below");
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -27,27 +27,32 @@ public class Commandpanelcustom implements Listener {
} }
ConfigurationSection tempFile; ConfigurationSection tempFile;
for(String[] panelName : plugin.panelNames){ try {
tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1])))).getConfigurationSection("panels." + panelName[0]); for (String[] panelName : plugin.panelNames) {
if(tempFile.contains("commands")) { tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1])))).getConfigurationSection("panels." + panelName[0]);
List<String> panelCommands = tempFile.getStringList("commands"); if (tempFile.contains("commands")) {
if(panelCommands.contains(e.getMessage().replace("/",""))){ List<String> panelCommands = tempFile.getStringList("commands");
e.setCancelled(true); if (panelCommands.contains(e.getMessage().replace("/", ""))) {
plugin.openVoids.openCommandPanel(e.getPlayer(),e.getPlayer(),panelName[0],tempFile,false); e.setCancelled(true);
return; plugin.openVoids.openCommandPanel(e.getPlayer(), e.getPlayer(), panelName[0], tempFile, false);
return;
}
} }
}
//this will be deleted next update //this will be deleted in 3.13.x
if(tempFile.contains("command")) { if (tempFile.contains("command")) {
List<String> panelCommands = Arrays.asList(tempFile.getString("command").split("\\s")); List<String> panelCommands = Arrays.asList(tempFile.getString("command").split("\\s"));
if(panelCommands.contains(e.getMessage().replace("/",""))){ if (panelCommands.contains(e.getMessage().replace("/", ""))) {
e.setCancelled(true); e.setCancelled(true);
plugin.getServer().getConsoleSender().sendMessage(ChatColor.RED + "[CommandPanels] Using command: for custom commands will soon be deprecated. Please use commands: as shown in the wiki instead!"); plugin.getServer().getConsoleSender().sendMessage(ChatColor.RED + "[CommandPanels] Using command: for custom commands will soon be deprecated. Please use commands: as shown in the wiki instead!");
plugin.openVoids.openCommandPanel(e.getPlayer(),e.getPlayer(),panelName[0],tempFile,false); plugin.openVoids.openCommandPanel(e.getPlayer(), e.getPlayer(), panelName[0], tempFile, false);
return; return;
}
} }
} }
}catch(NullPointerException exc){
//this is placed to prevent null exceptions if the commandpanels reload command has file changes
plugin.debug(exc);
} }
} }
} }