brigadier

package module
v0.0.0-...-2461996 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 3 Imported by: 0

README

Brigadier

Go Reference

An implementation of the Notchian brigadier datatypes, written in Go

A reference to how these types are structured can be found here

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Flags           int8          // Flags for the node, contains type, and other configuration
	Children        []int32       // Other command nodes that make up the rest of the commmand
	RedirectNode    int32         // Optional, only if 0x08 of flags is set
	Name            string        // Optional, only for ARGUMENT and LITERAL nodes
	Parser          string        // Optional, only for ARGUMENT nodes
	Properties      []interface{} // Currently unimplemented, only for ARGUMENT nodes
	SuggestionsType string        // Optional, only if 0x10 of flags is set
}

Node is a brigadier structure that defines a notchian command and how it connects to other commands. A node can be one of three types, ROOT, LITERAL, or ARGUMENT, and can be serialized as a go-mc packet. A Node's zero value is a ROOT node, with no options set. A reference for a node's structure can be found here: https://wiki.vg/Command_Data

func NewNode

func NewNode(nodeType NodeType, isExecutable, hasRedirect, hasSuggestions bool) Node

NewNode creates a new brigadier node with the specified options set

func (*Node) ReadFrom

func (n *Node) ReadFrom(r io.Reader) (int64, error)

ReadFrom defines how a node will be decoded from a packet

func (Node) String

func (n Node) String() string

func (Node) WriteTo

func (n Node) WriteTo(w io.Writer) (int64, error)

WriteTo defines how a node will be encoded as a packet

type NodeType

type NodeType byte

NodeType is the type of command node that a node is

const (
	ROOT NodeType = iota
	LITERAL
	ARGUMENT
	UNUSED
)

func (NodeType) String

func (nt NodeType) String() string

Jump to

Keyboard shortcuts

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