Search in sources :

Example 1 with MuteHandler

use of io.github.nucleuspowered.nucleus.modules.mute.handler.MuteHandler in project Nucleus by NucleusPowered.

the class MuteModule method performEnableTasks.

@Override
public void performEnableTasks() {
    createSeenModule(CheckMuteCommand.class, (c, u) -> {
        // If we have a ban service, then check for a ban.
        MuteHandler jh = plugin.getInternalServiceManager().getServiceUnchecked(MuteHandler.class);
        if (jh.isMuted(u)) {
            MuteData jd = jh.getPlayerMuteData(u).get();
            // Lightweight checkban.
            Text.Builder m;
            if (jd.getRemainingTime().isPresent()) {
                m = plugin.getMessageProvider().getTextMessageWithFormat("seen.ismuted.temp", Util.getTimeToNow(jd.getEndTimestamp().get())).toBuilder();
            } else {
                m = plugin.getMessageProvider().getTextMessageWithFormat("seen.ismuted.perm").toBuilder();
            }
            return Lists.newArrayList(m.onClick(TextActions.runCommand("/checkmute " + u.getName())).onHover(TextActions.showText(plugin.getMessageProvider().getTextMessageWithFormat("standard.clicktoseemore"))).build(), plugin.getMessageProvider().getTextMessageWithFormat("standard.reason", jd.getReason()));
        }
        return Lists.newArrayList(plugin.getMessageProvider().getTextMessageWithFormat("seen.notmuted"));
    });
}
Also used : MuteHandler(io.github.nucleuspowered.nucleus.modules.mute.handler.MuteHandler) MuteData(io.github.nucleuspowered.nucleus.modules.mute.data.MuteData) Text(org.spongepowered.api.text.Text)

Aggregations

MuteData (io.github.nucleuspowered.nucleus.modules.mute.data.MuteData)1 MuteHandler (io.github.nucleuspowered.nucleus.modules.mute.handler.MuteHandler)1 Text (org.spongepowered.api.text.Text)1