From 886b73de2848ac2ef0dee8ff6bdf49e9777a6596 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Wed, 16 Sep 2015 14:45:51 +0200 Subject: [PATCH] New upgrade code --- resources/config.yml | 2 ++ resources/{Lang => lang2}/de.yml | 0 resources/{Lang => lang2}/en.yml | 0 .../georgh/MinePacks/Database/Config.java | 22 ++++++++++++++----- .../georgh/MinePacks/Database/Database.java | 2 +- 5 files changed, 19 insertions(+), 7 deletions(-) rename resources/{Lang => lang2}/de.yml (100%) rename resources/{Lang => lang2}/en.yml (100%) diff --git a/resources/config.yml b/resources/config.yml index 0555374..9892b91 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -16,6 +16,8 @@ command_cooldown: -1 # Defines if the content of the backpack get droped on the death of a player. # If enabled, it can be disabled for individual players with the "backpack.KeepOnDeath" permission. drop_on_death: true +# Defines if the message that the backpack has been closed should be shown +show_close_message: true # Controlls for the auto pickup on full inventory function full_inventory: diff --git a/resources/Lang/de.yml b/resources/lang2/de.yml similarity index 100% rename from resources/Lang/de.yml rename to resources/lang2/de.yml diff --git a/resources/Lang/en.yml b/resources/lang2/en.yml similarity index 100% rename from resources/Lang/en.yml rename to resources/lang2/en.yml diff --git a/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java b/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java index 5bfb77d..3a1403a 100644 --- a/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java +++ b/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java @@ -23,6 +23,8 @@ import org.bukkit.ChatColor; import org.bukkit.plugin.java.JavaPlugin; +import java.util.Set; + public class Config extends Configuration { private static final int CONFIG_VERSION = 9; @@ -45,6 +47,18 @@ protected void doUpdate(int version) // Nothing to update yet } + @Override + protected void doUpgrade(Configuration oldConfiguration) + { + Set keys = oldConfiguration.getConfig().getKeys(true); + for(String key : keys) + { + if(key.equals("Database.UseUUIDs") || key.equals("UseUUIDs")) continue; + config.set(key, oldConfiguration.getConfig().get(key)); + } + config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible()); + } + // Getter public int getAutoCleanupMaxInactiveDays() { @@ -96,13 +110,9 @@ public boolean getUpdatePlayer() return config.getBoolean("Database.UpdatePlayer", true); } - public boolean UseUUIDs() + public boolean getUseUUIDs() { - if(config.isSet("Database.UseUUIDs")) - { - return config.getBoolean("Database.UseUUIDs"); - } - return config.getBoolean("UseUUIDs"); + return config.getBoolean("Database.UseUUIDs"); } public boolean getUseUUIDSeparators() diff --git a/src/at/pcgamingfreaks/georgh/MinePacks/Database/Database.java b/src/at/pcgamingfreaks/georgh/MinePacks/Database/Database.java index 6e84a42..ff06857 100644 --- a/src/at/pcgamingfreaks/georgh/MinePacks/Database/Database.java +++ b/src/at/pcgamingfreaks/georgh/MinePacks/Database/Database.java @@ -40,7 +40,7 @@ public Database(MinePacks mp) { plugin = mp; UseUUIDSeparators = plugin.config.getUseUUIDSeparators(); - UseUUIDs = plugin.config.UseUUIDs(); + UseUUIDs = plugin.config.getUseUUIDs(); maxAge = plugin.config.getAutoCleanupMaxInactiveDays(); }