Properly generate the default configuration

This commit is contained in:
Wyatt Childers 2016-05-18 19:35:24 -04:00
parent 27b6efefdb
commit 1c2348cd41
2 changed files with 10 additions and 2 deletions

View File

@ -36,7 +36,7 @@ import java.util.logging.Logger;
public class ConfigurateConfiguration extends LocalConfiguration {
private final ConfigurationLoader<CommentedConfigurationNode> config;
protected final ConfigurationLoader<CommentedConfigurationNode> config;
protected final Logger logger;
protected CommentedConfigurationNode node;
@ -50,7 +50,7 @@ public class ConfigurateConfiguration extends LocalConfiguration {
public void load() {
try {
ConfigurationOptions options = ConfigurationOptions.defaults();
options.setShouldCopyDefaults(true);
options = options.setShouldCopyDefaults(true);
node = config.load(options);
} catch (IOException e) {

View File

@ -24,6 +24,8 @@ import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.loader.ConfigurationLoader;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class SpongeConfiguration extends ConfigurateConfiguration {
@ -41,6 +43,12 @@ public class SpongeConfiguration extends ConfigurateConfiguration {
creativeEnable = node.getNode("use-in-creative").getBoolean(false);
cheatMode = node.getNode("cheat-mode").getBoolean(false);
try {
config.save(node);
} catch (IOException e) {
logger.log(Level.WARNING, "Error loading WorldEdit configuration", e);
}
}
@Override