Skip to content

/rules

This plugin adds a /rules command that shows your server's rules.

main.lua
plugin.addCommand({
    name = "rules",
    description = "Show the server rules",
    usage = "/rules"
}, function(event)
    local sender = event.getSender()
    sender:sendMessage("Server rules:")
    sender:sendMessage("1. Be kind to everyone.")
    sender:sendMessage("2. No griefing.")
    sender:sendMessage("3. Have fun!")
end)

How it works

Nothing is new here except that sendMessage is called more than once. Each call shows up as its own line in chat, so you can send as many lines as you like. Change the text to your own rules and you've got a real command for your server. It also works from the console, since it only sends messages.

Next: a welcome with the player's name.