ChestShop-3/com/Acrobot/ChestShop/Config/Config.java

60 lines
1.6 KiB
Java
Raw Normal View History

2011-06-09 22:54:01 +02:00
package com.Acrobot.ChestShop.Config;
import com.nijikokun.register.payment.forChestShop.Methods;
/**
* @author Acrobot
*/
public class Config {
public static ConfigObject config;
public static void setup(ConfigObject cfg) {
config = cfg;
Methods.setPreferred(Config.getString(Property.PREFERRED_ECONOMY_PLUGIN));
}
2011-07-02 20:34:14 +02:00
public static boolean getBoolean(Property value) {
return (Boolean) getValue(value.name());
2011-05-15 19:33:03 +02:00
}
public static float getFloat(Property value) {
2012-04-19 15:46:05 +02:00
return getFloat(value.name());
}
public static float getFloat(String value) {
return new Float(getValue(value).toString());
}
2011-07-02 20:34:14 +02:00
public static String getString(Property value) {
return (String) getValue(value.name());
}
2011-07-02 20:34:14 +02:00
public static int getInteger(Property value) {
return Integer.parseInt(getValue(value.name()).toString());
}
2011-07-02 20:34:14 +02:00
public static double getDouble(Property value) {
2012-04-19 15:46:05 +02:00
return getDouble(getValue(value.name()).toString());
}
public static double getDouble(String value) {
return Double.parseDouble(value);
}
private static String getColored(String msg) {
return msg.replaceAll("&([0-9a-f])", "\u00A7$1");
}
public static String getLocal(Language lang) {
return getColored(config.getLanguageConfig().getString(Language.prefix.name()) + config.getLanguageConfig().getString(lang.name()));
}
public static boolean exists(String value) {
return getValue(value) != null;
}
2011-05-29 13:25:25 +02:00
private static Object getValue(String node) {
return config.getProperty(node);
}
}