From a257e83a62fa36737e9c4f674d5934d88be4c2bb Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 29 Jun 2014 14:04:36 +0200 Subject: [PATCH] Update for new getOnlinePlayers behavior --- Changelog.txt | 1 + .../java/com/gmail/nossr50/util/player/UserManager.java | 6 ++++-- .../gmail/nossr50/util/scoreboards/ScoreboardManager.java | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index daaefe1ee..02f9b5275 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -31,6 +31,7 @@ Version 1.5.01-dev ! Vanished players no longer get hit by AoE effects ! Changed Alchemy config option 'Prevent_Hopper_Transfer' renamed to 'Prevent_Hopper_Transfer_Ingredients' ! Changed Alchemy XP distribution. XP is granted based on the stage of the potion. + ! Updated for new getOnlinePlayers() behavior - Removed salvage ability from Repair, salvage has it's own (child) skill now Version 1.5.00 diff --git a/src/main/java/com/gmail/nossr50/util/player/UserManager.java b/src/main/java/com/gmail/nossr50/util/player/UserManager.java index ffe3be1e3..10923a2eb 100644 --- a/src/main/java/com/gmail/nossr50/util/player/UserManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/UserManager.java @@ -11,6 +11,8 @@ import org.bukkit.metadata.FixedMetadataValue; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.google.common.collect.ImmutableList; + public final class UserManager { private UserManager() {} @@ -50,8 +52,8 @@ public final class UserManager { * Save all users ON THIS THREAD. */ public static void saveAll() { - Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers(); - mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.length + ")"); + ImmutableList onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers()); + mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.size() + ")"); for (Player player : onlinePlayers) { getPlayer(player).getProfile().save(); diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index cb01ead18..dfaa43374 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -22,6 +22,7 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.player.UserManager; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; @@ -158,8 +159,8 @@ public class ScoreboardManager { // Called in onDisable() public static void teardownAll() { - Player[] onlinePlayers = mcMMO.p.getServer().getOnlinePlayers(); - mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.length + ")"); + ImmutableList onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers()); + mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.size() + ")"); for (Player player : onlinePlayers) { teardownPlayer(player); }