parent
2555a6fdf4
commit
d9cdcbcc7f
13 changed files with 137 additions and 44 deletions
@ -1,9 +1,13 @@ |
||||
<component name="ArtifactManager"> |
||||
<artifact type="jar" build-on-make="true" name="Informator:jar"> |
||||
<output-path>$USER_HOME$/Plocha/beta server/plugins</output-path> |
||||
<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> |
||||
@ -0,0 +1,4 @@ |
||||
package xyz.soukup.informator.commands; |
||||
|
||||
public class sb { |
||||
} |
||||
@ -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(){ |
||||
|
||||
} |
||||
} |
||||
Binary file not shown.
Loading…
Reference in new issue