command

package
v0.0.0-...-ed75f63 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package command provides utilities for handling and registering commands

Index

Constants

View Source
const (
	Bool = iota
	Float
	Double
	Integer
	Long
	String

	Entity
	GameProfile
	BlockPos
	ColumnPos
	Vec3
	Vec2
	BlockState
	BlockPredicate
	ItemStack
	ItemPredicate
	Color
	Component
	Style
	Message
	NBT
	NBTTag
	NBTPath
	Objective
	ObjectiveCriteria
	Operation
	Particle
	Angle
	Rotation
	ScoreboardSlot
	ScoreHolder
	Swizzle
	Team
	ItemSlot
	ResourceLocation
	Function
	EntityAnchor
	IntRange
	FloatRange
	Dimension
	Gamemode
	Time
	ResourceOrTag
	ResourceOrTagKey
	Resource
	ResourceKey
	TemplateMirror
	TemplateRotation
	Heightmap
	UUID
)
View Source
const (
	StringSingleWord = iota
	StringQuotablePhrase
	StringGreedyPhrase
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments []string

func (Arguments) At

func (a Arguments) At(i int) string

func (Arguments) Fallback

func (a Arguments) Fallback(i int, fb string) string

type Caller

type Caller interface {
	SystemMessage(text.TextComponent) error
}

type Command

type Command struct {
	Node      Node
	Aliases   []string
	Namespace string

	Callback           func(CommandCallContext)
	SuggestionCallback func()
}

type CommandCallContext

type CommandCallContext struct {
	Command  Command
	Server   any
	Executor Caller

	Arguments Arguments
}

func (CommandCallContext) Reply

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(srv any, cmds ...Command) *Manager

func (*Manager) Call

func (mgr *Manager) Call(command string, caller Caller)

func (*Manager) Encode

func (mgr *Manager) Encode() *play.Commands

func (*Manager) Register

func (mgr *Manager) Register(cmds ...Command)

type Node

type Node struct {
	play.Node
	// contains filtered or unexported fields
}

func NewBoolArgument

func NewBoolArgument(name string, nodes ...Node) Node

func NewIntegerArgument

func NewIntegerArgument(name string, min, max *int32, nodes ...Node) Node

func NewLiteral

func NewLiteral(name string, nodes ...Node) Node

func NewNode

func NewNode(n play.Node, children ...Node) Node

func NewStringArgument

func NewStringArgument(name string, typ int, nodes ...Node) Node

func NewTimeArgument

func NewTimeArgument(name string, min int32, nodes ...Node) Node

func (*Node) Add

func (n *Node) Add(nodes ...Node)

Jump to

Keyboard shortcuts

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