forked from mff/name_restrictions
Mise à jour des appels déprécié de minetest.settings:get
This commit is contained in:
parent
97592b5eec
commit
c58a4d5e49
14
init.lua
14
init.lua
@ -7,21 +7,21 @@
|
|||||||
-- For legitimate player names that are caught by the filters.
|
-- For legitimate player names that are caught by the filters.
|
||||||
|
|
||||||
local exemptions = {}
|
local exemptions = {}
|
||||||
local temp = minetest.setting_get("name_restrictions.exemptions")
|
local temp = minetest.settings:get("name_restrictions.exemptions")
|
||||||
temp = temp and temp:split() or {}
|
temp = temp and temp:split() or {}
|
||||||
for _, allowed_name in pairs(temp) do
|
for _, allowed_name in pairs(temp) do
|
||||||
exemptions[allowed_name] = true
|
exemptions[allowed_name] = true
|
||||||
end
|
end
|
||||||
temp = nil
|
temp = nil
|
||||||
-- Exempt server owner
|
-- Exempt server owner
|
||||||
exemptions[minetest.setting_get("name")] = true
|
exemptions[minetest.settings:get("name")] = true
|
||||||
exemptions["singleplayer"] = true
|
exemptions["singleplayer"] = true
|
||||||
|
|
||||||
local disallowed_names
|
local disallowed_names
|
||||||
|
|
||||||
local function load_forbidden_names()
|
local function load_forbidden_names()
|
||||||
disallowed_names = {}
|
disallowed_names = {}
|
||||||
local path = minetest.setting_get("name_restrictions.forbidden_names_list_path") or
|
local path = minetest.settings:get("name_restrictions.forbidden_names_list_path") or
|
||||||
minetest.get_worldpath() .. "/forbidden_names.txt"
|
minetest.get_worldpath() .. "/forbidden_names.txt"
|
||||||
local file = io.open(path, 'r')
|
local file = io.open(path, 'r')
|
||||||
if file then
|
if file then
|
||||||
@ -53,7 +53,7 @@ end
|
|||||||
local disallowed
|
local disallowed
|
||||||
|
|
||||||
local function load_disallowed()
|
local function load_disallowed()
|
||||||
local path = minetest.setting_get("name_restrictions.forbidden_name_patterns_list_path") or
|
local path = minetest.settings:get("name_restrictions.forbidden_name_patterns_list_path") or
|
||||||
minetest.get_worldpath() .. "/forbidden_names_patterns.txt"
|
minetest.get_worldpath() .. "/forbidden_names_patterns.txt"
|
||||||
local file = io.open(path, 'r')
|
local file = io.open(path, 'r')
|
||||||
if file then
|
if file then
|
||||||
@ -237,8 +237,8 @@ end)
|
|||||||
-- Name length --
|
-- Name length --
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
local min_name_len = tonumber(minetest.setting_get("name_restrictions.minimum_name_length")) or 2
|
local min_name_len = tonumber(minetest.settings:get("name_restrictions.minimum_name_length")) or 2
|
||||||
local max_name_len = tonumber(minetest.setting_get("name_restrictions.maximum_name_length")) or 17
|
local max_name_len = tonumber(minetest.settings:get("name_restrictions.maximum_name_length")) or 17
|
||||||
|
|
||||||
minetest.register_on_prejoinplayer(function(name, ip)
|
minetest.register_on_prejoinplayer(function(name, ip)
|
||||||
if exemptions[name] then return end
|
if exemptions[name] then return end
|
||||||
@ -309,7 +309,7 @@ end
|
|||||||
-- 0.5 = Strict checking.
|
-- 0.5 = Strict checking.
|
||||||
-- 1 = Normal checking.
|
-- 1 = Normal checking.
|
||||||
-- 2 = Relaxed checking.
|
-- 2 = Relaxed checking.
|
||||||
local pronounceability = tonumber(minetest.setting_get("name_restrictions.pronounceability"))
|
local pronounceability = tonumber(minetest.settings:get("name_restrictions.pronounceability"))
|
||||||
if pronounceability then
|
if pronounceability then
|
||||||
minetest.register_on_prejoinplayer(function(name, ip)
|
minetest.register_on_prejoinplayer(function(name, ip)
|
||||||
if exemptions[name] then return end
|
if exemptions[name] then return end
|
||||||
|
Loading…
Reference in New Issue
Block a user