Add ShopMessageConfig
This commit is contained in:
parent
8802f240de
commit
10e2f322b3
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.alttd.playershops.config;
|
||||||
|
|
||||||
|
public class ShopMessageConfig {
|
||||||
|
|
||||||
|
private final String shopType;
|
||||||
|
private final String configPath;
|
||||||
|
private final String defaultPath;
|
||||||
|
|
||||||
|
public ShopMessageConfig(String shopType) {
|
||||||
|
this.shopType = shopType;
|
||||||
|
this.configPath = "shop.text." + this.shopType + ".";
|
||||||
|
this.defaultPath = "shop.text.default.";
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
Config.config.readConfig(ShopMessageConfig.class, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void set(String path, Object def) {
|
||||||
|
Config.config.set(path, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getString(String path, String def) {
|
||||||
|
set(defaultPath + path, def);
|
||||||
|
return Config.config.getNode(configPath + path).getString(
|
||||||
|
Config.config.getNode(defaultPath + path).getString(def));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user