Fix #27, all scoreboards are managed by UUIDs and no longer names.

This commit is contained in:
graywolf336 2014-05-24 14:20:37 -05:00
parent 3e54d79dd3
commit 8cb7a76eeb

View File

@ -43,13 +43,13 @@ public class ScoreBoardManager {
* @param pris data for the provided prisoner * @param pris data for the provided prisoner
*/ */
public void addScoreBoard(Player player, Prisoner pris) { public void addScoreBoard(Player player, Prisoner pris) {
if(!boards.containsKey(player.getName())) { if(!boards.containsKey(player.getUniqueId())) {
boards.put(player.getUniqueId(), man.getNewScoreboard()); boards.put(player.getUniqueId(), man.getNewScoreboard());
Objective o = boards.get(player.getName()).registerNewObjective("test", "dummy"); Objective o = boards.get(player.getUniqueId()).registerNewObjective("test", "dummy");
o.setDisplaySlot(DisplaySlot.SIDEBAR); o.setDisplaySlot(DisplaySlot.SIDEBAR);
o.setDisplayName(Util.getColorfulMessage(pl.getConfig().getString(Settings.SCOREBOARDTITLE.getPath()))); o.setDisplayName(Util.getColorfulMessage(pl.getConfig().getString(Settings.SCOREBOARDTITLE.getPath())));
o.getScore(time).setScore(pris.getRemainingTimeInMinutesInt()); o.getScore(time).setScore(pris.getRemainingTimeInMinutesInt());
player.setScoreboard(boards.get(player.getName())); player.setScoreboard(boards.get(player.getUniqueId()));
}else { }else {
updatePrisonersBoard(player, pris); updatePrisonersBoard(player, pris);
} }
@ -99,6 +99,6 @@ public class ScoreBoardManager {
* @param pris data for the player * @param pris data for the player
*/ */
private void updatePrisonersBoard(Player player, Prisoner pris) { private void updatePrisonersBoard(Player player, Prisoner pris) {
boards.get(player.getName()).getObjective("test").getScore(time).setScore(pris.getRemainingTimeInMinutesInt()); boards.get(player.getUniqueId()).getObjective("test").getScore(time).setScore(pris.getRemainingTimeInMinutesInt());
} }
} }