[whitelist] Update to Git patch 13e8686:

https://github.com/AntumMT/mod-whitelist/tree/13e8686
master
Jordan Irwin 2017-08-16 12:09:22 -07:00
parent af31279557
commit 7ea2ee020f
6 changed files with 74 additions and 7 deletions

View File

@ -579,6 +579,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[patch.trash_can]: https://github.com/AntumMT/mod-trash_can/tree/5a92bf4
[patch.unifieddyes]: https://github.com/AntumMT/mod-unifieddyes/tree/9c2f740
[patch.walking_light]: https://github.com/AntumMT/mod-walking_light/tree/e602515
[patch.whitelist]: https://github.com/AntumMT/mod-whitelist/tree/d0e1f48
[patch.whitelist]: https://github.com/AntumMT/mod-whitelist/tree/13e8686
[patch.windmill]: https://github.com/AntumMT/mod-windmill/tree/7756ab4
[patch.workbench]: https://github.com/AntumMT/mod-workbench/tree/b964323

View File

@ -1619,6 +1619,24 @@ inventory = sfinv
###########
## ADMIN ##
###########
# *** whitelist ***
## Enables/Disables whitelist feature.
# type: bool
# default: false
#whitelist.enable = false
## Sets a custom message to display when access to server is denied.
# type: string
# default: This server is whitelisted and you are not on the whitelist.
#whitelist.message = This server is whitelisted and you are not on the whitelist.
#####################
## TOOLS / WEAPONS ##
#####################

View File

@ -0,0 +1,28 @@
## Whitelist Mod for [Minetest][]
---
### **Description:**
This is a simple Minetest mod that adds a player whitelist. Any player names not found in the whitelist are denied access to the server.
- Commands:
- ***/whitelist add <name>***
- Adds a username to whitelist & allows access to server.
- ***/whitelist remove <name>***
- Removes a username from whitelist & denies access to server.
- Settings:
- ***whitelist.enable***
- Enables/Disables denying access to users not on the whitelist.
- Disabled by default.
- ***whitelist.message***
- Changes the default message *"This server is whitelisted and you are not on the whitelist."*
---
### **Licensing:**
CC0
[Minetest]: http://www.minetest.net/

View File

@ -7,6 +7,10 @@ local world_path = minetest.get_worldpath()
local admin = minetest.settings:get("name")
local whitelist = {}
-- Disabled by default
local enabled = minetest.settings:get_bool("whitelist.enable") == true
local deny_message = minetest.settings:get("whitelist.message") or "This server is whitelisted and you are not on the whitelist."
local function load_whitelist()
local file, err = io.open(world_path.."/whitelist.txt", "r")
if err then
@ -31,12 +35,14 @@ end
load_whitelist()
minetest.register_on_prejoinplayer(function(name, ip)
if name == "singleplayer" or name == admin or whitelist[name] then
return
end
return "This server is whitelisted and you are not on the whitelist."
end)
if enabled then
minetest.register_on_prejoinplayer(function(name, ip)
if name == "singleplayer" or name == admin or whitelist[name] then
return
end
return deny_message
end)
end
minetest.register_chatcommand("whitelist", {
params = "{add|remove} <nick>",

View File

@ -0,0 +1,6 @@
# Enables/Disables whitelist feature.
whitelist.enable (Enable whitelist) bool false
# Sets a custom message to display when access to server is denied.
whitelist.message (Whitelist message) string This server is whitelisted and you are not on the whitelist.

View File

@ -426,6 +426,15 @@ spawneggs.grass_chance (Grass chance) int 3000
spawneggs.enable_node_spawn (Enable node spawn) bool true
[*whitelist]
# Enables/Disables whitelist feature.
whitelist.enable (Enable whitelist) bool false
# Sets a custom message to display when access to server is denied.
whitelist.message (Whitelist message) string This server is whitelisted and you are not on the whitelist.
# ---------------------------------------------------------------------------------
[Modpacks]