Update for new getOnlinePlayers behavior

This commit is contained in:
TfT_02 2014-06-29 14:04:36 +02:00
parent d527584248
commit a257e83a62
3 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -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<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers());
mcMMO.p.debug("Saving mcMMOPlayers... (" + onlinePlayers.size() + ")");
for (Player player : onlinePlayers) {
getPlayer(player).getProfile().save();

View File

@ -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<Player> onlinePlayers = ImmutableList.copyOf(mcMMO.p.getServer().getOnlinePlayers());
mcMMO.p.debug("Tearing down scoreboards... (" + onlinePlayers.size() + ")");
for (Player player : onlinePlayers) {
teardownPlayer(player);
}