Search in sources :

Example 1 with InternalNucleusHelpOpEvent

use of io.github.nucleuspowered.nucleus.modules.message.events.InternalNucleusHelpOpEvent in project Nucleus by NucleusPowered.

the class HelpOpCommand method executeCommand.

@Override
public CommandResult executeCommand(Player src, CommandContext args) throws Exception {
    String message = args.<String>getOne(messageKey).get();
    // that's that.
    if (Sponge.getEventManager().post(new InternalNucleusHelpOpEvent(src, message))) {
        src.sendMessage(plugin.getMessageProvider().getTextMessageWithFormat("message.cancel"));
        return CommandResult.empty();
    }
    Text prefix = messageConfig.getHelpOpPrefix().getForCommandSource(src);
    new PermissionMessageChannel(permissions.getPermissionWithSuffix("receive")).send(src, TextParsingUtils.joinTextsWithColoursFlowing(prefix, Text.of(message)));
    src.sendMessage(plugin.getMessageProvider().getTextMessageWithFormat("command.helpop.success"));
    return CommandResult.success();
}
Also used : PermissionMessageChannel(io.github.nucleuspowered.nucleus.util.PermissionMessageChannel) InternalNucleusHelpOpEvent(io.github.nucleuspowered.nucleus.modules.message.events.InternalNucleusHelpOpEvent) Text(org.spongepowered.api.text.Text)

Aggregations

InternalNucleusHelpOpEvent (io.github.nucleuspowered.nucleus.modules.message.events.InternalNucleusHelpOpEvent)1 PermissionMessageChannel (io.github.nucleuspowered.nucleus.util.PermissionMessageChannel)1 Text (org.spongepowered.api.text.Text)1