Search in sources :

Example 1 with WarnHandler

use of io.github.nucleuspowered.nucleus.modules.warn.handlers.WarnHandler in project Nucleus by NucleusPowered.

the class WarnModule method performEnableTasks.

@Override
public void performEnableTasks() {
    // Take base permission from /checkwarnings.
    createSeenModule(CheckWarningsCommand.class, (c, u) -> {
        WarnHandler jh = plugin.getInternalServiceManager().getServiceUnchecked(WarnHandler.class);
        int active = jh.getWarningsInternal(u, true, false).size();
        int expired = jh.getWarningsInternal(u, false, true).size();
        Text r = plugin.getMessageProvider().getTextMessageWithFormat("seen.warnings", String.valueOf(active), String.valueOf(expired));
        if (active > 0) {
            return Lists.newArrayList(r.toBuilder().onClick(TextActions.runCommand("/checkwarnings " + u.getName())).onHover(TextActions.showText(plugin.getMessageProvider().getTextMessageWithFormat("standard.clicktoseemore"))).build());
        }
        return Lists.newArrayList(r);
    });
}
Also used : Text(org.spongepowered.api.text.Text) WarnHandler(io.github.nucleuspowered.nucleus.modules.warn.handlers.WarnHandler)

Aggregations

WarnHandler (io.github.nucleuspowered.nucleus.modules.warn.handlers.WarnHandler)1 Text (org.spongepowered.api.text.Text)1