This commit is contained in:
rockyhawk64 2022-11-25 17:56:28 +11:00
parent 6ed1b170f6
commit 9da157a1fa
4 changed files with 19 additions and 6 deletions

View File

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

View File

@ -299,7 +299,11 @@ public class ItemCreation {
if (itemSection.contains("leatherarmor")) {
//if the item is leather armor, change the colour to this
try {
if (s.getType() == Material.LEATHER_BOOTS || s.getType() == Material.LEATHER_LEGGINGS || s.getType() == Material.LEATHER_CHESTPLATE || s.getType() == Material.LEATHER_HELMET) {
if (s.getType() == Material.LEATHER_BOOTS ||
s.getType() == Material.LEATHER_LEGGINGS ||
s.getType() == Material.LEATHER_CHESTPLATE ||
s.getType() == Material.LEATHER_HELMET ||
s.getType() == Material.matchMaterial("LEATHER_HORSE_ARMOR")) { //avoid exceptions on older versions which don't have leather armour
LeatherArmorMeta leatherMeta = (LeatherArmorMeta) s.getItemMeta();
String colourCode = plugin.tex.placeholdersNoColour(panel,position,p,itemSection.getString("leatherarmor"));
assert colourCode != null;
@ -394,6 +398,15 @@ public class ItemCreation {
//change the stack amount (placeholders accepted)
s.setAmount((int)Double.parseDouble(Objects.requireNonNull(plugin.tex.placeholders(panel,position,p,itemSection.getString("stack")))));
}
//do the items commands throughout the refresh
//check that the panel is already open and not running commands when opening
if (itemSection.contains("refresh-commands") && plugin.openPanels.hasPanelOpen(p.getName(), panel.getName(), position)) {
try {
plugin.commandTags.runCommands(panel,position,p,itemSection.getStringList("refresh-commands"));
}catch(Exception ex){
plugin.debug(ex,p);
}
}
} catch (IllegalArgumentException | NullPointerException var33) {
plugin.debug(var33,p);
p.sendMessage(plugin.tex.colour(plugin.tag + plugin.config.getString("config.format.error") + " material: " + itemSection.getString("material")));

View File

@ -33,9 +33,7 @@ public class Commandpanelsreload implements CommandExecutor {
}
plugin.reloadPanelFiles();
if(new File(plugin.getDataFolder() + File.separator + "temp.yml").delete()){
//empty
}
plugin.config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder() + File.separator + "config.yml"));
plugin.blockConfig = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));

View File

@ -52,7 +52,9 @@ public class UtilsPanelsLoader implements Listener {
if(plugin.openPanels.getOpenPanel(playerName,PanelPosition.Top).getConfig().getStringList("panelType").contains("unclosable")){
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
public void run() {
plugin.openPanels.getOpenPanel(playerName,PanelPosition.Top).open(Bukkit.getPlayer(playerName), PanelPosition.Top);
//end the old panel session and copy a new one
plugin.openPanels.getOpenPanel(playerName,PanelPosition.Top).isOpen = false;
plugin.openPanels.getOpenPanel(playerName,PanelPosition.Top).copy().open(Bukkit.getPlayer(playerName), PanelPosition.Top);
}
});
return;