Added the required ability to load data separately.

This commit is contained in:
Brianna 2020-08-22 16:07:37 -05:00
parent 17034afb94
commit 28b2d99b04

View File

@ -21,6 +21,7 @@ public abstract class SongodaPlugin extends JavaPlugin {
protected Locale locale; protected Locale locale;
protected Config config = new Config(this); protected Config config = new Config(this);
protected long dataLoadDelay = 20L;
protected ConsoleCommandSender console = Bukkit.getConsoleSender(); protected ConsoleCommandSender console = Bukkit.getConsoleSender();
private boolean emergencyStop = false; private boolean emergencyStop = false;
@ -31,6 +32,8 @@ public abstract class SongodaPlugin extends JavaPlugin {
public abstract void onPluginDisable(); public abstract void onPluginDisable();
public abstract void onDataLoad();
/** /**
* Called after reloadConfig() is called * Called after reloadConfig() is called
*/ */
@ -95,6 +98,8 @@ public abstract class SongodaPlugin extends JavaPlugin {
locale = Locale.loadDefaultLocale(this, "en_US"); locale = Locale.loadDefaultLocale(this, "en_US");
// plugin setup // plugin setup
onPluginEnable(); onPluginEnable();
// Load Data.
Bukkit.getScheduler().runTaskLater(this, this::onDataLoad, dataLoadDelay);
if(emergencyStop) { if(emergencyStop) {
console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
console.sendMessage(" "); console.sendMessage(" ");