Update chatplus

This commit is contained in:
rubenwardy 2016-04-05 01:44:11 +01:00
parent 9df63edff9
commit f4053a34d7

View file

@ -7,7 +7,7 @@
chatplus = { chatplus = {
version = 2.2, version = 2.3,
_logpath = minetest.get_worldpath().."/chatplus-log.txt", _logpath = minetest.get_worldpath().."/chatplus-log.txt",
_defsettings = { _defsettings = {
log = true, log = true,
@ -164,6 +164,14 @@ function chatplus.poke(name,player)
return chatplus.players[name] return chatplus.players[name]
end end
minetest.register_on_joinplayer(function(player)
chatplus.poke(player:get_player_name(), player)
end)
minetest.register_on_leaveplayer(function(player)
chatplus.poke(player:get_player_name(), "end")
end)
function chatplus.register_handler(func,place) function chatplus.register_handler(func,place)
if not place then if not place then
table.insert(chatplus._handlers, func) table.insert(chatplus._handlers, func)
@ -177,18 +185,14 @@ function chatplus.log_message(from, msg)
chatplus.log("<" .. from .. "> " .. msg) chatplus.log("<" .. from .. "> " .. msg)
end end
minetest.register_on_joinplayer(function(player)
chatplus.poke(player:get_player_name(), player)
end)
minetest.register_on_leaveplayer(function(player)
chatplus.poke(player:get_player_name(), "end")
end)
function chatplus.send(from, msg) function chatplus.send(from, msg)
if msg:sub(1, 1) == "/" then if msg:sub(1, 1) == "/" then
return false return false
end end
if not minetest.check_player_privs(from, {shout = true}) then
return nil
end
chatplus.log_message(from, msg) chatplus.log_message(from, msg)