Store FScoreboards by FPlayer instead of Player

This commit is contained in:
eueln 2014-10-21 14:10:41 -05:00 committed by t00thpick1
parent e739ea0bf6
commit 157d98d4b0

View File

@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class FScoreboard { public class FScoreboard {
private static Map<Player, FScoreboard> fscoreboards = new HashMap<Player, FScoreboard>(); private static Map<FPlayer, FScoreboard> fscoreboards = new HashMap<FPlayer, FScoreboard>();
private final Scoreboard scoreboard; private final Scoreboard scoreboard;
private final FPlayer fplayer; private final FPlayer fplayer;
@ -26,22 +26,22 @@ public class FScoreboard {
private boolean removed = false; private boolean removed = false;
public static void init(FPlayer fplayer) { public static void init(FPlayer fplayer) {
fscoreboards.put(fplayer.getPlayer(), new FScoreboard(fplayer)); fscoreboards.put(fplayer, new FScoreboard(fplayer));
if (fplayer.hasFaction()) { if (fplayer.hasFaction()) {
FScoreboard.applyUpdates(fplayer.getFaction()); FScoreboard.applyUpdates(fplayer.getFaction());
} }
} }
public static void remove(FPlayer fplayer) { public static void remove(FPlayer fplayer) {
fscoreboards.remove(fplayer.getPlayer()).removed = true; fscoreboards.remove(fplayer).removed = true;
} }
public static FScoreboard get(FPlayer player) { public static FScoreboard get(FPlayer fplayer) {
return get(player.getPlayer()); return fscoreboards.get(fplayer);
} }
public static FScoreboard get(Player player) { public static FScoreboard get(Player player) {
return fscoreboards.get(player); return fscoreboards.get(FPlayers.i.get(player));
} }
public static void applyUpdatesLater(final Faction faction) { public static void applyUpdatesLater(final Faction faction) {