Fix NPE on startup with flatfile

This commit is contained in:
Xephi 2014-08-30 04:20:17 +02:00
parent 6e17b540f5
commit 7596266d7c
3 changed files with 7 additions and 3 deletions

View File

@ -205,7 +205,7 @@ public class AuthMe extends JavaPlugin {
databaseThread = fileThread;
final int a = database.getAccountsRegistered();
if (a >= 1000) {
ConsoleLogger.showError("YOUR USING FILE DATABASE WITH " + a + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE USE MYSQL!!");
ConsoleLogger.showError("YOU'RE USING FILE DATABASE WITH " + a + "+ ACCOUNTS, FOR BETTER PERFORMANCES, PLEASE USE MYSQL!!");
}
break;
case MYSQL:

View File

@ -31,8 +31,11 @@ public class FlatFileThread extends Thread implements DataSource {
*/
private File source;
public void run() {
public FlatFileThread() {
source = new File(Settings.AUTH_FILE);
}
public void run() {
try {
source.createNewFile();
} catch (IOException e) {

View File

@ -23,7 +23,7 @@ import fr.xephi.authme.security.HashAlgorithm;
public final class Settings extends YamlConfiguration {
public static final String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe";
public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe";
public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache";
public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db";
public static final String MESSAGE_FILE = Settings.PLUGIN_FOLDER + File.separator + "messages";
@ -106,6 +106,7 @@ public final class Settings extends YamlConfiguration {
load();
}
configFile = (YamlConfiguration) plugin.getConfig();
PLUGIN_FOLDER = plugin.getDataFolder().toString();
}
@SuppressWarnings("unchecked")