* {@inheritDoc}
*/
@Override
public void onEnable() {
FileConfiguration configuration = getConfig();
BukkitScheduler scheduler = getServer().getScheduler();
// Copy the default configuration if it hasn't been copied already
saveDefaultConfig();
// Update old configurations with new key-value pairs
configuration.options().copyDefaults(true);
// Get configuration.
configurationHandler = new Configuration(configuration);
int entityUpdatePeriod = configurationHandler.getEntityUpdatePeriod();
int listUpdatePeriod = configurationHandler.getListUpdatePeriod();
// Get worker information from disk.
getWorkerInfoFromDisk();
// Update the worker information with configuration.
for (WorkerInfo i : workerStack.values()) {
i.setConfiguration(configurationHandler);
}
// Launch the BEAST !
getServer().getPluginManager().registerEvents(this, this);
// List updater.
scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
checkEntities();
}
}, 10, listUpdatePeriod);
// Entity updater.
scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
updateEntities();
}
}, 15, entityUpdatePeriod);