init instance at the top, to avoid problems.

This commit is contained in:
DNx5 2015-09-14 04:32:12 +07:00
parent 2fe9e735a1
commit 9736e4c207
2 changed files with 6 additions and 7 deletions

View File

@ -53,9 +53,9 @@ import java.util.zip.GZIPInputStream;
public class AuthMe extends JavaPlugin { public class AuthMe extends JavaPlugin {
public static Server server; private static Server server;
public static Logger authmeLogger = Logger.getLogger("AuthMe"); private static Logger authmeLogger = Logger.getLogger("AuthMe");
public static AuthMe authme; private static AuthMe authme;
public Management management; public Management management;
public NewAPI api; public NewAPI api;
private Utils utils = Utils.getInstance(); private Utils utils = Utils.getInstance();
@ -115,6 +115,8 @@ public class AuthMe extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
// Set the Instance
authme = this;
// TODO: split the plugin in more modules // TODO: split the plugin in more modules
// TODO: remove vault as hard dependency // TODO: remove vault as hard dependency
@ -125,9 +127,6 @@ public class AuthMe extends JavaPlugin {
// Setup the Logger // Setup the Logger
authmeLogger.setParent(this.getLogger()); authmeLogger.setParent(this.getLogger());
// Set the Instance
authme = this;
// Setup otherAccounts file // Setup otherAccounts file
otherAccounts = OtherAccounts.getInstance(); otherAccounts = OtherAccounts.getInstance();

View File

@ -28,7 +28,7 @@ public class JsonCache {
public JsonCache(AuthMe plugin) { public JsonCache(AuthMe plugin) {
this.plugin = plugin; this.plugin = plugin;
cacheDir = new File(plugin.getDataFolder() + File.separator + "cache"); cacheDir = new File(plugin.getDataFolder(), "cache");
if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) {
ConsoleLogger.showError("Failed to create cache directory."); ConsoleLogger.showError("Failed to create cache directory.");
} }