geforkt von Mirrors/FastAsyncWorldEdit
Properly generate the default configuration
Dieser Commit ist enthalten in:
Ursprung
27b6efefdb
Commit
1c2348cd41
@ -36,7 +36,7 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
public class ConfigurateConfiguration extends LocalConfiguration {
|
public class ConfigurateConfiguration extends LocalConfiguration {
|
||||||
|
|
||||||
private final ConfigurationLoader<CommentedConfigurationNode> config;
|
protected final ConfigurationLoader<CommentedConfigurationNode> config;
|
||||||
protected final Logger logger;
|
protected final Logger logger;
|
||||||
|
|
||||||
protected CommentedConfigurationNode node;
|
protected CommentedConfigurationNode node;
|
||||||
@ -50,7 +50,7 @@ public class ConfigurateConfiguration extends LocalConfiguration {
|
|||||||
public void load() {
|
public void load() {
|
||||||
try {
|
try {
|
||||||
ConfigurationOptions options = ConfigurationOptions.defaults();
|
ConfigurationOptions options = ConfigurationOptions.defaults();
|
||||||
options.setShouldCopyDefaults(true);
|
options = options.setShouldCopyDefaults(true);
|
||||||
|
|
||||||
node = config.load(options);
|
node = config.load(options);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -24,6 +24,8 @@ import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
|||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class SpongeConfiguration extends ConfigurateConfiguration {
|
public class SpongeConfiguration extends ConfigurateConfiguration {
|
||||||
@ -41,6 +43,12 @@ public class SpongeConfiguration extends ConfigurateConfiguration {
|
|||||||
|
|
||||||
creativeEnable = node.getNode("use-in-creative").getBoolean(false);
|
creativeEnable = node.getNode("use-in-creative").getBoolean(false);
|
||||||
cheatMode = node.getNode("cheat-mode").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
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren