commands

package
v0.0.0-...-54241fc Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SingleWord stringArgType = iota
	QuotablePhrase
	GreedyPhrase
)
View Source
const (
	EntitySingle = iota + 1
	EntityPlayerOnly
)
View Source
const (
	ChatModeEnabled = iota
	ChatModeCommandsOnly
	ChatModeHidden
)

Variables

This section is empty.

Functions

func RegisterCommands

func RegisterCommands(commands ...*Command) *pk.DeclareCommands

Types

type Argument

type Argument struct {
	Name        string
	Suggest     func(ctx SuggestionsContext)
	Parser      Parser
	Alternative *Argument
}

func NewBoolArg

func NewBoolArg(name string) Argument

func NewChatComponentArg

func NewChatComponentArg(name string) Argument

func NewDimensionArg

func NewDimensionArg(name string) Argument

func NewEntityArg

func NewEntityArg(name string, properties byte) Argument

func NewFloatArg

func NewFloatArg(name string) Argument

func NewGamemodeArg

func NewGamemodeArg(name string) Argument

func NewIntArg

func NewIntArg(name string) Argument

func NewResourceKeyArg

func NewResourceKeyArg(name string, registry string) Argument

func NewStrArg

func NewStrArg(name string, properties stringArgType) Argument

func NewVector2Arg

func NewVector2Arg(name string) Argument

func NewVector3Arg

func NewVector3Arg(name string) Argument

func (Argument) Max

func (a Argument) Max(max uint64) Argument

func (Argument) Min

func (a Argument) Min(min uint64) Argument

func (Argument) MinMax

func (a Argument) MinMax(min, max uint64) Argument

func (Argument) SetAlternative

func (a Argument) SetAlternative(arg Argument) Argument

func (Argument) SetSuggest

func (a Argument) SetSuggest(s func(ctx SuggestionsContext)) Argument

type Command

type Command struct {
	Name                string
	Arguments           []Argument
	Aliases             []string
	Execute             func(ctx CommandContext)
	RequiredPermissions []string
}

func (*Command) AddArguments

func (command *Command) AddArguments(arguments ...Argument) *Command

type CommandContext

type CommandContext struct {
	Command            *Command
	Executor           interface{}
	Arguments          []string
	Salt, Timestamp    int64
	ArgumentSignatures []pk.Argument
	FullCommand        string
}

func (*CommandContext) Error

func (ctx *CommandContext) Error(msg string)

func (*CommandContext) ErrorHere

func (ctx *CommandContext) ErrorHere(msg string)

func (CommandContext) GetBool

func (ctx CommandContext) GetBool(name string) (value bool, ok bool)

func (CommandContext) GetFloat32

func (ctx CommandContext) GetFloat32(name string) (value float32, ok bool)

func (CommandContext) GetFloat64

func (ctx CommandContext) GetFloat64(name string) (value float64, ok bool)

func (CommandContext) GetInt32

func (ctx CommandContext) GetInt32(name string) (value int32, ok bool)

func (CommandContext) GetInt64

func (ctx CommandContext) GetInt64(name string) (value int64, ok bool)

func (CommandContext) GetString

func (ctx CommandContext) GetString(name string) (value string, ok bool)

func (CommandContext) GetVector2

func (ctx CommandContext) GetVector2(name string) (x, y float64, ok bool)

func (CommandContext) GetVector3

func (ctx CommandContext) GetVector3(name string) (x, y, z float64, ok bool)

func (*CommandContext) Incomplete

func (ctx *CommandContext) Incomplete()

func (*CommandContext) Reply

func (ctx *CommandContext) Reply(message chat.Message)

type Graph

type Graph struct {
	Commands []*Command
}

func (*Graph) AddCommands

func (graph *Graph) AddCommands(commands ...*Command) *Graph

func (Graph) Data

func (graph Graph) Data() *pk.DeclareCommands

func (*Graph) DeleteCommand

func (graph *Graph) DeleteCommand(name string) (found bool)

func (*Graph) FindCommand

func (graph *Graph) FindCommand(name string) (cmd *Command)

type Parser

type Parser struct {
	ID         int32
	Properties types.CommandProperties
}

type SuggestionsContext

type SuggestionsContext struct {
	Executor      interface{}
	TransactionId int32
	Arguments     []string
	FullCommand   string
}

func (*SuggestionsContext) Return

func (c *SuggestionsContext) Return(suggestions []pk.SuggestionMatch)

Jump to

Keyboard shortcuts

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