Replace "depends.txt" with "mod.conf" (#4)

* Improve README.md

* Create mod.conf

* Delete deprecated "depends.txt"

* Update README.md

* Replace deprecated function with newer one
master
David Leal 2019-09-23 15:07:07 -05:00 committed by shivajiva101
parent 29f1a68c20
commit 03a297cddd
4 changed files with 12 additions and 13 deletions

View File

@ -1,12 +1,10 @@
# border
# Border
Adds a border command to minetest to stop new players joining, an essential command in the server admins toolbox. Useful for preventing trolls returning repeatedly on different ip addresses, the border is maintained across server restarts and allows all your existing players transparent access.
Commands:
## Commands
``` /border```
Toggles the border, default is border open.
toggles the border, default is border open.
``` /visa <player>```
Opens a 24 hour window on the name supplied to allow a new player to join without dropping the border
opens a 24 hour window on the name supplied to allow a new player to join without dropping the border.

View File

@ -1 +0,0 @@
default

View File

@ -7,11 +7,11 @@ with persistence of the last state and visa records across server restarts
local mod_data = minetest.get_mod_storage()
local border = mod_data:get_string("status")
local visa = mod_data:get_string("visa")
local duration = minetest.setting_get("border.visa_duration") or 86400 -- 1 day
local msg = minetest.setting_get("border.msg") or "\nSorry, no new players being admitted at this time!"
local duration = minetest.settings:get("border.visa_duration") or 86400 -- 1 day
local msg = minetest.settings:get("border.msg") or "\nSorry, no new players being admitted at this time!"
local function update_visa_cache(name)
--if name exists in cache remove it
-- If name exists in cache remove it
if visa[name] then
visa[name] = nil
collectgarbage()
@ -23,7 +23,7 @@ local function update_visa_cache(name)
end
if border == "" then
-- initialise
-- Initialise
mod_data:set_string("status", "OPEN")
border = "OPEN"
end
@ -65,10 +65,9 @@ minetest.register_chatcommand("border", {
border = "CLOSED"
minetest.chat_send_player(name, "[border:info] refusing new players.")
end
mod_data:set_string("status", border) -- save current state
end
})
})
-- add visa
minetest.register_chatcommand("visa", {

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = border
depends = default
description = Adds a border command to minetest to stop new players joining, an essential command in the server admins toolbox.