Search in sources :

Example 11 with MutableMessageChannel

use of org.spongepowered.api.text.channel.MutableMessageChannel in project Nucleus by NucleusPowered.

the class IgnoreListener method onChat.

private void onChat(MessageChannelEvent.Chat event, Player player) {
    // Reset the channel - but only if we have to.
    checkCancels(event.getChannel().orElseGet(event::getOriginalChannel).getMembers(), player).ifPresent(x -> {
        MutableMessageChannel mmc = event.getChannel().orElseGet(event::getOriginalChannel).asMutable();
        x.forEach(mmc::removeMember);
        event.setChannel(mmc);
    });
}
Also used : MutableMessageChannel(org.spongepowered.api.text.channel.MutableMessageChannel)

Aggregations

MutableMessageChannel (org.spongepowered.api.text.channel.MutableMessageChannel)11 PermissionMessageChannel (io.github.nucleuspowered.nucleus.util.PermissionMessageChannel)8 User (org.spongepowered.api.entity.living.player.User)5 UUID (java.util.UUID)4 Player (org.spongepowered.api.entity.living.player.Player)3 Text (org.spongepowered.api.text.Text)3 ReturnMessageException (io.github.nucleuspowered.nucleus.internal.command.ReturnMessageException)2 Instant (java.time.Instant)2 Sponge (org.spongepowered.api.Sponge)2 CommandSource (org.spongepowered.api.command.CommandSource)2 ItemStack (org.spongepowered.api.item.inventory.ItemStack)2 BanService (org.spongepowered.api.service.ban.BanService)2 PostFormatChatMessageEvent (br.net.fabiozumbi12.UltimateChat.Sponge.API.PostFormatChatMessageEvent)1 SendChannelMessageEvent (br.net.fabiozumbi12.UltimateChat.Sponge.API.SendChannelMessageEvent)1 UCLogger.timingType (br.net.fabiozumbi12.UltimateChat.Sponge.UCLogger.timingType)1 ItemStackFactory.newItemStack (com.skelril.nitro.item.ItemStackFactory.newItemStack)1 Util (io.github.nucleuspowered.nucleus.Util)1 NucleusAPI (io.github.nucleuspowered.nucleus.api.NucleusAPI)1 TimespanArgument (io.github.nucleuspowered.nucleus.argumentparsers.TimespanArgument)1 LocationData (io.github.nucleuspowered.nucleus.internal.LocationData)1