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
{
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
public void run()
{
synchronized (location)
synchronized (pendingDiskWrites)
{
if (pendingDiskWrites.get() > 1)
{

View File

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