+ Added ability to change the scoreboard contents.

This commit is contained in:
Steffion 2013-08-26 16:12:04 +02:00
parent 236093f99d
commit 19b99743fc
2 changed files with 23 additions and 10 deletions

View File

@ -50,6 +50,10 @@ public enum ConfigC {
"%A%players%%N/%A%maxplayers%", "%EIngame: %A%timeleft%" },
W.config),
scoreboard_timeleft ("%ATime left:", W.config),
scoreboard_seekers ("%NSeekers:", W.config),
scoreboard_hiders ("%NHiders:", W.config),
log_Enabled ("%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.",
W.messages),
log_Disabled ("%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.",

View File

@ -1,6 +1,7 @@
package nl.Steffion.BlockHunt;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import org.bukkit.Bukkit;
@ -21,14 +22,18 @@ public class ScoreboardHandler {
Objective object = board.registerNewObjective(arena.arenaName, "dummy");
object.setDisplaySlot(DisplaySlot.SIDEBAR);
object.setDisplayName(MessageM.replaceAll(MessageM.CType.TAG()));
Score timeleft = object.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll("%ATime left:")));
Score timeleft = object
.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll((String) W.config
.get(ConfigC.scoreboard_timeleft))));
timeleft.setScore(arena.timer);
Score seekers = object.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll("%NSeekers:")));
Score seekers = object
.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll((String) W.config
.get(ConfigC.scoreboard_seekers))));
seekers.setScore(arena.seekers.size());
Score hiders = object.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll("%NHiders:")));
.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders))));
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
if (arena.gameState == ArenaState.INGAME) {
for (Player pl : arena.playersInArena) {
@ -46,14 +51,18 @@ public class ScoreboardHandler {
Scoreboard board = arena.scoreboard;
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
object.setDisplayName(MessageM.replaceAll(MessageM.CType.TAG()));
Score timeleft = object.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll("%ATime left:")));
Score timeleft = object
.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll((String) W.config
.get(ConfigC.scoreboard_timeleft))));
timeleft.setScore(arena.timer);
Score seekers = object.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll("%NSeekers:")));
Score seekers = object
.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll((String) W.config
.get(ConfigC.scoreboard_seekers))));
seekers.setScore(arena.seekers.size());
Score hiders = object.getScore(Bukkit.getOfflinePlayer(MessageM
.replaceAll("%NHiders:")));
.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders))));
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
if (arena.gameState == ArenaState.INGAME) {
for (Player pl : arena.playersInArena) {