Prefer to synchronize adding players.

Does not seem to be strictly necessary, because the data is comparably
light-weight and the data loss on some time slices would usually be
small.

Should be cleaner, as this is a seldom event (login, logout).
This commit is contained in:
asofold 2014-07-16 14:41:24 +02:00
parent 7b6305de78
commit 59fca0f43e

View File

@ -37,7 +37,7 @@ public class FlyingFrequency extends PacketAdapter implements Listener, JoinLeav
super(plugin, PacketType.Play.Client.FLYING); // TODO: How does POS and POS_LOOK relate/translate?
}
private ActionFrequency addName(String name) {
private synchronized ActionFrequency addName(String name) {
Map<String, ActionFrequency> freqMap = new HashMap<String, ActionFrequency>(this.freqMap);
ActionFrequency freq = new ActionFrequency(5, 1000);
freqMap.put(name, freq);