From 650f6891eabbab5f761f9c32d85664307efd93e1 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Tue, 7 Apr 2015 12:13:46 -0400 Subject: [PATCH] Correction d'un bug de synchronisation dans le OnlinePlayerManager --- .../pandacraftutils/players/OnlinePlayerManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java index ce80d16..0dbcec6 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java @@ -53,13 +53,13 @@ public final class OnlinePlayerManager { // ---------------------------------------- // -------------- Evènements -------------- // ---------------------------------------- - public void onPlayerJoin (PlayerJoinEvent event) + public synchronized void onPlayerJoin (PlayerJoinEvent event) { players.put(event.getPlayer(), new OnlinePlayer(event.getPlayer())); } - public void onPlayerQuit (PlayerQuitEvent event) + public synchronized void onPlayerQuit (PlayerQuitEvent event) { players.remove(event.getPlayer()); } @@ -74,16 +74,16 @@ public final class OnlinePlayerManager { - public static OnlinePlayer get(Player p) { + public synchronized static OnlinePlayer get(Player p) { return getInstance().players.get(p); } - public static Collection getAll() { + public synchronized static Collection getAll() { return new ArrayList(getInstance().players.values()); } - public static boolean isOnline(Player p) { + public synchronized static boolean isOnline(Player p) { return getInstance().players.containsKey(p); }