Proxy plugins (Go)
VanillaGate plugins are Go packages compiled into the binary (there is no runtime loading). This keeps the proxy a single static file.
To add one, import it in cmd/vanillagate/plugins.go and build with build.ps1:
go
package main
import (
_ "example.com/myplugin"
)The package registers itself:
go
package myplugin
import "gitlab.com/vanillapocketmine/vanillagate/plugin"
type MyPlugin struct{}
func (*MyPlugin) Name() string { return "myplugin" }
// Enable runs once at startup, before players join. Returning an error stops the proxy.
func (*MyPlugin) Enable(p plugin.Proxy) error {
return nil
}
func init() {
plugin.Register(&MyPlugin{})
}Interfaces (package plugin): Plugin, Proxy, Sender, Player, PermissionProvider, VersionTranslator, plus plugin/form for forms.
Hooks: PreLogin, Login, ServerPreConnect (change the target or cancel), ServerConnected, Disconnect, and console commands. A plugin that panics is logged; the proxy keeps running.
Built-in plugins:
plugins/permissions: groups with inheritance, users,-nodedenials,/perm(alias/lp), saved inpermissions.yml.plugins/multiversion: older clients on the newest servers.
To talk to server-side PHP plugins, use proxy messages from the backends.
