mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-12 00:07:33 +00:00
Added safeguard to WorldExtensionManager.saveWorld for when someone force closes the client.
Made config files save themselves on tag remove Removed ' ' -> '_' mapping in config file keys
This commit is contained in:
1 parent
8518ed3bb0
commit
fed626df0b
3 files changed
+11
-7
No files matched your search
@@ -200,10 +200,9 @@ public class ConfigTag extends ConfigTagParent
|
||||
{
|
||||
String vname;
|
||||
if(qualifiedname.contains(".") && bracequalifier.length() > 0)
|
||||
vname = qualifiedname.substring(bracequalifier.length() + 1).replace(' ', '_');
|
||||
vname = qualifiedname.substring(bracequalifier.length() + 1);
|
||||
else
|
||||
vname = qualifiedname;
|
||||
vname.replace(' ', '_');
|
||||
|
||||
if(newline && !first)
|
||||
ConfigFile.writeLine(writer, "", tabs);
|
||||
@@ -220,7 +219,7 @@ public class ConfigTag extends ConfigTagParent
|
||||
if(value == null)
|
||||
ConfigFile.writeLine(writer, vname, tabs);
|
||||
ConfigFile.writeLine(writer, "{", tabs);
|
||||
saveTagTree(writer, tabs+1, qualifiedname.replace(' ', '_'));
|
||||
saveTagTree(writer, tabs+1, qualifiedname);
|
||||
ConfigFile.writeLine(writer, "}", tabs);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -117,7 +117,6 @@ public abstract class ConfigTagParent
|
||||
|
||||
public ConfigTag getTag(String tagname, boolean create)
|
||||
{
|
||||
tagname = tagname.replace('_', ' ');
|
||||
int dotpos = tagname.indexOf(".");
|
||||
String basetagname = dotpos == -1 ? tagname : tagname.substring(0, dotpos);
|
||||
ConfigTag basetag = childtags.get(basetagname);
|
||||
@@ -149,7 +148,12 @@ public abstract class ConfigTagParent
|
||||
int dotpos = tagname.lastIndexOf(".");
|
||||
String lastpart = dotpos == -1 ? tagname : tagname.substring(dotpos+1, tagname.length());
|
||||
if(tag.parent != null)
|
||||
return tag.parent.childtags.remove(lastpart) != null;
|
||||
{
|
||||
boolean ret = tag.parent.childtags.remove(lastpart) != null;
|
||||
if(ret)
|
||||
saveConfig();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,9 @@ public class WorldExtensionManager
|
||||
@ForgeSubscribe
|
||||
public void onWorldSave(WorldEvent.Save event)
|
||||
{
|
||||
for(WorldExtension extension : worldMap.get(event.world))
|
||||
extension.save();
|
||||
if(worldMap.containsKey(event.world))
|
||||
for(WorldExtension extension : worldMap.get(event.world))
|
||||
extension.save();
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
|
||||
Reference in new issue
Block a user