refactor: avoid duplicate code

This commit is contained in:
aro 2023-02-01 18:25:26 +01:00
parent c1880389de
commit e81d45c2f5

View file

@ -48,13 +48,13 @@ public class NickoBukkit extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
plugin = this; plugin = this;
nicko.initBukkit(this);
if (unitTesting) onUnitTestingStartup(); if (unitTesting) onUnitTestingStartup();
else onPluginStartup(); else onPluginStartup();
} }
public void onUnitTestingStartup() { public void onUnitTestingStartup() {
nicko.initBukkit(this);
if (!nicko.getDataStore().getStorage().getProvider().init()) { if (!nicko.getDataStore().getStorage().getProvider().init()) {
nicko.getDataStore().getStorage().setError(true); nicko.getDataStore().getStorage().setError(true);
getLogger().severe("Failed to open persistence, data will NOT be saved!"); getLogger().severe("Failed to open persistence, data will NOT be saved!");
@ -62,8 +62,6 @@ public class NickoBukkit extends JavaPlugin {
} }
public void onPluginStartup() { public void onPluginStartup() {
nicko.initBukkit(this);
getLogger().info("Loading internals..."); getLogger().info("Loading internals...");
if (getInternals() == null) { if (getInternals() == null) {
getLogger().severe("Nicko could not find a valid implementation for this server version. Is your server supported?"); getLogger().severe("Nicko could not find a valid implementation for this server version. Is your server supported?");