Add ignore checks manually

This commit is contained in:
Draycia committed 2020-08-25 23:27:59 -07:00
1 parent ad857e326a
commit 5082a4c1bc
2 files changed
+9

No files matched your search

@@ -32,6 +32,10 @@ public class AliasedChannelCommand extends BaseCommand {
throw new ConditionFailedException(chatChannel.getCannotUseMessage()); throw new ConditionFailedException(chatChannel.getCannotUseMessage());
} }
if (user.getChannelSettings(chatChannel).isIgnored()) {
throw new ConditionFailedException(chatChannel.getCannotUseMessage());
}
if (args == null || args.length == 0) { if (args == null || args.length == 0) {
user.setSelectedChannel(getChatChannel()); user.setSelectedChannel(getChatChannel());
@@ -1,6 +1,7 @@
package net.draycia.carbon.commands; package net.draycia.carbon.commands;
import co.aikar.commands.BaseCommand; import co.aikar.commands.BaseCommand;
import co.aikar.commands.ConditionFailedException;
import co.aikar.commands.annotation.*; import co.aikar.commands.annotation.*;
import net.draycia.carbon.CarbonChat; import net.draycia.carbon.CarbonChat;
import net.draycia.carbon.channels.ChatChannel; import net.draycia.carbon.channels.ChatChannel;
@@ -23,6 +24,10 @@ public class ChannelCommand extends BaseCommand {
public void baseCommand(Player player, @Conditions("canuse:true") ChatChannel channel, @Optional String[] args) { public void baseCommand(Player player, @Conditions("canuse:true") ChatChannel channel, @Optional String[] args) {
ChatUser user = carbonChat.getUserService().wrap(player); ChatUser user = carbonChat.getUserService().wrap(player);
if (user.getChannelSettings(channel).isIgnored()) {
throw new ConditionFailedException(channel.getCannotUseMessage());
}
if (args == null || args.length == 0) { if (args == null || args.length == 0) {
user.setSelectedChannel(channel); user.setSelectedChannel(channel);