Only write to UUIDMap if the entry doesn't exist.

This commit is contained in:
KHobbits 2014-04-18 06:46:46 +01:00
parent b6c0871daa
commit b6d6b24796
2 changed files with 12 additions and 4 deletions

View file

@ -72,7 +72,11 @@ public class UUIDMap
} }
else else
{ {
history.get(uuid).add(name); final ArrayList<String> list = history.get(uuid);
if (!list.contains(name))
{
list.add(name);
}
} }
} }
} }
@ -145,7 +149,7 @@ public class UUIDMap
@Override @Override
public void run() public void run()
{ {
synchronized (location) synchronized (pendingDiskWrites)
{ {
if (pendingDiskWrites.get() > 1) if (pendingDiskWrites.get() > 1)
{ {

View file

@ -144,8 +144,12 @@ public class UserMap extends CacheLoader<UUID, User> implements IConf
keys.add(uuid); keys.add(uuid);
if (name != null && name.length() > 0) if (name != null && name.length() > 0)
{ {
names.put(StringUtil.sanitizeFileName(name), uuid); final String keyName = StringUtil.sanitizeFileName(name);
uuidMap.writeUUIDMap(); if (!names.containsKey(keyName))
{
names.put(keyName, uuid);
uuidMap.writeUUIDMap();
}
} }
} }
} }