2013-04-29 18:07:44 -04:00
|
|
|
-- This file is licensed under the terms of the BSD 2-clause license.
|
|
|
|
-- See LICENSE.txt for details.
|
2013-01-08 13:50:47 -02:00
|
|
|
|
|
|
|
|
2013-04-29 18:07:44 -04:00
|
|
|
minetest.register_on_joinplayer(function(player)
|
|
|
|
local name = player:get_player_name()
|
2014-02-01 17:56:33 -05:00
|
|
|
if mt_irc.connected and mt_irc.config.send_join_part then
|
2013-04-29 18:07:44 -04:00
|
|
|
mt_irc:say("*** "..name.." joined the game")
|
2013-04-25 17:00:44 -04:00
|
|
|
end
|
2013-04-29 18:07:44 -04:00
|
|
|
end)
|
2013-01-08 22:50:56 -02:00
|
|
|
|
2013-01-08 22:22:45 -02:00
|
|
|
|
2013-04-29 18:07:44 -04:00
|
|
|
minetest.register_on_leaveplayer(function(player)
|
|
|
|
local name = player:get_player_name()
|
2014-02-01 17:56:33 -05:00
|
|
|
if mt_irc.connected and mt_irc.config.send_join_part then
|
2013-04-29 18:07:44 -04:00
|
|
|
mt_irc:say("*** "..name.." left the game")
|
2013-04-25 17:00:44 -04:00
|
|
|
end
|
2013-04-29 18:07:44 -04:00
|
|
|
end)
|
2013-01-01 21:15:45 -02:00
|
|
|
|
2013-01-08 13:50:47 -02:00
|
|
|
|
2013-04-29 18:07:44 -04:00
|
|
|
minetest.register_on_chat_message(function(name, message)
|
|
|
|
if not mt_irc.connected
|
|
|
|
or message:sub(1, 1) == "/"
|
2013-12-27 12:57:35 -02:00
|
|
|
or message:sub(1, 5) == "[off]"
|
2013-04-29 18:07:44 -04:00
|
|
|
or not mt_irc.joined_players[name]
|
|
|
|
or (not minetest.check_player_privs(name, {shout=true})) then
|
|
|
|
return
|
2013-04-25 17:00:44 -04:00
|
|
|
end
|
2014-01-08 23:39:21 -02:00
|
|
|
local nl = message:find("\n", 1, true)
|
|
|
|
if nl then
|
|
|
|
message = message:sub(1, nl - 1)
|
|
|
|
end
|
2014-05-06 15:26:13 -04:00
|
|
|
mt_irc:say(mt_irc:playerMessage(name, message))
|
2013-04-29 18:07:44 -04:00
|
|
|
end)
|
2013-01-19 04:59:38 -02:00
|
|
|
|
2013-03-28 23:29:23 -03:00
|
|
|
|
2013-04-29 18:07:44 -04:00
|
|
|
minetest.register_on_shutdown(function()
|
|
|
|
mt_irc:disconnect("Game shutting down.")
|
2013-03-28 23:29:23 -03:00
|
|
|
end)
|
|
|
|
|