Add canafk priv

This commit is contained in:
rubenwardy 2017-10-14 22:34:06 +01:00
parent 31ae819d0b
commit 105d824de5

View file

@ -14,6 +14,8 @@ local WARN_TIME = 20
local players = {} local players = {}
local checkTimer = 0 local checkTimer = 0
minetest.register_privilege("canafk")
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local playerName = player:get_player_name() local playerName = player:get_player_name()
players[playerName] = { players[playerName] = {
@ -40,7 +42,7 @@ minetest.register_globalstep(function(dtime)
--Check for inactivity once every CHECK_INTERVAL seconds --Check for inactivity once every CHECK_INTERVAL seconds
checkTimer = checkTimer + dtime checkTimer = checkTimer + dtime
if checkTimer > CHECK_INTERVAL then if checkTimer > CHECK_INTERVAL and not minetest.check_player_privs({ canafk = true }) then
checkTimer = 0 checkTimer = 0
--Kick player if he/she has been inactive for longer than MAX_INACTIVE_TIME seconds --Kick player if he/she has been inactive for longer than MAX_INACTIVE_TIME seconds