diff --git a/.idea/libraries/spigot_api_1_19_R0_1_SNAPSHOT.xml b/.idea/libraries/spigot_api_1_19_R0_1_SNAPSHOT.xml deleted file mode 100644 index a4b3f90..0000000 --- a/.idea/libraries/spigot_api_1_19_R0_1_SNAPSHOT.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/spigot_api_1_19_R0_1_SNAPSHOT1.xml b/.idea/libraries/spigot_api_1_19_R0_1_SNAPSHOT1.xml new file mode 100644 index 0000000..bf869ef --- /dev/null +++ b/.idea/libraries/spigot_api_1_19_R0_1_SNAPSHOT1.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 4bd9b3a..e8d124d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/CommandPanels.iml b/CommandPanels.iml index 8f62570..9d4e3bb 100644 --- a/CommandPanels.iml +++ b/CommandPanels.iml @@ -10,7 +10,7 @@ - + @@ -25,7 +25,7 @@ - + diff --git a/resource/plugin.yml b/resource/plugin.yml index b3694f5..ead0b3c 100644 --- a/resource/plugin.yml +++ b/resource/plugin.yml @@ -1,4 +1,4 @@ -version: 3.18.3.0 +version: 3.18.4.0 main: me.rockyhawk.commandpanels.CommandPanels name: CommandPanels author: RockyHawk diff --git a/src/me/rockyhawk/commandpanels/classresources/HasSections.java b/src/me/rockyhawk/commandpanels/classresources/HasSections.java index 66061e1..bff1053 100644 --- a/src/me/rockyhawk/commandpanels/classresources/HasSections.java +++ b/src/me/rockyhawk/commandpanels/classresources/HasSections.java @@ -24,12 +24,6 @@ public class HasSections { String setName; if(cf.isSet("has" + count)) { setName = "has" + count; - }else if(cf.isSet("hasperm" + count)) { - setName = "hasperm" + count; - }else if(cf.isSet("hasvalue" + count)) { - setName = "hasvalue" + count; - }else if(cf.isSet("hasgreater" + count)) { - setName = "hasgreater" + count; }else{ continue; } @@ -114,7 +108,7 @@ public class HasSections { if(setName.startsWith("hasgreater")) { return (Long.parseLong(compare) >= Long.parseLong(value)) == outputValue; } - //the current has section with all of the functions implemented inside it + //the current has section with all the functions implemented inside it if(setName.startsWith("has")) { if(value.endsWith(" HASPERM")) { return Bukkit.getPlayer(value.substring(0, value.length()-8)).hasPermission(compare) == outputValue; diff --git a/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java b/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java index 799e1a7..f2363c2 100644 --- a/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java +++ b/src/me/rockyhawk/commandpanels/classresources/ItemCreation.java @@ -285,9 +285,9 @@ public class ItemCreation { BannerMeta bannerMeta = (BannerMeta) s.getItemMeta(); List patterns = new ArrayList<>(); //Load patterns in order top to bottom for (String temp : itemSection.getStringList("banner")) { - temp = plugin.tex.placeholders(panel,position,p,temp); + temp = plugin.tex.placeholdersNoColour(panel,position,p,temp); String[] dyePattern = temp.split(","); - patterns.add(new Pattern(DyeColor.valueOf(dyePattern[0]), PatternType.valueOf(dyePattern[1]))); //load patterns in config: RED:STRIPE_TOP + patterns.add(new Pattern(DyeColor.valueOf(dyePattern[0]), PatternType.valueOf(dyePattern[1]))); //load patterns in config: RED,STRIPE_TOP } bannerMeta.setPatterns(patterns); bannerMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); diff --git a/src/me/rockyhawk/commandpanels/classresources/placeholders/Placeholders.java b/src/me/rockyhawk/commandpanels/classresources/placeholders/Placeholders.java index 247832b..383f10f 100644 --- a/src/me/rockyhawk/commandpanels/classresources/placeholders/Placeholders.java +++ b/src/me/rockyhawk/commandpanels/classresources/placeholders/Placeholders.java @@ -18,6 +18,7 @@ import java.net.Socket; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; public class Placeholders { CommandPanels plugin; @@ -96,7 +97,8 @@ public class Placeholders { case("online-players"): { return Integer.toString(Bukkit.getServer().getOnlinePlayers().size()); } - case("online-players-true"): { + case("online-players-visible"): { + //will filter out players with metadata 'vanished' return Integer.toString(Bukkit.getOnlinePlayers().stream().filter(player -> !player.getMetadata("vanished").get(0).asBoolean()).collect(Collectors.toList()).size()); } case("panel-position"): { @@ -326,22 +328,17 @@ public class Placeholders { //checks for players online if(identifier.startsWith("player-online-")) { try { - if (identifier.endsWith("-true")){ - String playerLocation = identifier.replace("player-online-", ""); - Player[] playerFind = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().stream().filter(player -> !player.getMetadata("vanished").get(0).asBoolean()).collect(Collectors.toList()).size()]); - if (Double.parseDouble(playerLocation) > playerFind.length) { - return plugin.tex.colour(Objects.requireNonNull(plugin.config.getString("config.format.offline"))); - } else { - return playerFind[(int)(Double.parseDouble(playerLocation) - 1)].getName(); - } + String playerLocation = identifier.replace("player-online-", ""); + Player[] playerFind; + if (identifier.endsWith("-visible")){ + playerFind = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().stream().filter(player -> !player.getMetadata("vanished").get(0).asBoolean()).collect(Collectors.toList()).size()]); } else { - String playerLocation = identifier.replace("player-online-", ""); - Player[] playerFind = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]); - if (Double.parseDouble(playerLocation) > playerFind.length) { - return plugin.tex.colour(Objects.requireNonNull(plugin.config.getString("config.format.offline"))); - } else { - return playerFind[(int)(Double.parseDouble(playerLocation) - 1)].getName(); - } + playerFind = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]); + } + if (Double.parseDouble(playerLocation) > playerFind.length) { + return plugin.tex.colour(Objects.requireNonNull(plugin.config.getString("config.format.offline"))); + } else { + return playerFind[(int)(Double.parseDouble(playerLocation) - 1)].getName(); } }catch (Exception ex){ plugin.debug(ex,p); diff --git a/src/me/rockyhawk/commandpanels/openpanelsmanager/OpenGUI.java b/src/me/rockyhawk/commandpanels/openpanelsmanager/OpenGUI.java index e9fe19d..f74d7af 100644 --- a/src/me/rockyhawk/commandpanels/openpanelsmanager/OpenGUI.java +++ b/src/me/rockyhawk/commandpanels/openpanelsmanager/OpenGUI.java @@ -29,8 +29,14 @@ public class OpenGUI { if(position == PanelPosition.Top) { String title; if (openType != PanelOpenType.Editor) { - //regular inventory - title = plugin.tex.placeholders(panel, position, p, pconfig.getString("title")); + if(pconfig.contains("custom-title")) { + //used for titles in the custom-title section, for has sections + String section = plugin.has.hasSection(panel,position,pconfig.getConfigurationSection("custom-title"), p); + title = plugin.tex.placeholders(panel, position, p, pconfig.getString("custom-title" + section + ".title")); + }else { + //regular inventory title + title = plugin.tex.placeholders(panel, position, p, pconfig.getString("title")); + } } else { //editor inventory title = "Editing Panel: " + panel.getName();