plugin

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BrandChannelLegacy      string = "MC|Brand"
	BrandChannel            string = "minecraft:brand"
	RegisterChannelLegacy   string = "REGISTER"
	RegisterChannel         string = "minecraft:register"
	UnregisterChannelLegacy string = "UNREGISTER"
	UnregisterChannel       string = "minecraft:unregister"
)

Variables

View Source
var InvalidIdentifierRegex = regexp.MustCompile(`[^a-z0-9\\-_]*`)

Functions

func Channels

func Channels(p *Message) (channels []string)

Channels fetches all the channels in a register or unregister plugin message.

func LegacyRegister

func LegacyRegister(p *Message) bool

Determines whether or not this plugin message is a legacy (<1.13) registration plugin message.

func LegacyUnregister

func LegacyUnregister(p *Message) bool

Determines whether or not this plugin message is a legacy (<1.13) un-registration plugin message.

func McBrand

func McBrand(p *Message) bool

McBrand determines whether or not this is a brand plugin message. This is shown on the client.

func Register

func Register(p *Message) bool

Register determines whether or not this plugin message is being used to register plugin channels.

func TransformLegacyToModernChannel

func TransformLegacyToModernChannel(name string) string

TransformLegacyToModernChannel transforms a plugin message channel from a "legacy" (<1.13) form to a modern one.

func Unregister

func Unregister(p *Message) bool

Unregister determines whether or not this plugin message is being used to unregister plugin channels.

Types

type Message

type Message struct {
	Channel string
	Data    []byte

	// Not part of the packet!
	// This is to store the decoded packet bytes as is
	// to forward them without needing to encode the packet again.
	Retained []byte
}

Message is a Minecraft plugin message packet.

func ConstructChannelsPacket

func ConstructChannelsPacket(protocol proto.Protocol, channels ...string) *Message

Constructs a channel (un)register packet. channels must not be empty! Note that the Message's Retained field remains nil.

func RewriteMinecraftBrand

func RewriteMinecraftBrand(message *Message, protocol proto.Protocol) *Message

Rewrites the brand message to indicate the presence of the proxy.

func (*Message) Decode

func (p *Message) Decode(c *proto.PacketContext, r io.Reader) (err error)

func (*Message) Encode

func (p *Message) Encode(c *proto.PacketContext, wr io.Writer) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL