From 5082a4c1bc6757fcd52904c614582fdc2a67513b Mon Sep 17 00:00:00 2001 From: Draycia Date: Tue, 25 Aug 2020 23:27:59 -0700 Subject: [PATCH] Add ignore checks manually --- .../net/draycia/carbon/commands/AliasedChannelCommand.java | 4 ++++ .../java/net/draycia/carbon/commands/ChannelCommand.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java b/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java index 2fe6bb56..7ed6397e 100644 --- a/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java +++ b/src/main/java/net/draycia/carbon/commands/AliasedChannelCommand.java @@ -32,6 +32,10 @@ public class AliasedChannelCommand extends BaseCommand { throw new ConditionFailedException(chatChannel.getCannotUseMessage()); } + if (user.getChannelSettings(chatChannel).isIgnored()) { + throw new ConditionFailedException(chatChannel.getCannotUseMessage()); + } + if (args == null || args.length == 0) { user.setSelectedChannel(getChatChannel()); diff --git a/src/main/java/net/draycia/carbon/commands/ChannelCommand.java b/src/main/java/net/draycia/carbon/commands/ChannelCommand.java index 939a5381..922c99e4 100644 --- a/src/main/java/net/draycia/carbon/commands/ChannelCommand.java +++ b/src/main/java/net/draycia/carbon/commands/ChannelCommand.java @@ -1,6 +1,7 @@ package net.draycia.carbon.commands; import co.aikar.commands.BaseCommand; +import co.aikar.commands.ConditionFailedException; import co.aikar.commands.annotation.*; import net.draycia.carbon.CarbonChat; 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) { ChatUser user = carbonChat.getUserService().wrap(player); + if (user.getChannelSettings(channel).isIgnored()) { + throw new ConditionFailedException(channel.getCannotUseMessage()); + } + if (args == null || args.length == 0) { user.setSelectedChannel(channel);