Fix config path and config not loading
This commit is contained in:
parent
348786a5ee
commit
f7664a5c29
|
|
@ -1,6 +1,7 @@
|
||||||
package me.ryanhamshire.GriefPrevention.alttd.config;
|
package me.ryanhamshire.GriefPrevention.alttd.config;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import me.ryanhamshire.GriefPrevention.DataStore;
|
||||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
import me.ryanhamshire.GriefPrevention.alttd.util.Logger;
|
import me.ryanhamshire.GriefPrevention.alttd.util.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
@ -31,7 +32,7 @@ abstract class AbstractConfig {
|
||||||
File configPath;
|
File configPath;
|
||||||
|
|
||||||
AbstractConfig(String filename) {
|
AbstractConfig(String filename) {
|
||||||
this.configPath = GriefPrevention.instance.getDataFolder();
|
this.configPath = new File(DataStore.dataLayerFolderPath);
|
||||||
this.file = new File(configPath, filename);
|
this.file = new File(configPath, filename);
|
||||||
this.yaml = new YamlConfiguration();
|
this.yaml = new YamlConfiguration();
|
||||||
if (!this.file.getParentFile().exists()) {
|
if (!this.file.getParentFile().exists()) {
|
||||||
|
|
|
||||||
|
|
@ -142,4 +142,21 @@ public class Config extends AbstractConfig {
|
||||||
ignoreClaimWarningPermission = config.getString("settings.ignore-claim-warning-permission", ignoreClaimWarningPermission);
|
ignoreClaimWarningPermission = config.getString("settings.ignore-claim-warning-permission", ignoreClaimWarningPermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, Double> claimBlockPrices = new HashMap<>();
|
||||||
|
public static void claimBlockSettings() {
|
||||||
|
claimBlockPrices.clear();
|
||||||
|
config.getMap( "claimblock-prices", new HashMap<String, Double>(){{
|
||||||
|
put("0", .25);
|
||||||
|
put("501", .5);
|
||||||
|
put("10001", .75);
|
||||||
|
put("50001", 1.00);
|
||||||
|
put("300001", 2.00);
|
||||||
|
put("1000001", 5.00);
|
||||||
|
}})
|
||||||
|
.forEach((key, value) -> {
|
||||||
|
try {
|
||||||
|
claimBlockPrices.put(Integer.parseInt(key), value);
|
||||||
|
} catch (NumberFormatException ignored) {}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user