Reloading
DzusillCore supports hot-reload of all configurations and messages without restarting the server.
How reload works
Section titled βHow reload worksβAny service that implements the Reloadable interface can be reloaded:
public interface Reloadable { void reload() throws Exception;}Both ConfigManager and MessageService implement Reloadable.
Triggering a reload from a command
Section titled βTriggering a reload from a commandβThe built-in ReloadSubCommand (part of CoreAdminCommand) does this:
@Overridepublic void run(CommandContext context, Arguments args) { try { configs.reload(); // reloads every registered Config and AbstractConfig messages.reload(); // reloads messages.yml context.reply(Messages.RELOAD_SUCCESS); } catch (Exception ex) { context.reply(Messages.RELOAD_FAILED); }}In-game: /core reload (requires core.reload permission).
Reloading your own config
Section titled βReloading your own configβRegister any typed config with ConfigManager so it is reloaded automatically:
ConfigManager configs = service(ConfigManager.class);configs.register(new MyCustomConfig(plugin));Or implement Reloadable in your own service and call reload() manually from the command.
What is NOT reloaded
Section titled βWhat is NOT reloadedβ- Commands: registered at startup via
CommandRegistryand persist for the pluginβs lifetime. - Listeners: registered once in
ListenerRegistryand do not need reloading. - Database connections: the HikariCP pool is not restarted on reload. Credential changes require a plugin restart.
The reload permission
Section titled βThe reload permissionβDefined in plugin.yml:
permissions: core.reload: description: Allows reloading the plugin configuration default: op