fix broken persistence and add duration variable

master
shivajiva101 2018-03-21 17:12:54 +00:00 committed by GitHub
parent 484ced5ce6
commit 022ce8d73e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@ with persistence of the last state across server restarts
local mod_data = minetest.get_mod_storage()
local border = "OPEN"
local visa = {}
local duration = 300
-- initialise
if mod_data:get_string("status") == "" then
@ -34,7 +35,7 @@ minetest.register_chatcommand("border", {
border = "CLOSED"
minetest.chat_send_player(name, "[border:info] refusing new players.")
end
mod_data:set_string("flag", border) -- save
mod_data:set_string("status", border) -- save
end
})
@ -48,7 +49,7 @@ minetest.register_chatcommand("visa", {
end
if not visa[param] then
visa[param] = true
minetest.after(300, function(name)
minetest.after(duration, function(name)
if visa[name] then visa[name] = nil end
end, param)
end