From 947f82cb2f6a46ab86161ae62d7efd1146b6b508 Mon Sep 17 00:00:00 2001 From: eueln Date: Tue, 21 Oct 2014 14:49:01 -0500 Subject: [PATCH] Don't repeatedly copy the Set of Faction members --- .../com/massivecraft/factions/scoreboards/FScoreboard.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java index 0cbd3b57..9ac2925a 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java @@ -12,6 +12,7 @@ import org.bukkit.scoreboard.Team; import java.util.HashMap; import java.util.Map; +import java.util.Set; public class FScoreboard { private static Map fscoreboards = new HashMap(); @@ -130,6 +131,7 @@ public class FScoreboard { public void updateFactionTeam(Faction faction) { Team team = factionTeams.get(faction); + Set factionMembers = faction.getFPlayers(); if (!Factions.i.get().contains(faction)) { // Faction was disbanded @@ -146,13 +148,13 @@ public class FScoreboard { } for (OfflinePlayer player : team.getPlayers()) { - if (!player.isOnline() || !faction.getFPlayers().contains(FPlayers.i.get(player.getPlayer()))) { + if (!player.isOnline() || !factionMembers.contains(FPlayers.i.get(player.getPlayer()))) { // Player is offline or no longer in faction team.removePlayer(player); } } - for (FPlayer fmember : faction.getFPlayers()) { + for (FPlayer fmember : factionMembers) { if (!fmember.isOnline()) { continue; }