From 95f6a4d09b93b5c1a2aafb7e5aedb6e62b9b7143 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Thu, 17 Sep 2015 15:10:00 +0200 Subject: [PATCH] Updates and Bugfixes --- .gitignore | 5 +--- resources/config.yml | 3 ++- resources/lang/de.yml | 14 +++++----- resources/lang/en.yml | 6 +++-- .../georgh/MinePacks/Database/Config.java | 26 +++++++++++++------ .../georgh/MinePacks/MinePacks.java | 10 ++++--- 6 files changed, 40 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 567fe9b..e789273 100644 --- a/.gitignore +++ b/.gitignore @@ -56,7 +56,4 @@ Temporary Items /target/ /bin/ *.iml -/.idea/ - - -jar_libs/bukkit.jar \ No newline at end of file +/.idea/ \ No newline at end of file diff --git a/resources/config.yml b/resources/config.yml index 9892b91..9f88704 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -43,6 +43,7 @@ Database: # true: Only to use if your server is running in online mode and your minecraft version is 1.7.5 or newer # false: In offline mode or for minecraft version below 1.7.5 # Should be configured automaticaly based on your minecraft version and online mode settings + # If you are using BungeeCord please set this setting based on your BungeeCord's online mode. UseUUIDs: true # Defines the storage format for UUIDs for compatibility with other plugins (shared tables) # true: format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx @@ -74,5 +75,5 @@ Database: # Enables/Disables the auto-update function of the plugin. auto-update: true -# Config File Version. Don't touch it! +# Config file version. Don't touch it! Version: 9 \ No newline at end of file diff --git a/resources/lang/de.yml b/resources/lang/de.yml index 2b0d1d0..c99e6dd 100644 --- a/resources/lang/de.yml +++ b/resources/lang/de.yml @@ -1,4 +1,3 @@ -Version: 3 Language: Console: Enabled: MinePacks wurde aktiviert! @@ -6,16 +5,19 @@ Language: NotFromConsole: Befehlt nicht von der Console aus verwendbar. LangUpdated: Sprachdatei wurde aktualisiert. UpdateUUIDs: Starte Datenbank Update auf UUIDs ... - UpdatedUUIDs: '%s Datensätze wurden auf UUIDs geupdated.' + UpdatedUUIDs: '%s Datens�tze wurden auf UUIDs geupdated.' Ingame: - NoPermission: 'Dir fehlen die Rechte dafür.' + NoPermission: 'Dir fehlen die Rechte daf�r.' OwnBackPackClose: 'Rucksack geschlossen!' PlayerBackPackClose: "%s's Rucksack geschlossen!" InvalidBackpack: Rucksack fehlerhaft. BackpackCleaned: Rucksack gelehrt. - Cooldown: 'Bitte warte etwas bis du deinen Rucksack erneut öffnest.' + Cooldown: 'Bitte warte etwas bis du deinen Rucksack erneut �ffnest.' Description: - Backpack: Öffnet deinen Rucksack. + Backpack: �ffnet deinen Rucksack. Clean: Leert deinen Rucksack. CleanOther: Leert den Rucksack von Spielern. - View: Zeigt den Rucksack von anderen Spielern. \ No newline at end of file + View: Zeigt den Rucksack von anderen Spielern. + +# Language file version. Don't touch it! +Version: 3 \ No newline at end of file diff --git a/resources/lang/en.yml b/resources/lang/en.yml index 2732902..717f345 100644 --- a/resources/lang/en.yml +++ b/resources/lang/en.yml @@ -1,4 +1,3 @@ -Version: 3 Language: Console: Enabled: MinePacks has been enabled! @@ -18,4 +17,7 @@ Language: Backpack: Opens your backpack. Clean: Cleans your backpack. CleanOther: Cleans the backpack of other players. - View: Shows the backpack of other player. \ No newline at end of file + View: Shows the backpack of other player. + +# Language file version. Don't touch it! +Version: 3 \ No newline at end of file diff --git a/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java b/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java index 3a1403a..9d5d0c4 100644 --- a/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java +++ b/src/at/pcgamingfreaks/georgh/MinePacks/Database/Config.java @@ -37,26 +37,36 @@ public Config(JavaPlugin plugin) @Override protected boolean newConfigCreated() { - config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible()); - return true; + config.set("Database.UseUUIDs", plugin.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible()); + return !(plugin.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible()); } @Override - protected void doUpdate(int version) + protected void doUpdate() { // Nothing to update yet } @Override - protected void doUpgrade(Configuration oldConfiguration) + protected void doUpgrade(Configuration oldConfig) { - Set keys = oldConfiguration.getConfig().getKeys(true); + Set keys = oldConfig.getConfig().getKeys(true); for(String key : keys) { - if(key.equals("Database.UseUUIDs") || key.equals("UseUUIDs")) continue; - config.set(key, oldConfiguration.getConfig().get(key)); + if(key.equals("UseUUIDs") || key.equals("Version")) continue; + config.set(key, oldConfig.getConfig().get(key)); + } + if(!oldConfig.getConfig().isSet("Database.UseUUIDs")) + { + if(oldConfig.getConfig().isSet("UseUUIDs")) + { + config.set("Database.UseUUIDs", config.getBoolean("UseUUIDs")); + } + else + { + config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible()); + } } - config.set("Database.UseUUIDs", Bukkit.getServer().getOnlineMode() && isBukkitVersionUUIDCompatible()); } // Getter diff --git a/src/at/pcgamingfreaks/georgh/MinePacks/MinePacks.java b/src/at/pcgamingfreaks/georgh/MinePacks/MinePacks.java index 9af7f13..c9d500c 100644 --- a/src/at/pcgamingfreaks/georgh/MinePacks/MinePacks.java +++ b/src/at/pcgamingfreaks/georgh/MinePacks/MinePacks.java @@ -33,9 +33,9 @@ public class MinePacks extends JavaPlugin { - public final Logger log = getLogger(); - public final Config config = new Config(this); - public final Language lang = new Language(this); + public Logger log; + public Config config; + public Language lang; public Database DB; public HashMap cooldowns = new HashMap<>(); @@ -46,6 +46,10 @@ public class MinePacks extends JavaPlugin @Override public void onEnable() { + log = getLogger(); + config = new Config(this); + lang = new Language(this); + lang.load(config.getLanguage(), config.getLanguageUpdateMode()); DB = Database.getDatabase(this); getCommand("backpack").setExecutor(new OnCommand(this));