Documentation ¶
Index ¶
- Constants
- Variables
- type ChannelIdentifier
- type ChannelMessageSink
- type ChannelMessageSource
- type ChannelRegistrar
- func (r *ChannelRegistrar) ChannelsForProtocol(protocol proto.Protocol) sets.String
- func (r *ChannelRegistrar) FromID(channel string) (ChannelIdentifier, bool)
- func (r *ChannelRegistrar) LegacyChannelIDs() sets.String
- func (r *ChannelRegistrar) ModernChannelIDs() sets.String
- func (r *ChannelRegistrar) Register(ids ...ChannelIdentifier)
- func (r *ChannelRegistrar) Unregister(ids ...ChannelIdentifier)
- type LegacyChannelIdentifier
- type MinecraftChannelIdentifier
Constants ¶
const DefaultNamespace = "minecraft"
Variables ¶
var ValidIdentifierRegex = regexp.MustCompile(`[a-z0-9\\-_]*`)
Functions ¶
This section is empty.
Types ¶
type ChannelIdentifier ¶
type ChannelIdentifier interface { // ID returns the channel identifier. ID() string }
ChannelIdentifier is a channel identifier for use with plugin messaging.
func ChannelIdentifierFrom ¶ added in v0.19.0
func ChannelIdentifierFrom(identifier string) (ChannelIdentifier, error)
ChannelIdentifierFrom creates a channel identifier from the specified Minecraft identifier string.
func NewChannelIdentifier ¶
func NewChannelIdentifier(namespace, name string) (ChannelIdentifier, error)
NewChannelIdentifier returns a new validated channel identifier.
func NewDefaultNamespace ¶
func NewDefaultNamespace(name string) (ChannelIdentifier, error)
func NewLegacyChannelIdentifier ¶
func NewLegacyChannelIdentifier(name string) ChannelIdentifier
type ChannelMessageSink ¶
type ChannelMessageSink interface { // SendPluginMessage sends a plugin message to the channel with id. SendPluginMessage(id ChannelIdentifier, data []byte) error }
ChannelMessageSink can receive plugin messages.
type ChannelMessageSource ¶
type ChannelMessageSource any
ChannelMessageSource is a source of plugin messages.
type ChannelRegistrar ¶
type ChannelRegistrar struct {
// contains filtered or unexported fields
}
ChannelRegistrar is a plugin message channel registrar.
func NewChannelRegistrar ¶ added in v0.20.0
func NewChannelRegistrar() *ChannelRegistrar
NewChannelRegistrar returns a new ChannelRegistrar.
func (*ChannelRegistrar) ChannelsForProtocol ¶ added in v0.20.0
func (r *ChannelRegistrar) ChannelsForProtocol(protocol proto.Protocol) sets.String
ChannelsForProtocol returns all the channel names to register depending on the Minecraft protocol version.
func (*ChannelRegistrar) FromID ¶ added in v0.20.0
func (r *ChannelRegistrar) FromID(channel string) (ChannelIdentifier, bool)
FromID returns the registered channel identifier for the specified ID.
func (*ChannelRegistrar) LegacyChannelIDs ¶ added in v0.20.0
func (r *ChannelRegistrar) LegacyChannelIDs() sets.String
LegacyChannelIDs returns all legacy channel IDs.
func (*ChannelRegistrar) ModernChannelIDs ¶ added in v0.20.0
func (r *ChannelRegistrar) ModernChannelIDs() sets.String
ModernChannelIDs returns all channel IDs (as strings) for use with Minecraft 1.13 and above.
func (*ChannelRegistrar) Register ¶
func (r *ChannelRegistrar) Register(ids ...ChannelIdentifier)
Register registers the specified message identifiers to listen on so you can intercept plugin messages on the channel using the PluginMessageEvent.
func (*ChannelRegistrar) Unregister ¶
func (r *ChannelRegistrar) Unregister(ids ...ChannelIdentifier)
Unregister removes the intent to listen for the specified channels.
type LegacyChannelIdentifier ¶
type LegacyChannelIdentifier string // Has just a name field, no namespace and value.
LegacyChannelIdentifier is a legacy channel identifier (for Minecraft 1.12 and below). For modern 1.13 plugin messages, please see MinecraftChannelIdentifier.
func (LegacyChannelIdentifier) ID ¶
func (l LegacyChannelIdentifier) ID() string
type MinecraftChannelIdentifier ¶
MinecraftChannelIdentifier is a Minecraft 1.13+ channel identifier.
func (*MinecraftChannelIdentifier) ID ¶
func (m *MinecraftChannelIdentifier) ID() string