replaced color api.

work started on sidebar
master
jakub 2 years ago
parent 2555a6fdf4
commit d9cdcbcc7f
  1. 8
      .idea/artifacts/Informator_jar.xml
  2. 5
      .idea/jarRepositories.xml
  3. 3
      .idea/misc.xml
  4. 17
      pom.xml
  5. 4
      src/main/java/xyz/soukup/informator/commands/sb.java
  6. 2
      src/main/java/xyz/soukup/informator/handlers/ConfigHandler.java
  7. 7
      src/main/java/xyz/soukup/informator/handlers/PlaceholderHandler.java
  8. 72
      src/main/java/xyz/soukup/informator/handlers/ScoreboardHandler.java
  9. 1
      src/main/java/xyz/soukup/informator/handlers/TabHandler.java
  10. 12
      src/main/resources/modules/scoreboard.yml
  11. 24
      src/main/resources/modules/tab.yml
  12. 24
      target/classes/modules/tab.yml
  13. BIN
      target/classes/xyz/soukup/informator/handlers/PlaceholderHandler.class

@ -1,9 +1,13 @@
<component name="ArtifactManager">
<artifact type="jar" build-on-make="true" name="Informator:jar">
<artifact type="jar" name="Informator:jar">
<output-path>$USER_HOME$/Plocha/betaserver/plugins</output-path>
<root id="archive" name="Informator.jar">
<element id="module-output" name="Informator" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/iridium/IridiumColorAPI/1.0.6/IridiumColorAPI-1.0.6.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/fr/minuskube/netherboard-bukkit/1.2.3/netherboard-bukkit-1.2.3.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.16-R0.4/bungeecord-chat-1.16-R0.4.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/github/ForestTechMC/ForestColorAPI/1.4/ForestColorAPI-1.4.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0.jar" path-in-jar="/" />
</root>
</artifact>
</component>

@ -6,6 +6,11 @@
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jitpack.io" />
<option name="name" value="jitpack.io" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="sonatype" />
<option name="name" value="sonatype" />

@ -12,9 +12,8 @@
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
<option name="workspaceImportForciblyTurnedOn" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="corretto-20" 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>

@ -68,18 +68,25 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>iridiumdevelopment</id>
<url>https://nexus.iridiumdevelopment.net/repository/maven-releases/</url>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.iridium</groupId>
<artifactId>IridiumColorAPI</artifactId>
<version>LATEST</version>
<groupId>fr.minuskube</groupId>
<artifactId>netherboard-bukkit</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.github.ForestTechMC</groupId>
<artifactId>ForestColorAPI</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>

@ -0,0 +1,4 @@
package xyz.soukup.informator.commands;
public class sb {
}

@ -19,11 +19,13 @@ public class ConfigHandler {
public static YamlConfiguration config = new YamlConfiguration();
public static YamlConfiguration tabConfig = new YamlConfiguration();
public static YamlConfiguration scoreboardConfig = new YamlConfiguration();
public static void loadConfigs() throws IOException, InvalidConfigurationException {
List<String> configsToLoad = new ArrayList<>();
configsToLoad.add("config.yml");
configsToLoad.add("animations.yml");
configsToLoad.add("modules/tab.yml");
configsToLoad.add("modules/scoreboard.yml");
for (String configAdress:configsToLoad) {
File file = new File(plugin.getDataFolder(), configAdress);
if (!file.exists())

@ -1,6 +1,5 @@
package xyz.soukup.informator.handlers;
import com.iridium.iridiumcolorapi.IridiumColorAPI;
import cz.foresttech.api.ColorAPI;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -18,7 +17,7 @@ public class PlaceholderHandler {
}
public static String substitudeAnimation(String text){
// Define the regular expression pattern for placeholders
Pattern pattern = Pattern.compile("<ANIMATION:(.*?)>");
Pattern pattern = Pattern.compile("\\{ANIMATION:(.*?)}");
// Create a matcher with the input string
Matcher matcher = pattern.matcher(text);
@ -52,7 +51,7 @@ public class PlaceholderHandler {
}
}
public static String substitudeColor(String text){
return IridiumColorAPI.process(text);
return ColorAPI.colorize(text);
}
}

@ -0,0 +1,72 @@
package xyz.soukup.informator.handlers;
import fr.minuskube.netherboard.bukkit.BPlayerBoard;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
public class ScoreboardHandler {
public static ArrayList<BPlayerBoard> scoreboardInstances = new ArrayList<>();
private static final HashMap<String, List<Object>> scoreboardData = new HashMap<>();
public static HashMap<Player, String> playerScoreboard = new HashMap<>();
private static final YamlConfiguration scoreboardConfig = ConfigHandler.scoreboardConfig;
public static void loadScoreboards(){
List<String> scoreboardSources = new ArrayList<>();
scoreboardSources.add("scoreboards.required");
scoreboardSources.add("scoreboards.world.worlds");
scoreboardSources.add("scoreboards.group.groups");
scoreboardSources.add("scoreboards.player.players");
for(String targetKey: scoreboardSources){
ConfigurationSection targetSection = scoreboardConfig.getConfigurationSection(targetKey);
if (targetSection != null) {
Set<String> keys = targetSection.getKeys(false);
for (String key : keys) {
List<Object> scoreboardDataList = new ArrayList<>();
scoreboardDataList.add(scoreboardConfig.getInt(targetKey + "." + key + ".priority"));
String title = scoreboardConfig.getString(targetKey + "." + key + ".title");
List<String> footer = scoreboardConfig.getStringList(targetKey + "." + key + ".footer");
scoreboardDataList.add(title);
scoreboardDataList.add(footer);
scoreboardData.put(targetKey + "." + key, scoreboardDataList);
}
}
}
}
public static void chooseScoreboard(Player player){
String choosenScoreboard = "scoreboards.required.default";
int choosenPriority = scoreboardConfig.getInt("scoreboards.required.default.priority");
if (scoreboardData.containsKey("scoreboards.world.worlds." + player.getWorld().getName()) && scoreboardConfig.getBoolean("scoreboards.world.enabled")){
player.sendMessage(player.getWorld().getName());
if ((int)scoreboardData.get("scoreboards.world.worlds." + player.getWorld().getName()).get(0) > choosenPriority){
choosenScoreboard = "scoreboards.world.worlds." + player.getWorld().getName();
choosenPriority = (int)scoreboardData.get("scoreboards.world.worlds." + player.getWorld().getName()).get(0);
}
}
if (scoreboardData.containsKey("scoreboards.player.players." + player.getDisplayName()) && scoreboardConfig.getBoolean("scoreboards.player.enabled")){
if ((int)scoreboardData.get("scoreboards.player.players." + player.getDisplayName()).get(0) > choosenPriority){
choosenScoreboard = "scoreboards.player.players." + player.getDisplayName();
choosenPriority = (int)scoreboardData.get("scoreboards.player.players." + player.getDisplayName()).get(0);
}
}
playerScoreboard.put(player, choosenScoreboard);
}
public static void refreshscoreboards(){
}
}

@ -41,6 +41,7 @@ public class TabHandler {
}
}
}
public static void chooseTab(Player player){
String choosenTab = "tabs.required.default";

@ -2,35 +2,35 @@ scoreboards:
required:
default:
priority: 0
title: "<ANIMATION:exampleTitle>"
title: "{ANIMATION:exampleTitle}"
lines:
- ""
- "test "
- "lot of test"
- "ejo more testols"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
world:
enabled: true
worlds:
example_world:
priority: 3
title: "<ANIMATION:exampleTitle>"
title: "{ANIMATION:exampleTitle}"
lines:
- "world specified"
- "test "
- "lot of test"
- "ejo more testols"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
player:
enabled: true
players:
example_player:
priority: 6
title: "<ANIMATION:exampleTitle>"
title: "{ANIMATION:exampleTitle}"
lines:
- "player specified"
- ""
- "test "
- "lot of test"
- "ejo more testols"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"

@ -17,13 +17,13 @@ tabs:
priority: 0
header:
- ""
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""
@ -34,13 +34,13 @@ tabs:
priority: 6
header:
- "World specified tab"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""
@ -53,13 +53,13 @@ tabs:
enabled: true
header:
- "World specified tab"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""
@ -71,13 +71,13 @@ tabs:
enabled: true
header:
- "Player specified tab"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""

@ -17,13 +17,13 @@ tabs:
priority: 0
header:
- ""
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""
@ -34,13 +34,13 @@ tabs:
priority: 6
header:
- "World specified tab"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""
@ -53,13 +53,13 @@ tabs:
enabled: true
header:
- "World specified tab"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""
@ -71,13 +71,13 @@ tabs:
enabled: true
header:
- "Player specified tab"
- "<ANIMATION:exampleTitle>"
- "{ANIMATION:exampleTitle}"
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
footer:
- ""
- "<ANIMATION:exampleLine>"
- "{ANIMATION:exampleLine}"
- ""
- "Change this in modules/tab.yml"
- ""

Loading…
Cancel
Save