Adds addon reloading of settings.

This commit is contained in:
tastybento 2019-01-02 15:57:26 -08:00
parent bebe65479c
commit 8cb0eba57e
2 changed files with 19 additions and 1 deletions

View File

@ -29,7 +29,17 @@ public class BSkyBlock extends GameModeAddon {
// Save the default config from config.yml // Save the default config from config.yml
saveDefaultConfig(); saveDefaultConfig();
// Load settings from config.yml. This will check if there are any issues with it too. // Load settings from config.yml. This will check if there are any issues with it too.
loadSettings();
}
private void loadSettings() {
settings = new Config<>(this, Settings.class).loadConfigObject(); settings = new Config<>(this, Settings.class).loadConfigObject();
if (settings == null) {
// Disable
logError("BSkyBlock settings could not load! Addon disabled.");
setState(State.DISABLED);
}
} }
@Override @Override
@ -47,6 +57,11 @@ public class BSkyBlock extends GameModeAddon {
} }
} }
@Override
public void onReload() {
loadSettings();
}
/** /**
* @return the settings * @return the settings
*/ */

View File

@ -9,6 +9,7 @@ import world.bentobox.bentobox.api.commands.admin.AdminDeleteCommand;
import world.bentobox.bentobox.api.commands.admin.AdminGetrankCommand; import world.bentobox.bentobox.api.commands.admin.AdminGetrankCommand;
import world.bentobox.bentobox.api.commands.admin.AdminInfoCommand; import world.bentobox.bentobox.api.commands.admin.AdminInfoCommand;
import world.bentobox.bentobox.api.commands.admin.AdminRegisterCommand; 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.AdminSetrankCommand;
import world.bentobox.bentobox.api.commands.admin.AdminTeleportCommand; import world.bentobox.bentobox.api.commands.admin.AdminTeleportCommand;
import world.bentobox.bentobox.api.commands.admin.AdminUnregisterCommand; import world.bentobox.bentobox.api.commands.admin.AdminUnregisterCommand;
@ -63,8 +64,10 @@ public class AdminCommand extends CompositeCommand {
new AdminDeleteCommand(this); new AdminDeleteCommand(this);
// Why // Why
new AdminWhyCommand(this); new AdminWhyCommand(this);
// Deaths
new AdminDeathsCommand(this); new AdminDeathsCommand(this);
// Reload
new AdminReloadCommand(this);
} }
@Override @Override