Search in sources :

Example 1 with AFKConfig

use of io.github.nucleuspowered.nucleus.modules.afk.config.AFKConfig in project Nucleus by NucleusPowered.

the class AFKCommandInterceptor method onReload.

@Override
public void onReload() throws Exception {
    AFKConfig config = Nucleus.getNucleus().getInternalServiceManager().getServiceUnchecked(AFKConfigAdapter.class).getNodeOrDefault();
    if (config.isAlertSenderOnAfk()) {
        NucleusTextTemplate textTemplate = config.getMessages().getOnCommand();
        if (textTemplate == null || textTemplate.isEmpty()) {
            // NPE has occurred here in the past due to an empty message.
            this.message = null;
        } else {
            this.message = textTemplate;
        }
        this.send = true;
    } else {
        this.message = null;
        this.send = false;
    }
}
Also used : AFKConfig(io.github.nucleuspowered.nucleus.modules.afk.config.AFKConfig) NucleusTextTemplate(io.github.nucleuspowered.nucleus.api.text.NucleusTextTemplate) AFKConfigAdapter(io.github.nucleuspowered.nucleus.modules.afk.config.AFKConfigAdapter)

Aggregations

NucleusTextTemplate (io.github.nucleuspowered.nucleus.api.text.NucleusTextTemplate)1 AFKConfig (io.github.nucleuspowered.nucleus.modules.afk.config.AFKConfig)1 AFKConfigAdapter (io.github.nucleuspowered.nucleus.modules.afk.config.AFKConfigAdapter)1