quectocraft2/plugins/example.lua
2023-08-07 22:24:28 -04:00

50 lines
880 B
Lua

return {
id = "example",
server_version = "0.2",
init = function(self)
srv:add_command("selfkick")
srv:add_command("fail")
end,
on_join = function(self, uuid, name)
local info = srv:get_info(uuid)
for k, v in pairs(info) do
srv:warn(k .. ": " .. tostring(v))
end
srv:send_msg({
{
text = "welcome, ",
color = "green",
}, {
text = name,
color = "yellow",
}, {
text = ", to the server!\nthere are many things to do, such as ",
color = "green",
}, {
text = "leaving",
color = "light_purple"
},
}, uuid)
end,
on_command = function(self, cmd, args, _, uuid)
if cmd == "fail" then
error("failure has occured")
elseif cmd == "selfkick" then
srv:kick(uuid, {
{
text = "be",
color = "dark_red",
},
{
text = "gone",
color = "red",
bold = true,
}
})
end
end,
}