diff --git a/common/src/main/java/net/draycia/carbon/common/command/commands/JoinCommand.java b/common/src/main/java/net/draycia/carbon/common/command/commands/JoinCommand.java index 7d0edf49f..c335f7ddd 100644 --- a/common/src/main/java/net/draycia/carbon/common/command/commands/JoinCommand.java +++ b/common/src/main/java/net/draycia/carbon/common/command/commands/JoinCommand.java @@ -77,9 +77,7 @@ public void init() { return sender.leftChannels().stream() .map(this.channelRegistry::channel) .filter(Objects::nonNull) - .filter(channel -> channel.permissions().joinPermitted(sender).permitted() - || channel.permissions().hearingPermitted(sender).permitted() - || channel.permissions().speechPermitted(sender).permitted()) + .filter(channel -> channel.permissions().joinPermitted(sender).permitted()) .map(channel -> channel.key().value()) .map(Suggestion::suggestion) .toList(); diff --git a/common/src/main/java/net/draycia/carbon/common/command/commands/LeaveCommand.java b/common/src/main/java/net/draycia/carbon/common/command/commands/LeaveCommand.java index a24d74c25..b6a8f5265 100644 --- a/common/src/main/java/net/draycia/carbon/common/command/commands/LeaveCommand.java +++ b/common/src/main/java/net/draycia/carbon/common/command/commands/LeaveCommand.java @@ -21,6 +21,7 @@ import com.google.inject.Inject; import java.util.Objects; +import net.draycia.carbon.api.channels.ChannelPermissionResult; import net.draycia.carbon.api.channels.ChatChannel; import net.draycia.carbon.api.users.CarbonPlayer; import net.draycia.carbon.common.channels.CarbonChannelRegistry; @@ -77,7 +78,7 @@ public void init() { .map(this.channelRegistry::channel) .filter(Objects::nonNull) .filter(x -> !sender.leftChannels().contains(x.key()) - && (x.permissions().joinPermitted(sender).permitted() || x.permissions().hearingPermitted(sender).permitted() || x.permissions().speechPermitted(sender).permitted())) + && (x.permissions().joinPermitted(sender).permitted())) .map(x -> x.key().value()) .map(Suggestion::suggestion) .toList(); @@ -96,6 +97,11 @@ public void init() { this.carbonMessages.channelAlreadyLeft(sender); return; } + final ChannelPermissionResult permitted = channel.permissions().joinPermitted(sender); + if (!permitted.permitted()) { + sender.sendMessage(permitted.reason()); + return; + } sender.leaveChannel(channel); this.carbonMessages.channelLeft(sender); })