Store OfflinePlayers in FTeamWrapper instead of looking them up

This commit is contained in:
eueln 2014-11-15 16:54:16 -06:00
parent 8910de367c
commit 3af4c9a616
1 changed files with 4 additions and 8 deletions

View File

@ -19,7 +19,7 @@ public class FTeamWrapper {
private final Map<FScoreboard, Team> teams = new HashMap<FScoreboard, Team>();
private final String teamName;
private final Faction faction;
private final Set<UUID> members = new HashSet<UUID>();
private final Set<OfflinePlayer> members = new HashSet<OfflinePlayer>();
public static void applyUpdatesLater(final Faction faction) {
if (!FScoreboard.isSupportedByServer()) {
@ -161,7 +161,7 @@ public class FTeamWrapper {
}
private void addPlayer(OfflinePlayer player) {
if (members.add(player.getUniqueId())) {
if (members.add(player)) {
for (Team team : teams.values()) {
team.addPlayer(player);
}
@ -169,7 +169,7 @@ public class FTeamWrapper {
}
private void removePlayer(OfflinePlayer player) {
if (members.remove(player.getUniqueId())) {
if (members.remove(player)) {
for (Team team : teams.values()) {
team.removePlayer(player);
}
@ -177,11 +177,7 @@ public class FTeamWrapper {
}
private Set<OfflinePlayer> getPlayers() {
Set<OfflinePlayer> ret = new HashSet<OfflinePlayer>();
for (UUID uuid : members) {
ret.add(Bukkit.getOfflinePlayer(uuid));
}
return ret;
return new HashSet<OfflinePlayer>(this.members);
}
private void unregister() {