diff --git a/src/me/ryanhamshire/GriefPrevention/DataStore.java b/src/me/ryanhamshire/GriefPrevention/DataStore.java index c162c9e..484f9b8 100644 --- a/src/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DataStore.java @@ -129,6 +129,7 @@ public abstract class DataStore if(UUIDFetcher.lookupCache != null) { UUIDFetcher.lookupCache.clear(); + UUIDFetcher.correctedNames.clear(); } GriefPrevention.AddLogEntry("Update finished."); diff --git a/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java b/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java index 7bcc884..c51687f 100644 --- a/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java @@ -158,6 +158,17 @@ public class FlatFileDataStore extends DataStore { String currentFilename = playerFile.getName(); + //if corrected casing and a record already exists using the correct casing, skip this one + String correctedCasing = UUIDFetcher.correctedNames.get(currentFilename); + if(correctedCasing != null) + { + File correctedCasingFile = new File(playerDataFolder.getPath() + File.separator + correctedCasing); + if(correctedCasingFile.exists()) + { + continue; + } + } + //try to convert player name to UUID UUID playerID = null; try diff --git a/src/me/ryanhamshire/GriefPrevention/UUIDFetcher.java b/src/me/ryanhamshire/GriefPrevention/UUIDFetcher.java index dd5f0cc..19b343f 100644 --- a/src/me/ryanhamshire/GriefPrevention/UUIDFetcher.java +++ b/src/me/ryanhamshire/GriefPrevention/UUIDFetcher.java @@ -24,6 +24,9 @@ class UUIDFetcher { //cache for username -> uuid lookups static HashMap lookupCache; + + //record of username -> proper casing updates + static HashMap correctedNames; public UUIDFetcher(List names, boolean rateLimiting) { this.names = names; @@ -41,6 +44,11 @@ class UUIDFetcher { lookupCache = new HashMap(); } + if(correctedNames == null) + { + correctedNames = new HashMap(); + } + GriefPrevention.AddLogEntry("UUID conversion process started. Please be patient - this may take a while."); //try to get correct casing from local data @@ -56,6 +64,7 @@ class UUIDFetcher { if(!player.getName().equals(name)) { GriefPrevention.AddLogEntry(name + " --> " + player.getName()); + correctedNames.put(name, player.getName()); names.set(i, player.getName()); } break;