quectocraft2/plugins/example.lua

50 lines
880 B
Lua
Raw Normal View History

2023-07-26 04:53:51 +00:00
return {
id = "example",
2023-08-01 04:56:38 +00:00
server_version = "0.2",
2023-07-26 04:53:51 +00:00
2023-08-01 04:56:38 +00:00
init = function(self)
2023-08-08 02:24:28 +00:00
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,
}
})
2023-08-01 04:56:38 +00:00
end
2023-07-26 04:53:51 +00:00
end,
}