Hopefully stop lag

This commit is contained in:
rubenwardy 2015-12-06 15:52:39 +00:00
parent 16aaecfae3
commit c3ba03042c
18 changed files with 48 additions and 949 deletions

View file

@ -94,14 +94,18 @@ function chatplus.clean_players()
(not value.inbox or #value.inbox==0) and
(not value.ignore or #value.ignore==0)
) then
minetest.log("Deleting blank player "..key)
value[key] = nil
end
end
chatplus.save()
minetest.log("[Chatplus] Clean complete")
end
function cp_tick()
chatplus.clean_players()
minetest.after(30*60, cp_tick)
end
minetest.after(30*60, cp_tick)
function chatplus.poke(name,player)
local function check(name,value)
if not chatplus.players[name][value] then
@ -364,7 +368,7 @@ minetest.register_globalstep(function(dtime)
hud_elem_type = "text",
name = "MailText",
position = {x=0.55, y=0.52},
text=#value.inbox,
text=#value.inbox .. " /inbox",
scale = {x=1,y=1},
alignment = {x=0.5, y=0.5},
})

22
mods/chatplus/tmp.lua Normal file
View file

@ -0,0 +1,22 @@
--[[
if #msg > 200 then
local warn = warned[from] or { count = 0 }
warned[from] = warn
warn.count = warn.count + 1
warn.time = minetest.get_gametime()
if warn.count > 3 then
if been_kicked[from] then
minetest.kick_player(from, "Too long chat message! ")
been_kicked =
else
minetest.kick_player(from, "Too long chat message! Next time is temp-ban.")
been_kicked
end
return true
else
minetest.chat_send_player(from, "That chat message was rather long! " ..
(2 - warn.count) .. " warnings remaining.")
end
end
]]