Split project
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
package com.alttd.playershops.config;
|
||||
|
||||
import com.alttd.galaxy.configuration.AbstractConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class Config extends AbstractConfiguration {
|
||||
|
||||
private Config() {
|
||||
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + "playershops"), "config");
|
||||
}
|
||||
|
||||
static Config config;
|
||||
static int version;
|
||||
|
||||
public static void reload() {
|
||||
config = new Config();
|
||||
|
||||
version = config.getInt("config-version", 1);
|
||||
config.set("config-version", 1);
|
||||
|
||||
config.readConfig(Config.class, null);
|
||||
}
|
||||
|
||||
public static int shopLimit = 100;
|
||||
public static boolean usePermissionShopLimit = false;
|
||||
private static void shopSettings() {
|
||||
String path = "shop-settings.";
|
||||
shopLimit = config.getInt(path + "player-shop-limit", shopLimit);
|
||||
usePermissionShopLimit = config.getBoolean(path + "use-permission-based-shop-limit", usePermissionShopLimit);
|
||||
}
|
||||
|
||||
public static String shopLimitPermission = "shop.buildlimit";
|
||||
private static void permissionSettings() {
|
||||
String path = "permission.";
|
||||
shopLimitPermission = config.getString(path + "build-limit", shopLimitPermission);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.alttd.playershops.config;
|
||||
|
||||
public class ShopTypeConfig {
|
||||
|
||||
private final String shopType;
|
||||
private final String configPath;
|
||||
private final String defaultPath;
|
||||
|
||||
public ShopTypeConfig(String shopType) {
|
||||
this.shopType = shopType;
|
||||
this.configPath = "shop.type." + this.shopType + ".";
|
||||
this.defaultPath = "shop.type.default.";
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Config.config.readConfig(ShopTypeConfig.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));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user