[whitelist] Update to Git patch 13e8686:
https://github.com/AntumMT/mod-whitelist/tree/13e8686master
parent
af31279557
commit
7ea2ee020f
|
@ -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.trash_can]: https://github.com/AntumMT/mod-trash_can/tree/5a92bf4
|
||||||
[patch.unifieddyes]: https://github.com/AntumMT/mod-unifieddyes/tree/9c2f740
|
[patch.unifieddyes]: https://github.com/AntumMT/mod-unifieddyes/tree/9c2f740
|
||||||
[patch.walking_light]: https://github.com/AntumMT/mod-walking_light/tree/e602515
|
[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.windmill]: https://github.com/AntumMT/mod-windmill/tree/7756ab4
|
||||||
[patch.workbench]: https://github.com/AntumMT/mod-workbench/tree/b964323
|
[patch.workbench]: https://github.com/AntumMT/mod-workbench/tree/b964323
|
||||||
|
|
|
@ -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 ##
|
## TOOLS / WEAPONS ##
|
||||||
#####################
|
#####################
|
||||||
|
|
|
@ -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/
|
|
@ -7,6 +7,10 @@ local world_path = minetest.get_worldpath()
|
||||||
local admin = minetest.settings:get("name")
|
local admin = minetest.settings:get("name")
|
||||||
local whitelist = {}
|
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 function load_whitelist()
|
||||||
local file, err = io.open(world_path.."/whitelist.txt", "r")
|
local file, err = io.open(world_path.."/whitelist.txt", "r")
|
||||||
if err then
|
if err then
|
||||||
|
@ -31,12 +35,14 @@ end
|
||||||
|
|
||||||
load_whitelist()
|
load_whitelist()
|
||||||
|
|
||||||
minetest.register_on_prejoinplayer(function(name, ip)
|
if enabled then
|
||||||
if name == "singleplayer" or name == admin or whitelist[name] then
|
minetest.register_on_prejoinplayer(function(name, ip)
|
||||||
return
|
if name == "singleplayer" or name == admin or whitelist[name] then
|
||||||
end
|
return
|
||||||
return "This server is whitelisted and you are not on the whitelist."
|
end
|
||||||
end)
|
return deny_message
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_chatcommand("whitelist", {
|
minetest.register_chatcommand("whitelist", {
|
||||||
params = "{add|remove} <nick>",
|
params = "{add|remove} <nick>",
|
||||||
|
|
|
@ -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.
|
|
@ -426,6 +426,15 @@ spawneggs.grass_chance (Grass chance) int 3000
|
||||||
spawneggs.enable_node_spawn (Enable node spawn) bool true
|
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]
|
[Modpacks]
|
||||||
|
|
Loading…
Reference in New Issue