This commit is contained in:
rockyhawk64 2023-02-08 17:29:01 +11:00
parent f3744a2bf7
commit 24e1b3b6e4
9 changed files with 37 additions and 40 deletions

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="spigot-api-1.19-R0.1-SNAPSHOT">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../Intellij Plugin Testers/Plugin Tester 1.19.2/bundler/libraries/spigot-api-1.19-R0.1-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="spigot-api-1.19-R0.1-SNAPSHOT1">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../MC Test Server/bundler/libraries/spigot-api-1.19-R0.1-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -7,7 +7,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="temurin-1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -10,7 +10,7 @@
<sourceFolder url="file://$MODULE_DIR$/resource_example" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="jdk" jdkName="temurin-1.8" jdkType="JavaSDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="HeadDatabaseAPI" level="project" />
<orderEntry type="library" name="TokenManager-3.2.4" level="project" />
@ -25,7 +25,7 @@
<orderEntry type="library" name="spigot-1.13.2" level="project" />
<orderEntry type="library" name="spigot" level="project" />
<orderEntry type="library" name="CoinsAPI 1.8.9" level="project" />
<orderEntry type="library" name="spigot-api-1.19-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="spigot-api-1.19-R0.1-SNAPSHOT1" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-text-minimessage:4.11.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-api:4.11.0" level="project" />
<orderEntry type="library" name="Maven: net.kyori:adventure-key:4.11.0" level="project" />

View File

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

View File

@ -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;

View File

@ -285,9 +285,9 @@ public class ItemCreation {
BannerMeta bannerMeta = (BannerMeta) s.getItemMeta();
List<Pattern> 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);

View File

@ -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);

View File

@ -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();