diff --git a/README.md b/README.md index c788072..96fcd0e 100644 --- a/README.md +++ b/README.md @@ -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 ``` - -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. diff --git a/depends.txt b/depends.txt deleted file mode 100644 index 4ad96d5..0000000 --- a/depends.txt +++ /dev/null @@ -1 +0,0 @@ -default diff --git a/init.lua b/init.lua index 28ebf78..3c43780 100644 --- a/init.lua +++ b/init.lua @@ -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", { diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..5f54da2 --- /dev/null +++ b/mod.conf @@ -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.