+ Added a scoreboard.
This commit is contained in:
parent
e4a90a204a
commit
31adf58b86
@ -223,6 +223,8 @@ public class ArenaHandler {
|
||||
W.dcAPI.undisguisePlayer(player);
|
||||
}
|
||||
|
||||
ScoreboardHandler.removeScoreboard(player);
|
||||
|
||||
MessageM.sendFMessage(player, ConfigC.normal_leaveYouLeft, true);
|
||||
if (message) {
|
||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_leaveLeftArena,
|
||||
|
@ -374,6 +374,8 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setLevel(arena.timer);
|
||||
}
|
||||
|
||||
ScoreboardHandler.doScoreboard(arena);
|
||||
}
|
||||
|
||||
SignsHandler.updateSigns();
|
||||
|
37
src/nl/Steffion/BlockHunt/ScoreboardHandler.java
Normal file
37
src/nl/Steffion/BlockHunt/ScoreboardHandler.java
Normal file
@ -0,0 +1,37 @@
|
||||
package nl.Steffion.BlockHunt;
|
||||
|
||||
import nl.Steffion.BlockHunt.Managers.MessageM;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
public class ScoreboardHandler {
|
||||
public static void doScoreboard(Arena arena) {
|
||||
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
Objective object = board.registerNewObjective(arena.arenaName, "dummy");
|
||||
object.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
object.setDisplayName(MessageM.replaceAll(MessageM.CType.TAG()
|
||||
+ "%NGame Info"));
|
||||
Score timeleft = object.getScore(Bukkit.getOfflinePlayer(MessageM
|
||||
.replaceAll("%ATime left:")));
|
||||
timeleft.setScore(arena.timer);
|
||||
Score seekers = object.getScore(Bukkit.getOfflinePlayer(MessageM
|
||||
.replaceAll("%NSeekers:")));
|
||||
seekers.setScore(arena.seekers.size());
|
||||
Score hiders = object.getScore(Bukkit.getOfflinePlayer(MessageM
|
||||
.replaceAll("%NHiders:")));
|
||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||
|
||||
for (Player pl : arena.playersInArena) {
|
||||
pl.setScoreboard(board);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeScoreboard(Player player) {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user