Skip to content

server.plugin.sample

fn (GreeterListener) on_player_join #

fn (mut l GreeterListener) on_player_join(mut ctx event.Context[event.JoinData])

on_player_join replaces the default join line with a custom welcome.

fn (GreeterListener) on_player_chat #

fn (mut l GreeterListener) on_player_chat(mut ctx event.Context[event.ChatData])

on_player_chat blocks messages containing a banned word, showing the cancel path, and otherwise tags the message with the online count.

fn (GreeterListener) on_block_break #

fn (mut l GreeterListener) on_block_break(mut ctx event.Context[event.BlockBreakData])

on_block_break protects the spawn area (a 16x16 column around origin) from being mined - a typical minigame lobby guard.

fn (GreeterListener) on_start_break #

fn (mut l GreeterListener) on_start_break(mut ctx event.Context[event.StartBreakData])

fn (GreeterListener) on_player_interact #

fn (mut l GreeterListener) on_player_interact(mut ctx event.Context[event.InteractData])

fn (GreeterListener) on_item_use #

fn (mut l GreeterListener) on_item_use(mut ctx event.Context[event.ItemUseData])

on_item_use fires right before a held item's effect applies.

fn (GreeterListener) on_player_death #

fn (mut l GreeterListener) on_player_death(mut ctx event.Context[event.DeathData])

on_player_death rewrites the death broadcast with a custom format.

fn (HelloCommand) name #

fn (c HelloCommand) name() string

fn (HelloCommand) description #

fn (c HelloCommand) description() string

fn (HelloCommand) aliases #

fn (c HelloCommand) aliases() []string

fn (HelloCommand) permission #

fn (c HelloCommand) permission() string

fn (HelloCommand) arguments #

fn (c HelloCommand) arguments() []cmd.Argument

fn (HelloCommand) execute #

fn (c HelloCommand) execute(mut sender cmd.Sender, ctx cmd.Context) !

fn (SummonCommand) name #

fn (c SummonCommand) name() string

fn (SummonCommand) description #

fn (c SummonCommand) description() string

fn (SummonCommand) aliases #

fn (c SummonCommand) aliases() []string

fn (SummonCommand) permission #

fn (c SummonCommand) permission() string

fn (SummonCommand) arguments #

fn (c SummonCommand) arguments() []cmd.Argument

fn (SummonCommand) execute #

fn (c SummonCommand) execute(mut sender cmd.Sender, ctx cmd.Context) !

struct GreeterPlugin #

struct GreeterPlugin {
	plugin.Base
mut:
	heartbeat_task &scheduler.TaskHandler = unsafe { nil }
}

GreeterPlugin is a worked example of the plugin API: it registers a command, an event listener and a repeating scheduled task on enable. Use it as a template for real plugins.

fn (GreeterPlugin) meta #

fn (p &GreeterPlugin) meta() plugin.Meta

fn (GreeterPlugin) on_enable #

fn (mut p GreeterPlugin) on_enable(mut api plugin.Api)

fn (GreeterPlugin) on_disable #

fn (mut p GreeterPlugin) on_disable()