Fix NPE on Nukkit load (#1059)

This commit is contained in:
Luck
2018-06-19 23:40:13 +01:00
Unverified
parent 5b66436519
commit 6f96d9c7d1
2 changed files with 6 additions and 4 deletions
@@ -108,10 +108,8 @@ public class LPBungeeBootstrap extends Plugin implements LuckPermsBootstrap {
@Override
public void onLoad() {
// init logger asap
this.logger = new JavaPluginLogger(getLogger());
// call load
try {
this.plugin.load();
} finally {
@@ -49,7 +49,7 @@ public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap
/**
* The plugin logger
*/
private final PluginLogger logger;
private PluginLogger logger = null;
/**
* A scheduler adapter for the platform
@@ -76,7 +76,6 @@ public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap
private final CountDownLatch enableLatch = new CountDownLatch(1);
public LPNukkitBootstrap() {
this.logger = new NukkitPluginLogger(getLogger());
this.schedulerAdapter = new NukkitSchedulerAdapter(this);
this.classLoader = new ReflectionClassLoader(this);
this.plugin = new LPNukkitPlugin(this);
@@ -86,6 +85,9 @@ public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap
@Override
public PluginLogger getPluginLogger() {
if (this.logger == null) {
throw new IllegalStateException("Logger has not been initialised yet");
}
return this.logger;
}
@@ -103,6 +105,8 @@ public class LPNukkitBootstrap extends PluginBase implements LuckPermsBootstrap
@Override
public void onLoad() {
this.logger = new NukkitPluginLogger(getLogger());
try {
this.plugin.load();
} finally {