fix: internals not found error

This commit is contained in:
aro 2023-01-20 17:15:45 +01:00
parent f7a9689ee2
commit 95b3e420bc

View file

@ -90,6 +90,11 @@ public class NickoBukkit extends JavaPlugin {
} }
public void onPluginStartup() { public void onPluginStartup() {
getLogger().info("Loading configuration...");
saveDefaultConfig();
config = new NickoConfiguration(this);
dataStore = new PlayerDataStore(this);
getLogger().info("Loading internals..."); getLogger().info("Loading internals...");
if (getInternals() == null) { if (getInternals() == null) {
getLogger().log(Level.SEVERE, "Nicko could not find a valid implementation for this server version. Is your server supported?"); getLogger().log(Level.SEVERE, "Nicko could not find a valid implementation for this server version. Is your server supported?");
@ -97,12 +102,14 @@ public class NickoBukkit extends JavaPlugin {
getServer().getPluginManager().disablePlugin(this); getServer().getPluginManager().disablePlugin(this);
} }
if (getServer().getPluginManager().isPluginEnabled(this)) { if (getServer().getPluginManager().isPluginEnabled(this) && !dataStore.getStorage().isError()) {
mojangAPI = new MojangAPI(this); getLogger().info("Loading persistence...");
if (!dataStore.getStorage().getProvider().init()) {
dataStore.getStorage().setError(true);
getLogger().warning("Failed to open persistence, data will NOT be saved!");
}
getLogger().info("Loading configuration..."); mojangAPI = new MojangAPI(this);
saveDefaultConfig();
config = new NickoConfiguration(this);
localeFileManager = new LocaleFileManager(); localeFileManager = new LocaleFileManager();
if (config.isCustomLocale()) { if (config.isCustomLocale()) {
@ -122,14 +129,6 @@ public class NickoBukkit extends JavaPlugin {
Structure.addGlobalIngredient('%', new SimpleItem(new ItemBuilder(Material.ORANGE_STAINED_GLASS_PANE).setDisplayName(" "))); Structure.addGlobalIngredient('%', new SimpleItem(new ItemBuilder(Material.ORANGE_STAINED_GLASS_PANE).setDisplayName(" ")));
Structure.addGlobalIngredient('E', new ExitGUI()); Structure.addGlobalIngredient('E', new ExitGUI());
getLogger().info("Loading persistence...");
dataStore = new PlayerDataStore(this);
if (!dataStore.getStorage().getProvider().init()) {
dataStore.getStorage().setError(true);
getLogger().warning("Failed to open persistence, data will NOT be saved!");
}
new PlaceHolderHook(this).hook(); new PlaceHolderHook(this).hook();
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this); getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);