From 8f95745b50cd6312b626d1ad2d50f1976148503b Mon Sep 17 00:00:00 2001 From: garbagemule Date: Tue, 6 May 2014 01:16:47 +0200 Subject: [PATCH] Add zero-score fix to the dead players on the scoreboards. --- .../MobArena/ScoreboardManager.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/com/garbagemule/MobArena/ScoreboardManager.java b/src/com/garbagemule/MobArena/ScoreboardManager.java index 4244f1a..324717d 100644 --- a/src/com/garbagemule/MobArena/ScoreboardManager.java +++ b/src/com/garbagemule/MobArena/ScoreboardManager.java @@ -70,8 +70,23 @@ public class ScoreboardManager { int value = kills.getScore(player).getScore(); scoreboard.resetScores(player); - Score fake = kills.getScore(Bukkit.getOfflinePlayer(name)); - fake.setScore(value); + /* In case the player has no kills, they will not show up on the + * scoreboard unless they are first given a different score. + * If zero kills, the score is set to 8 (which looks a bit like + * 0), and then in the next tick, it's set to 0. Otherwise, the + * score is just set to its current value. + */ + final Score fake = kills.getScore(Bukkit.getOfflinePlayer(name)); + if (value == 0) { + fake.setScore(8); + arena.scheduleTask(new Runnable() { + public void run() { + fake.setScore(0); + } + }, 1); + } else { + fake.setScore(value); + } } /**