Added reloading.

This commit is contained in:
tastybento 2019-01-02 15:41:13 -08:00
parent 2b3ee0997f
commit a744ad8675
2 changed files with 22 additions and 2 deletions

View File

@ -32,11 +32,21 @@ public class AcidIsland extends GameModeAddon {
public void onLoad() {
saveDefaultConfig();
// Load settings
loadSettings();
}
private boolean loadSettings() {
settings = new Config<>(this, AISettings.class).loadConfigObject();
if (settings == null) {
// Woops
this.logError("Settings could not load! Addon disabled.");
this.logError("AcidIsland settings could not load! Addon disabled.");
this.setState(State.DISABLED);
if (acidTask != null) {
acidTask.cancelTasks();
}
return false;
}
return true;
}
@Override
@ -118,4 +128,11 @@ public class AcidIsland extends GameModeAddon {
return settings;
}
@Override
public void onReload() {
if (loadSettings()) {
log("Reloaded AcidIsland settings");
}
}
}

View File

@ -10,6 +10,7 @@ import world.bentobox.bentobox.api.commands.admin.AdminDeleteCommand;
import world.bentobox.bentobox.api.commands.admin.AdminGetrankCommand;
import world.bentobox.bentobox.api.commands.admin.AdminInfoCommand;
import world.bentobox.bentobox.api.commands.admin.AdminRegisterCommand;
import world.bentobox.bentobox.api.commands.admin.AdminReloadCommand;
import world.bentobox.bentobox.api.commands.admin.AdminSetrankCommand;
import world.bentobox.bentobox.api.commands.admin.AdminTeleportCommand;
import world.bentobox.bentobox.api.commands.admin.AdminUnregisterCommand;
@ -62,8 +63,10 @@ public class AcidCommand extends CompositeCommand {
new AdminDeleteCommand(this);
// Why
new AdminWhyCommand(this);
// Deaths
new AdminDeathsCommand(this);
// Reload
new AdminReloadCommand(this);
}
@Override