diff --git a/README.md b/README.md index 300e622..e46b2d3 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,4 @@ start to be warned via chat message. - 07/22/2021 Beanzilla added the priv bypass_afk_kick which prevents being kicked for an unlimited amount of time. (Default's to being granted to server admin and if single player) +- 07/22/2021 Beanzilla fixed issue #4 diff --git a/init.lua b/init.lua index 0090263..795938a 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,7 @@ to this software to the public domain worldwide. This software is distributed without any warranty. ]] +-- Settings local MAX_INACTIVE_TIME = 300 local CHECK_INTERVAL = 1 local WARN_TIME = 20 @@ -27,6 +28,10 @@ minetest.register_on_leaveplayer(function(player) end) minetest.register_on_chat_message(function(playerName, message) + -- Verify that it's a player and that it is not the terminal + if not playerName or not minetest.get_player_by_name(playerName) then + return -- Abort tracking the last action + end players[playerName]["lastAction"] = minetest.get_gametime() end)