2011-06-09 22:54:01 +02:00
|
|
|
package com.Acrobot.ChestShop.Config;
|
2011-05-15 18:16:25 +02:00
|
|
|
|
2011-10-11 13:15:53 +02:00
|
|
|
import com.nijikokun.register.payment.forChestShop.Methods;
|
2011-05-15 18:16:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
|
|
|
public class Config {
|
2012-01-09 22:39:38 +01:00
|
|
|
public static ConfigObject config;
|
2011-05-15 18:16:25 +02:00
|
|
|
|
2011-09-06 19:01:57 +02:00
|
|
|
public static void setup(ConfigObject cfg) {
|
|
|
|
config = cfg;
|
2011-09-22 15:56:06 +02:00
|
|
|
Methods.setPreferred(Config.getString(Property.PREFERRED_ECONOMY_PLUGIN));
|
2011-05-15 18:16:25 +02:00
|
|
|
}
|
|
|
|
|
2011-07-02 20:34:14 +02:00
|
|
|
public static boolean getBoolean(Property value) {
|
2011-06-11 17:36:55 +02:00
|
|
|
return (Boolean) getValue(value.name());
|
2011-05-15 19:33:03 +02:00
|
|
|
}
|
|
|
|
|
2011-09-06 19:01:57 +02:00
|
|
|
public static float getFloat(Property value) {
|
2012-04-19 15:46:05 +02:00
|
|
|
return getFloat(value.name());
|
2011-08-13 12:08:34 +02:00
|
|
|
}
|
2012-03-17 15:00:25 +01:00
|
|
|
|
2012-03-01 22:03:59 +01:00
|
|
|
public static float getFloat(String value) {
|
|
|
|
return new Float(getValue(value).toString());
|
|
|
|
}
|
2011-08-13 12:08:34 +02:00
|
|
|
|
2011-07-02 20:34:14 +02:00
|
|
|
public static String getString(Property value) {
|
2011-06-13 00:59:10 +02:00
|
|
|
return (String) getValue(value.name());
|
2011-05-15 18:16:25 +02:00
|
|
|
}
|
|
|
|
|
2011-07-02 20:34:14 +02:00
|
|
|
public static int getInteger(Property value) {
|
2011-06-11 17:36:55 +02:00
|
|
|
return Integer.parseInt(getValue(value.name()).toString());
|
2011-05-15 18:16:25 +02:00
|
|
|
}
|
2011-05-21 19:55:55 +02:00
|
|
|
|
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);
|
2011-05-21 19:55:55 +02:00
|
|
|
}
|
|
|
|
|
2011-07-23 21:00:47 +02:00
|
|
|
private static String getColored(String msg) {
|
2011-06-11 17:36:55 +02:00
|
|
|
return msg.replaceAll("&([0-9a-f])", "\u00A7$1");
|
2011-05-21 19:55:55 +02:00
|
|
|
}
|
|
|
|
|
2011-06-11 17:36:55 +02:00
|
|
|
public static String getLocal(Language lang) {
|
2011-09-06 19:01:57 +02:00
|
|
|
return getColored(config.getLanguageConfig().getString(Language.prefix.name()) + config.getLanguageConfig().getString(lang.name()));
|
2011-05-21 19:55:55 +02:00
|
|
|
}
|
2012-03-17 15:00:25 +01:00
|
|
|
|
2012-03-01 22:03:59 +01:00
|
|
|
public static boolean exists(String value) {
|
|
|
|
return getValue(value) != null;
|
|
|
|
}
|
2011-05-21 19:55:55 +02:00
|
|
|
|
2011-05-29 13:25:25 +02:00
|
|
|
private static Object getValue(String node) {
|
2011-06-11 17:36:55 +02:00
|
|
|
return config.getProperty(node);
|
2011-05-21 19:55:55 +02:00
|
|
|
}
|
2011-05-15 18:16:25 +02:00
|
|
|
}
|