cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageBooleanInvalid = chat.Translate(str("%commands.generic.boolean.invalid"), 1, `'%v' is not true or false`).Enc("<red>> %v</red>")
View Source
var MessageNoTargets = chat.Translate(str("%commands.generic.noTargetMatch"), 0, `No targets matched selector`).Enc("<red>%v</red>")
View Source
var MessageNumberInvalid = chat.Translate(str("%commands.generic.num.invalid"), 1, `'%v' is not a valid number`).Enc("<red>> %v</red>")
View Source
var MessageParameterInvalid = chat.Translate(str("%commands.generic.parameter.invalid"), 1, `'%v' is not a valid parameter`).Enc("<red>> %v</red>")
View Source
var MessagePlayerNotFound = chat.Translate(str("%commands.generic.player.notFound"), 0, `That player cannot be found`).Enc("<red>> %v</red>")
View Source
var MessageSyntax = chat.Translate(str("%commands.generic.syntax"), 3, `Syntax error: unexpected value: at "%v>>%v<<%v"`).Enc("<red>%v</red>")
View Source
var MessageUnknown = chat.Translate(str("%commands.generic.unknown"), 1, `Unknown command: "%v": Please check that the command exists and that you have permission to use it.`).Enc("<red>%v</red>")
View Source
var MessageUsage = chat.Translate(str("%commands.generic.usage"), 1, `Usage: %v`).Enc("<red>%v</red>")

Functions

func Commands

func Commands() map[string]Command

func Register

func Register(command Command)

func Unregister

func Unregister(name string)

Types

type Allower

type Allower interface {
	Allow(src Source) bool
}

type Command

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

func ByAlias

func ByAlias(alias string) (Command, bool)

func New

func New(name, description string, aliases []string, r ...Runnable) Command

func (Command) Aliases

func (cmd Command) Aliases() []string

func (Command) Description

func (cmd Command) Description() string

func (Command) Execute

func (cmd Command) Execute(args string, source Source, tx *world.Tx)

func (Command) Name

func (cmd Command) Name() string

func (Command) Params

func (cmd Command) Params(src Source) [][]ParamInfo

func (Command) Runnables

func (cmd Command) Runnables(src Source) map[int]Runnable

func (Command) String

func (cmd Command) String() string

func (Command) Usage

func (cmd Command) Usage() string

type Enum

type Enum interface {
	Type() string

	Options(source Source) []string
}

type Line

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

func (*Line) Leftover

func (line *Line) Leftover() []string

func (*Line) Len

func (line *Line) Len() int

func (*Line) Next

func (line *Line) Next() (string, bool)

func (*Line) NextN

func (line *Line) NextN(n int) ([]string, bool)

func (*Line) RemoveN

func (line *Line) RemoveN(n int)

func (*Line) RemoveNext

func (line *Line) RemoveNext()

func (*Line) SyntaxError

func (line *Line) SyntaxError() error

func (*Line) UsageError

func (line *Line) UsageError() error

type MobNameEnum

type MobNameEnum string

func (MobNameEnum) Options

func (MobNameEnum) Options(Source) []string

func (MobNameEnum) Type

func (MobNameEnum) Type() string

type NamedTarget

type NamedTarget interface {
	Target

	Name() string
}

type Optional

type Optional[T any] struct {
	// contains filtered or unexported fields
}

func (Optional[T]) Load

func (o Optional[T]) Load() (T, bool)

func (Optional[T]) LoadOr

func (o Optional[T]) LoadOr(or T) T

type Output

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

func (*Output) Error

func (o *Output) Error(a ...any)

func (*Output) ErrorCount

func (o *Output) ErrorCount() int

func (*Output) Errorf

func (o *Output) Errorf(format string, a ...any)

func (*Output) Errors

func (o *Output) Errors() []error

func (*Output) Errort

func (o *Output) Errort(t chat.Translation, a ...any)

func (*Output) MessageCount

func (o *Output) MessageCount() int

func (*Output) Messages

func (o *Output) Messages() []fmt.Stringer

func (*Output) Print

func (o *Output) Print(a ...any)

func (*Output) Printf

func (o *Output) Printf(format string, a ...any)

func (*Output) Printt

func (o *Output) Printt(t chat.Translation, a ...any)

type ParamDescriber

type ParamDescriber interface {
	DescribeParams(src Source) []ParamInfo
}

type ParamInfo

type ParamInfo struct {
	Name     string
	Value    any
	Optional bool
	Suffix   string
}

type Parameter

type Parameter interface {
	Parse(line *Line, v reflect.Value) error

	Type() string
}

type Runnable

type Runnable interface {
	Run(src Source, o *Output, tx *world.Tx)
}

type Source

type Source interface {
	Target

	SendCommandOutput(o *Output)
}

type SubCommand

type SubCommand struct{}

type Summon

type Summon struct {
	Mob MobNameEnum
}

func (Summon) Run

func (s Summon) Run(src Source, o *Output, tx *world.Tx)

type Target

type Target interface {
	Position() mgl64.Vec3
}

type Varargs

type Varargs string

Jump to

Keyboard shortcuts

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