Page Menu
Home
1F616EMO Bugtracker
Search
Configure Global Search
Log In
Files
F240549
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/username_restrictions/init.lua b/username_restrictions/init.lua
new file mode 100644
index 0000000..cac9c2c
--- /dev/null
+++ b/username_restrictions/init.lua
@@ -0,0 +1,27 @@
+-- twi_mods/username_restrictions/init.lua
+-- Ban some usernames
+-- Copyright (C) 2024 1F616EMO
+-- SPDX-License-Identifier: LGPL-2.1-or-later
+
+local banned_parts = {}
+
+for _, part in ipairs({"admin", "moderator"}) do
+ banned_parts[part] = antispoof.normalize(part)
+end
+
+local auth
+minetest.register_on_prejoinplayer(function(name)
+ if name == "singleplayer" or name == minetest.settings:get("name") then return end
+ auth = auth or minetest.get_auth_handler()
+ if not auth.get_auth(name) then
+ local normalized_name = antispoof.normalize(name)
+ for orig_part, norm_part in pairs(banned_parts) do
+ if string.find(normalized_name, norm_part) then
+ return string.format(
+ "Invalid username %s: Username cannt conain \"%s\"",
+ name, orig_part
+ )
+ end
+ end
+ end
+end)
\ No newline at end of file
diff --git a/username_restrictions/mod.conf b/username_restrictions/mod.conf
new file mode 100644
index 0000000..67c075a
--- /dev/null
+++ b/username_restrictions/mod.conf
@@ -0,0 +1,2 @@
+name = username_restrictions
+depends = antispoof
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jun 6 2026, 4:23 AM (6 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
17/a8/e6f48ba622a5f936f482e5a872f7
Default Alt Text
(1 KB)
Attached To
Mode
rTWIMODS Survival Server Custom Modifications
Attached
Detach File
Event Timeline
Log In to Comment