Correction d'un bug de Synchronisation

This commit is contained in:
Marc Baloup 2015-01-25 14:34:47 -05:00
parent 51db9fba84
commit 897b307035
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package net.mc_pandacraft.java.plugin.pandacraftutils.modules; package net.mc_pandacraft.java.plugin.pandacraftutils.modules;
import java.util.Collection;
import net.mc_pandacraft.java.plugin.pandacraftutils.ConfigManager; import net.mc_pandacraft.java.plugin.pandacraftutils.ConfigManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer; import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer;
@ -51,7 +53,8 @@ public class AfkManager extends BukkitRunnable implements Listener {
@Override @Override
public void run() { public void run() {
// methode exécutée toute les secondes // methode exécutée toute les secondes
for (OnlinePlayer ap : OnlinePlayerManager.getInstance().getAll()) Collection<OnlinePlayer> oPlayers = OnlinePlayerManager.getInstance().getAll();
for (OnlinePlayer ap : oPlayers)
{ // parcours de tout les joueurs { // parcours de tout les joueurs
if (ap == null) if (ap == null)
continue; continue;

View File

@ -1,6 +1,7 @@
package net.mc_pandacraft.java.plugin.pandacraftutils.players; package net.mc_pandacraft.java.plugin.pandacraftutils.players;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
@ -80,7 +81,7 @@ public final class OnlinePlayerManager implements Listener {
} }
public Collection<OnlinePlayer> getAll() { public Collection<OnlinePlayer> getAll() {
return players.values(); return Collections.unmodifiableCollection(players.values());
} }