Package net.draycia.carbon.api.channels
Interface ChannelRegistry
public interface ChannelRegistry
Registry for
chat channels.- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidThe provided action will be executed immediately for all currently registered channels.Retrieve a channel by its key.channelOrDefault(Key key) Retrieve a channel by its key.channelOrThrow(Key key) Retrieve a channel by its key.Gets the default channel.Gets the key for the default channel.keys()Gets the list of registered channel keys.permission(String permission) Create achannel permissions handlerfor the provided base permission string.voidregister(ChatChannel channel) Registers the chat channel with its key.
-
Method Details
-
register
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
Retrieve a channel by its key. If there is no matching channel, returnsnull.- Parameters:
key- the channel's key- Returns:
- the channel
- Since:
- 3.0.0
-
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
Gets the list of registered channel keys.- Returns:
- the registered channel keys
- Since:
- 3.0.0
-
channelOrDefault
Retrieve a channel by its key. If there is no matching channel, returnsthe default channel.- Parameters:
key- the channel key- Returns:
- the channel, or the default one
- Since:
- 3.0.0
-
channelOrThrow
Retrieve a channel by its key. If there is no matching channel, throwsNoSuchElementException.- Parameters:
key- channel key- Returns:
- channel
- Throws:
NoSuchElementException- when no matching channel is found- Since:
- 3.0.0
-
allKeys
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
Create achannel permissions handlerfor 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
-