mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Fixes crash when mods add TreeMaps to the Configuration map, thanks AtomicStryker, PR: #282
This commit is contained in:
1 parent
c68dfae100
commit
76d6bc3cfa
1 file changed
+22
@@ -695,6 +695,28 @@ public class Configuration
|
||||
|
||||
private void save(BufferedWriter out) throws IOException
|
||||
{
|
||||
//For compatiblitties sake just in case, Thanks Atomic, to be removed next MC version
|
||||
//TO-DO: Remove next MC version
|
||||
Object[] categoryArray = categories.values().toArray();
|
||||
for (Object o : categoryArray)
|
||||
{
|
||||
if (o instanceof TreeMap)
|
||||
{
|
||||
TreeMap treeMap = (TreeMap)o;
|
||||
ConfigCategory converted = new ConfigCategory(file.getName());
|
||||
FMLLog.warning("Forge found a Treemap saved for Configuration file " + file.getName() + ", this is deprecated behaviour!");
|
||||
|
||||
for (Object key : treeMap.keySet())
|
||||
{
|
||||
FMLLog.warning("Converting Treemap to ConfigCategory, key: " + key + ", property value: " + ((Property)treeMap.get(key)).value);
|
||||
converted.set((String)key, (Property)treeMap.get(key));
|
||||
}
|
||||
|
||||
categories.values().remove(o);
|
||||
categories.put(file.getName(), converted);
|
||||
}
|
||||
}
|
||||
|
||||
for (ConfigCategory cat : categories.values())
|
||||
{
|
||||
if (!cat.isChild())
|
||||
|
||||
Reference in new issue
Block a user