Fix loading on BungeeCord (#1054)

This commit is contained in:
Luck 2018-06-17 09:49:38 +01:00
parent 6b305972ac
commit 957a918bd6
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -52,7 +52,7 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
/** /**
* The plugin logger * The plugin logger
*/ */
private final PluginLogger logger; private PluginLogger logger = null;
/** /**
* A scheduler adapter for the platform * A scheduler adapter for the platform
@ -79,7 +79,6 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
private final CountDownLatch enableLatch = new CountDownLatch(1); private final CountDownLatch enableLatch = new CountDownLatch(1);
public LPBungeeBootstrap() { public LPBungeeBootstrap() {
this.logger = new JavaPluginLogger(getLogger());
this.schedulerAdapter = new BungeeSchedulerAdapter(this); this.schedulerAdapter = new BungeeSchedulerAdapter(this);
this.classLoader = new ReflectionClassLoader(this); this.classLoader = new ReflectionClassLoader(this);
this.plugin = new LPBungeePlugin(this); this.plugin = new LPBungeePlugin(this);
@ -89,6 +88,9 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
@Override @Override
public PluginLogger getPluginLogger() { public PluginLogger getPluginLogger() {
if (this.logger == null) {
throw new IllegalStateException("Logger has not been initialised yet");
}
return this.logger; return this.logger;
} }
@ -106,6 +108,10 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
@Override @Override
public void onLoad() { public void onLoad() {
// init logger asap
this.logger = new JavaPluginLogger(getLogger());
// call load
try { try {
this.plugin.load(); this.plugin.load();
} finally { } finally {