public interface ChannelRegistrar
ChannelBinding
s to and from
PlayerConnection
s and the server.Modifier and Type | Method and Description |
---|---|
ChannelBinding.IndexedMessageChannel |
createChannel(Object plugin,
String channel)
Creates a new channel binding for the given channel name.
|
ChannelBinding.RawDataChannel |
createRawChannel(Object plugin,
String channel)
Creates a new raw channel binding.
|
Optional<ChannelBinding> |
getChannel(String channel)
Gets a channel binding if a channel registered by that name exists.
|
default ChannelBinding.IndexedMessageChannel |
getOrCreate(Object plugin,
String channel)
Gets or creates a
ChannelBinding.IndexedMessageChannel by the
given name. |
default ChannelBinding.RawDataChannel |
getOrCreateRaw(Object plugin,
String channel)
Gets or creates a
ChannelBinding.RawDataChannel by the given
name. |
Set<String> |
getRegisteredChannels(Platform.Type side)
Gets the set of registered channels.
|
boolean |
isChannelAvailable(String channelName)
Returns whether the given channel name is available for creating with
createChannel(java.lang.Object, java.lang.String) . |
void |
unbindChannel(ChannelBinding channel)
Remove the channel binding from this registrar, freeing up the channel
name.
|
ChannelBinding.IndexedMessageChannel createChannel(Object plugin, String channel) throws ChannelRegistrationException
plugin
- The plugin registering the channelchannel
- The channel to registerChannelBinding
instance bound to the channel nameChannelRegistrationException
- The channel name is too longChannelRegistrationException
- The channel name is reservedChannelBinding.RawDataChannel createRawChannel(Object plugin, String channel) throws ChannelRegistrationException
ChannelBuf
objects.plugin
- The plugin registering the channelchannel
- The channel to registerChannelBinding
instance bound to the channel nameChannelRegistrationException
- The channel name is too longChannelRegistrationException
- The channel name is reservedcreateChannel(java.lang.Object, java.lang.String)
Optional<ChannelBinding> getChannel(String channel)
channel
- The name of the channeldefault ChannelBinding.IndexedMessageChannel getOrCreate(Object plugin, String channel) throws ChannelRegistrationException
ChannelBinding.IndexedMessageChannel
by the
given name. If the channel exists and is a indexed message channel, then
it is returned. If the channel is not an indexed message channel, then
IllegalStateException
is thrown. Otherwise, a new channel is
created.plugin
- The plugin to register the channel if it doesn't existchannel
- The channel nameIllegalStateException
- if the existing channel is not an
IndexedMessageChannelChannelRegistrationException
- for same reasons as
createChannel(java.lang.Object, java.lang.String)
.default ChannelBinding.RawDataChannel getOrCreateRaw(Object plugin, String channel) throws ChannelRegistrationException
ChannelBinding.RawDataChannel
by the given
name. If the channel exists and is a raw data channel, then it is
returned. If the channel is not a raw data channel, then
IllegalStateException
is thrown. Otherwise, a new channel is
created.plugin
- The plugin to register the channel if it doesn't existchannel
- The channel nameIllegalStateException
- if the existing channel is not an
RawDataChannelChannelRegistrationException
- for same reasons as
createRawChannel(java.lang.Object, java.lang.String)
.void unbindChannel(ChannelBinding channel)
IllegalStateException
.channel
- The channel to unbindSet<String> getRegisteredChannels(Platform.Type side)
side
- The side to get the registered channels fromboolean isChannelAvailable(String channelName)
createChannel(java.lang.Object, java.lang.String)
.channelName
- The channel name to test