diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index bf88b15d0..2328d8206 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -1,9 +1,12 @@ package fr.xephi.authme.settings; import java.io.File; +import java.io.InputStream; + import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; +import fr.xephi.authme.AuthMe; import fr.xephi.authme.ConsoleLogger; public class Messages extends CustomConfiguration { @@ -24,11 +27,13 @@ public class Messages extends CustomConfiguration { * @param filename * The filename to open */ + @SuppressWarnings("deprecation") public final void loadDefaults(File file) { - if (!file.exists()) + InputStream stream = AuthMe.getInstance().getResource(file.getName()); + if (stream == null) return; - - setDefaults(YamlConfiguration.loadConfiguration(file)); + + setDefaults(YamlConfiguration.loadConfiguration(stream)); } /** diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index ecb06d8de..61b5a682f 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -7,6 +7,7 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -102,7 +103,7 @@ public final class Settings extends YamlConfiguration { if (exists()) { load(); } else { - loadDefaults(file); + loadDefaults(file.getName()); load(); } configFile = (YamlConfiguration) plugin.getConfig(); @@ -569,6 +570,8 @@ public final class Settings extends YamlConfiguration { } if (contains("Performances.useMultiThreading")) set("Performances.useMultiThreading", null); + if (contains("Performances")) + set("Performances", null); if (!contains("Email.emailWhitelisted")) { set("Email.emailWhitelisted", new ArrayList()); changes = true; @@ -683,7 +686,7 @@ public final class Settings extends YamlConfiguration { public final void reload() { load(); - loadDefaults(file); + loadDefaults(file.getName()); } /** @@ -715,12 +718,14 @@ public final class Settings extends YamlConfiguration { * @param filename * The filename to open */ - public final void loadDefaults(File file) { - if (!file.exists()) - return; - - setDefaults(YamlConfiguration.loadConfiguration(file)); - } + @SuppressWarnings("deprecation") + public final void loadDefaults(String filename) { + InputStream stream = plugin.getResource(filename); + if (stream == null) + return; + + setDefaults(YamlConfiguration.loadConfiguration(stream)); + } /** * Saves current configuration (plus defaults) to disk. diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 91e2c2f9f..0475c055c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,7 +1,7 @@ DataSource: - # Can be set to : file, sqlite, mysql + # Can be set to: sqlite, mysql backend: sqlite - # Do we need to cache all query? + # Enable database caching caching: true # Database location mySQLHost: 127.0.0.1 @@ -385,10 +385,6 @@ Hooks: useEssentialsMotd: false # Do we need to cache custom Attributes ? customAttributes: false -Performances: - # HIGHLY recommended to use this! This will increase database performance - # Default is true, change it to false if you experience issues - useMultiThreading: true Purge: # On Enable , does AuthMe need to purge automatically old accounts unused ? useAutoPurge: false