40 lines
886 B
Lua
40 lines
886 B
Lua
return {
|
|
-- id is required, server_version is recommended, all other fields are optional
|
|
id = "mcchat",
|
|
name = "MCChat",
|
|
version = "0.1.0",
|
|
server_version = "0.2",
|
|
authors = {"trimill"},
|
|
description = "Adds basic chat and join/leave messages",
|
|
license = "MIT",
|
|
|
|
on_join = function(self, _, name)
|
|
srv:info(name .. " joined the game")
|
|
srv:broadcast_msg({
|
|
translate = "multiplayer.player.joined",
|
|
with = { { text = name } },
|
|
color = "yellow",
|
|
})
|
|
end,
|
|
|
|
on_leave = function(self, _, name)
|
|
srv:info(name .. " left the game")
|
|
srv:broadcast_msg({
|
|
translate = "multiplayer.player.left",
|
|
with = { { text = name } },
|
|
color = "yellow",
|
|
})
|
|
end,
|
|
|
|
on_message = function(self, msg, _, name)
|
|
srv:info("<" .. name .. "> " .. msg)
|
|
srv:broadcast_chat({
|
|
translate = "chat.type.text",
|
|
with = {
|
|
{ text = name },
|
|
{ text = msg },
|
|
},
|
|
})
|
|
end,
|
|
}
|