Add .see permission, notify LP of channel perms

This commit is contained in:
Draycia committed 2021-12-17 22:39:39 -08:00
1 parent c5c8edf403
commit ae60bf39ba
2 files changed
+9 -1

No files matched your search

@@ -56,6 +56,7 @@ import net.draycia.carbon.common.messages.CarbonMessageService;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.permission.PermissionChecker;
import net.kyori.adventure.text.Component;
import net.kyori.registry.DefaultedRegistry;
import org.apache.logging.log4j.Logger;
@@ -281,6 +282,13 @@ public class CarbonChannelRegistry implements ChannelRegistry, DefaultedRegistry
if (channel instanceof ConfigChatChannel chatChannel) {
builder = builder.permission(chatChannel.permission());
// Add to LuckPerms permission suggestions... lol
this.carbonChat.server().console().get(PermissionChecker.POINTER).ifPresent(checker -> {
checker.test(chatChannel.permission());
checker.test(chatChannel.permission() + ".see");
checker.test(chatChannel.permission() + ".speak");
});
}
final var command = builder.senderType(PlayerCommander.class)
@@ -147,7 +147,7 @@ public final class ConfigChatChannel implements ChatChannel {
return ChannelPermissionResult.allowed();
}
if (permission.get().test(this.permission())) {
if (permission.get().test(this.permission() + ".see")) {
return ChannelPermissionResult.allowed();
}