plugins

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPluginRegistry

func GetPluginRegistry() pluginRegistry

func Load

func Load(dataFilesPath string)

func OnNetConnect

func OnNetConnect(n NetConnection)

func ReadFile

func ReadFile(dfPath string) ([]byte, error)

func Save

func Save()

Types

type NetConnection

type NetConnection interface {
	IsWebSocket() bool
	Read(p []byte) (n int, err error)
	Write(p []byte) (n int, err error)
	Close()
	RemoteAddr() net.Addr
	ConnectionId() uint64
	InputDisabled(setTo ...bool) bool
}

type Plugin

type Plugin struct {
	Callbacks PluginCallbacks

	Config PluginConfig

	Web WebConfig
	// contains filtered or unexported fields
}

func New

func New(name string, version string) *Plugin

func (*Plugin) AddMobCommand

func (p *Plugin) AddMobCommand(command string, handlerFunc mobcommands.MobCommand, allowWhenDowned bool)

Registers a MobCommand and callback

func (*Plugin) AddScriptingFunction

func (p *Plugin) AddScriptingFunction(funcName string, scriptFunc any)

Registers a UserCommand and callback

func (*Plugin) AddUserCommand

func (p *Plugin) AddUserCommand(command string, handlerFunc usercommands.UserCommand, allowWhenDowned bool, isAdminOnly bool)

Registers a UserCommand and callback

func (*Plugin) AttachFileSystem

func (p *Plugin) AttachFileSystem(f embed.FS) error

Adds an embedded file system to the plugin

func (*Plugin) ExportFunction

func (p *Plugin) ExportFunction(stringId string, f any)

func (*Plugin) ReadBytes

func (p *Plugin) ReadBytes(identifier string) ([]byte, error)

func (*Plugin) ReadIntoStruct

func (p *Plugin) ReadIntoStruct(identifier string, out any) error

func (*Plugin) Requires

func (p *Plugin) Requires(modname string, modversion string)

func (*Plugin) WriteBytes

func (p *Plugin) WriteBytes(identifier string, bytes []byte) error

func (*Plugin) WriteStruct

func (p *Plugin) WriteStruct(identifier string, in any) error

type PluginCallbacks

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

func (*PluginCallbacks) SetIACHandler

func (c *PluginCallbacks) SetIACHandler(f func(uint64, []byte) bool)

func (*PluginCallbacks) SetOnLoad

func (c *PluginCallbacks) SetOnLoad(f func())

func (*PluginCallbacks) SetOnNetConnect

func (c *PluginCallbacks) SetOnNetConnect(f func(NetConnection))

func (*PluginCallbacks) SetOnSave

func (c *PluginCallbacks) SetOnSave(f func())

type PluginConfig

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

func (*PluginConfig) Get

func (p *PluginConfig) Get(name string) any

func (*PluginConfig) Set

func (p *PluginConfig) Set(name string, val any)

type PluginFiles

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

Implements fs.ReadFileFS

func (PluginFiles) Open

func (p PluginFiles) Open(name string) (fs.File, error)

func (PluginFiles) ReadFile

func (p PluginFiles) ReadFile(name string) ([]byte, error)

func (PluginFiles) Stat

func (p PluginFiles) Stat(name string) (fs.FileInfo, error)

type WebConfig

type WebConfig struct {
	// contains filtered or unexported fields
}
func (w *WebConfig) NavLink(name string, path string)

func (*WebConfig) WebPage

func (w *WebConfig) WebPage(name string, path string, file string, addToNav bool, dataFunc func(r *http.Request) map[string]any)

type WebPage

type WebPage struct {
	Name         string
	Path         string
	Filepath     string
	DataFunction func(r *http.Request) map[string]any
}

Jump to

Keyboard shortcuts

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