3
0
Fork 1
KCauldronX/src/main/java/kcauldron/KCauldronConfig.java

105 lines
4.8 KiB
Java
Raw Normal View History

2015-05-31 11:21:26 +00:00
package kcauldron;
import org.bukkit.configuration.file.YamlConfiguration;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.cauldron.configuration.BoolSetting;
import net.minecraftforge.cauldron.configuration.ConfigBase;
2016-02-04 15:55:51 +00:00
import net.minecraftforge.cauldron.configuration.IntSetting;
2015-05-31 11:21:26 +00:00
import net.minecraftforge.cauldron.configuration.Setting;
import net.minecraftforge.cauldron.configuration.StringSetting;
public class KCauldronConfig extends ConfigBase {
2015-06-27 09:32:21 +00:00
public BoolSetting commandEnable = new BoolSetting(this, "command.enable",
2015-06-27 12:47:27 +00:00
true, "Enable KCauldron command");
2015-06-27 09:32:21 +00:00
public BoolSetting updatecheckerEnable = new BoolSetting(this,
2017-07-22 22:43:18 +00:00
"updatechecker.enable", false, "Enable KCauldron update checker");
2015-06-27 09:32:21 +00:00
public StringSetting updatecheckerSymlinks = new StringSetting(this,
2015-06-27 12:47:27 +00:00
"updatechecker.symlinks", "KCauldron.jar", "(Re)create symlinks after update");
2015-06-27 09:32:21 +00:00
public BoolSetting updatecheckerAutoinstall = new BoolSetting(this,
2015-06-27 12:47:27 +00:00
"updatechecker.autoinstall", false, "Install updates without confirming");
2015-06-27 09:32:21 +00:00
public BoolSetting updatecheckerAutorestart = new BoolSetting(this,
2015-06-27 12:47:27 +00:00
"updatechecker.autorestart", false, "Restart server after updating without confirming (set restart script in spigot.yml)");
2015-09-09 22:21:43 +00:00
public BoolSetting updatecheckerQuiet = new BoolSetting(this,
"updatechecker.quiet", false, "Print less info during update");
2015-05-31 11:21:26 +00:00
2015-06-27 09:32:21 +00:00
public BoolSetting loggingMaterialInjection = new BoolSetting(this,
2015-06-27 12:47:27 +00:00
"logging.materialInjection", false, "Log material injection event");
public BoolSetting loggingClientModList = new BoolSetting(this,
"logging.clientModList", true, "Print client's mod list during attempt to join");
public BoolSetting commonAllowNetherPortal = new BoolSetting(this,
"common.allowNetherPortalBesidesOverworld", false, "Allow nether portals in dimensions besides overworld");
2016-02-04 15:55:51 +00:00
public BoolSetting commonFastLeavesDecayEnable = new BoolSetting(this,
"common.fastLeavesDecay.enable", false, "Enable fast decaying of leaves, not affects drop chanches /etc");
public IntSetting commonFastLeavesDecayMinTickTime = new IntSetting(this,
"common.fastLeavesDecay.minTickTime", 5, "Minimal amount of tick between block updates");
public IntSetting commonFastLeavesDecayMaxTickTime = new IntSetting(this,
"common.fastLeavesDecay.maxTickTime", 10, "Minimal amount of tick between block updates");
public IntSetting commonMaxChunkGenPerTick = new IntSetting(this,
"common.maxChunkGenPerTick", 1, "How many chunks generate during tick");
public BoolSetting experimentalTileEntityListRecreation = new BoolSetting(this,
"experimental.tileEntityListRecreation", false, "EXPERIMENTAL! Recreate list of TE each tick.");
public static boolean tileEntityListRecreation;
2015-06-27 09:32:21 +00:00
public KCauldronConfig() {
2015-06-27 12:47:27 +00:00
super("kcauldron.yml", "kc");
register(commandEnable);
register(updatecheckerEnable);
register(updatecheckerSymlinks);
register(updatecheckerAutoinstall);
register(updatecheckerAutorestart);
2015-09-09 22:21:43 +00:00
register(updatecheckerQuiet);
2015-06-27 12:47:27 +00:00
register(loggingMaterialInjection);
register(loggingClientModList);
register(commonAllowNetherPortal);
2016-02-04 15:55:51 +00:00
register(commonFastLeavesDecayEnable);
register(commonFastLeavesDecayMinTickTime);
register(commonFastLeavesDecayMaxTickTime);
register(experimentalTileEntityListRecreation);
2015-06-27 12:47:27 +00:00
load();
2015-06-27 09:32:21 +00:00
}
2015-05-31 11:21:26 +00:00
2015-06-27 09:32:21 +00:00
private void register(Setting<?> setting) {
2015-06-27 12:47:27 +00:00
settings.put(setting.path, setting);
2015-06-27 09:32:21 +00:00
}
2015-05-31 11:21:26 +00:00
2015-06-27 09:32:21 +00:00
@Override
public void registerCommands() {
2015-06-27 12:47:27 +00:00
if (commandEnable.getValue()) {
super.registerCommands();
}
2015-06-27 09:32:21 +00:00
}
2015-05-31 11:21:26 +00:00
2015-06-27 09:32:21 +00:00
@Override
protected void addCommands() {
2015-06-27 12:47:27 +00:00
commands.put(commandName, new KCauldronCommand());
2015-06-27 09:32:21 +00:00
}
2015-05-31 11:21:26 +00:00
2015-06-27 09:32:21 +00:00
@Override
protected void load() {
2015-06-27 12:47:27 +00:00
try {
config = YamlConfiguration.loadConfiguration(configFile);
String header = "";
for (Setting<?> toggle : settings.values()) {
if (!toggle.description.equals(""))
header += "Setting: " + toggle.path + " Default: "
+ toggle.def + " # " + toggle.description + "\n";
2015-05-31 11:21:26 +00:00
2015-06-27 12:47:27 +00:00
config.addDefault(toggle.path, toggle.def);
settings.get(toggle.path).setValue(
config.getString(toggle.path));
}
config.options().header(header);
config.options().copyDefaults(true);
save();
} catch (Exception ex) {
MinecraftServer.getServer().logSevere(
"Could not load " + this.configFile);
ex.printStackTrace();
}
tileEntityListRecreation = experimentalTileEntityListRecreation.getValue();
2015-06-27 09:32:21 +00:00
}
2015-05-31 11:21:26 +00:00
}