mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Deny chatting if the required permission is not given (#470)
* Deny chatting if the required permission is not given * Add missing import --------- Co-authored-by: Josua Parks <[email protected]>
This commit is contained in:
1 parent
a816dcd738
commit
74418adfd0
1 file changed
+7
@@ -22,6 +22,7 @@ package net.draycia.carbon.common.listeners;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.draycia.carbon.api.channels.ChannelPermissionResult;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.event.CarbonEventHandler;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
@@ -69,6 +70,12 @@ public abstract class ChatListenerInternal {
|
||||
}
|
||||
|
||||
protected @Nullable CarbonChatEventImpl prepareAndEmitChatEvent(final CarbonPlayer sender, final String messageContent, final @Nullable SignedMessage signedMessage, final ChatChannel channel) {
|
||||
final ChannelPermissionResult permitted = channel.speechPermitted(sender);
|
||||
if (!permitted.permitted()) {
|
||||
sender.sendMessage(permitted.reason());
|
||||
return null;
|
||||
}
|
||||
|
||||
String content = this.configManager.primaryConfig().applyChatPlaceholders(messageContent);
|
||||
content = this.configManager.primaryConfig().applyChatFilters(content);
|
||||
|
||||
|
||||
Reference in new issue
Block a user