Only add TickListener instances once.

This commit is contained in:
asofold 2013-04-15 16:16:05 +02:00
parent de5f152df9
commit d15a1d1f9e

View File

@ -175,9 +175,11 @@ public class TickTask implements Runnable {
public static void addTickListener(TickListener listener){ public static void addTickListener(TickListener listener){
synchronized (tickListeners) { synchronized (tickListeners) {
if (locked) return; if (locked) return;
if (!tickListeners.contains(listener)){
tickListeners.add(listener); tickListeners.add(listener);
} }
} }
}
/** /**
* Remove a tick listener. Should be thread safe, though... why? * Remove a tick listener. Should be thread safe, though... why?