Search in sources :

Example 1 with SettingsReloadEvent

use of pl.themolka.arcade.settings.SettingsReloadEvent in project Arcade2 by ShootGame.

the class ArcadeCommands method reload.

// 
// '/arcade reload' command
// 
private void reload(Sender sender) {
    if (!sender.hasPermission("arcade.command.reload")) {
        throw new CommandPermissionException("arcade.command.reload");
    }
    Settings settings = this.plugin.getSettings();
    sender.sendInfo("Reloading settings file...");
    try {
        settings.setDocument(settings.readSettingsFile());
        this.plugin.getEventBus().publish(new SettingsReloadEvent(this.plugin, settings));
        sender.sendSuccess("Successfully reloaded settings file. Well done!");
    } catch (DOMException | IOException | ParserNotSupportedException ex) {
        ex.printStackTrace();
        throw new CommandException("Could not reload settings file: " + ex.getMessage());
    }
}
Also used : DOMException(pl.themolka.arcade.dom.DOMException) SettingsReloadEvent(pl.themolka.arcade.settings.SettingsReloadEvent) IOException(java.io.IOException) Settings(pl.themolka.arcade.settings.Settings) ParserNotSupportedException(pl.themolka.arcade.parser.ParserNotSupportedException)

Example 2 with SettingsReloadEvent

use of pl.themolka.arcade.settings.SettingsReloadEvent in project Arcade2 by ShootGame.

the class ArcadePlugin method reloadConfig.

@Override
public void reloadConfig() {
    try {
        this.settings.setDocument(this.settings.readSettingsFile());
        this.getEventBus().publish(new SettingsReloadEvent(this, this.settings));
    } catch (DOMException | IOException | ParserNotSupportedException ex) {
        throw new RuntimeException(ex);
    }
}
Also used : DOMException(pl.themolka.arcade.dom.DOMException) SettingsReloadEvent(pl.themolka.arcade.settings.SettingsReloadEvent) IOException(java.io.IOException) ParserNotSupportedException(pl.themolka.arcade.parser.ParserNotSupportedException)

Aggregations

IOException (java.io.IOException)2 DOMException (pl.themolka.arcade.dom.DOMException)2 ParserNotSupportedException (pl.themolka.arcade.parser.ParserNotSupportedException)2 SettingsReloadEvent (pl.themolka.arcade.settings.SettingsReloadEvent)2 Settings (pl.themolka.arcade.settings.Settings)1