Add config updater.
This commit is contained in:
@@ -71,7 +71,7 @@ public class Main extends JavaPlugin {
|
|||||||
dropOnDeath = true;
|
dropOnDeath = true;
|
||||||
inventoriesToDrop = getConfig().getInt("drop-on-death.inventories");
|
inventoriesToDrop = getConfig().getInt("drop-on-death.inventories");
|
||||||
}
|
}
|
||||||
|
|
||||||
new File(directory + File.separator + "backups").mkdirs();
|
new File(directory + File.separator + "backups").mkdirs();
|
||||||
config = getConfig();
|
config = getConfig();
|
||||||
|
|
||||||
@@ -128,6 +128,37 @@ public class Main extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateConfig() {
|
||||||
|
if(getConfig().get("check-update") == null) {
|
||||||
|
getConfig().set("check-update", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getConfig().get("economy.enabled") == null) {
|
||||||
|
getConfig().set("economy.enabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getConfig().get("economy.cost-to-create") == null) {
|
||||||
|
getConfig().set("economy.cost-to-create", 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getConfig().get("economy.cost-to-open") == null) {
|
||||||
|
getConfig().set("economy.cost-to-create", 10);
|
||||||
|
}
|
||||||
|
if(getConfig().get("economy.refund-on-delete") == null) {
|
||||||
|
getConfig().set("economy.refund-on-delete", 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getConfig().get("drop-on-death.enabled") == null) {
|
||||||
|
getConfig().set("drop-on-death.enabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getConfig().get("drop-on-death.inventories") == null) {
|
||||||
|
getConfig().set("drop-on-death.inventories", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
public YamlConfiguration loadLang() {
|
public YamlConfiguration loadLang() {
|
||||||
File lang = new File(getDataFolder(), "lang.yml");
|
File lang = new File(getDataFolder(), "lang.yml");
|
||||||
if(!lang.exists()) {
|
if(!lang.exists()) {
|
||||||
@@ -158,7 +189,7 @@ public class Main extends JavaPlugin {
|
|||||||
public YamlConfiguration getLang() {
|
public YamlConfiguration getLang() {
|
||||||
return lang;
|
return lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getLangFile() {
|
public File getLangFile() {
|
||||||
return langFile;
|
return langFile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class BackwardsCompatibility {
|
|||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static CraftItemStack getCraftVersion(org.bukkit.inventory.ItemStack stack) {
|
private static CraftItemStack getCraftVersion(org.bukkit.inventory.ItemStack stack) {
|
||||||
if ((stack instanceof CraftItemStack))
|
if ((stack instanceof CraftItemStack))
|
||||||
return (CraftItemStack) stack;
|
return (CraftItemStack) stack;
|
||||||
|
|||||||
Reference in New Issue
Block a user