Interface ChannelRegistry


public interface ChannelRegistry
Registry for chat channels.
Since:
2.0.0
  • Method Details

    • register

      void register(ChatChannel channel)
      Registers the chat channel with its key.

      Registrations will persist when reloading Carbon's configuration.

      Parameters:
      channel - the channel to register
      Since:
      3.0.0
    • channel

      @Nullable ChatChannel channel(Key key)
      Retrieve a channel by its key. If there is no matching channel, returns null.
      Parameters:
      key - the channel's key
      Returns:
      the channel
      Since:
      3.0.0
    • defaultKey

      @NonNull Key defaultKey()
      Gets the key for the default channel.
      Returns:
      the default key
      Since:
      3.0.0
    • defaultChannel

      @NonNull ChatChannel defaultChannel()
      Gets the default channel.
      Returns:
      the default value
      Since:
      3.0.0
    • keys

      @NonNull Set<Key> keys()
      Gets the list of registered channel keys.
      Returns:
      the registered channel keys
      Since:
      3.0.0
    • channelOrDefault

      ChatChannel channelOrDefault(Key key)
      Retrieve a channel by its key. If there is no matching channel, returns the default channel.
      Parameters:
      key - the channel key
      Returns:
      the channel, or the default one
      Since:
      3.0.0
    • channelOrThrow

      ChatChannel channelOrThrow(Key key)
      Retrieve a channel by its key. If there is no matching channel, throws NoSuchElementException.
      Parameters:
      key - channel key
      Returns:
      channel
      Throws:
      NoSuchElementException - when no matching channel is found
      Since:
      3.0.0
    • allKeys

      void allKeys(Consumer<Key> action)
      The provided action will be executed immediately for all currently registered channels.

      When new channels are registered, the action will be invoked again for each new channel.

      Parameters:
      action - action
      Since:
      3.0.0
    • permission

      ChannelPermissions permission(String permission)
      Create a channel permissions handler for the provided base permission string.

      The handler will check the base permission for joins, <base>.see for receiving/seeing messages, and <base>.speak for speaking/sending messages.

      The built-in deny messages are used, same as user-configured config channels.

      Parameters:
      permission - permission string
      Returns:
      permission handler
      Since:
      3.0.0