2012-05-19 04:01:15 +02:00
|
|
|
package com.gmail.nossr50.config;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2012-05-19 04:01:15 +02:00
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import java.io.InputStreamReader;
|
2012-05-19 04:01:15 +02:00
|
|
|
|
2012-07-03 21:57:24 +02:00
|
|
|
public class HiddenConfig {
|
2012-05-19 04:01:15 +02:00
|
|
|
private static HiddenConfig instance;
|
2020-07-13 20:39:03 +02:00
|
|
|
private final String fileName;
|
2014-08-12 17:51:34 +02:00
|
|
|
private YamlConfiguration config;
|
|
|
|
private boolean chunkletsEnabled;
|
|
|
|
private int conversionRate;
|
|
|
|
private boolean useEnchantmentBuffs;
|
2012-05-19 04:01:15 +02:00
|
|
|
|
2012-07-03 21:57:24 +02:00
|
|
|
public HiddenConfig(String fileName) {
|
2014-08-12 17:51:34 +02:00
|
|
|
this.fileName = fileName;
|
2012-07-03 21:57:24 +02:00
|
|
|
load();
|
2012-05-19 04:01:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static HiddenConfig getInstance() {
|
|
|
|
if (instance == null) {
|
2012-07-03 21:57:24 +02:00
|
|
|
instance = new HiddenConfig("hidden.yml");
|
2012-05-19 04:01:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2012-05-23 19:52:33 +02:00
|
|
|
public void load() {
|
2017-05-14 17:36:31 +02:00
|
|
|
InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName);
|
|
|
|
if (reader != null) {
|
|
|
|
config = YamlConfiguration.loadConfiguration(reader);
|
2012-07-03 21:57:24 +02:00
|
|
|
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
|
2012-11-06 03:02:53 +01:00
|
|
|
conversionRate = config.getInt("Options.ConversionRate", 1);
|
2013-02-16 20:36:46 +01:00
|
|
|
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
|
2012-05-23 19:52:33 +02:00
|
|
|
}
|
2012-05-19 04:01:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getChunkletsEnabled() {
|
|
|
|
return chunkletsEnabled;
|
|
|
|
}
|
2012-11-04 22:36:57 +01:00
|
|
|
|
|
|
|
public int getConversionRate() {
|
|
|
|
return conversionRate;
|
|
|
|
}
|
2013-02-16 20:36:46 +01:00
|
|
|
|
|
|
|
public boolean useEnchantmentBuffs() {
|
|
|
|
return useEnchantmentBuffs;
|
|
|
|
}
|
2012-05-19 04:01:15 +02:00
|
|
|
}
|