[PATCH] add serverpass_get command
Export this patch
- add "serverpass_get" command to show current server password
- change "serverpass" to "serverpass_set" to differentiate from above
---
init.lua | 15 ++++++++++++++ -
1 file changed, 14 insertions(+), 1 deletion(-)
mode change 100644 => 100755 init.lua
diff --git a/init.lua b/init.lua
old mode 100644
new mode 100755
index b9a603a..bdb1476
--- a/init.lua
+++ b/init.lua
@@ -450,7 +450,7 @@ local xr = {
minetest.register_chatcommand("xban_record", xr)
minetest.register_chatcommand("xr", xr)
- minetest.register_chatcommand("serverpass", {
+ minetest.register_chatcommand("serverpass_set", {
description = "set a server password",
params = "<password>",
privs = { kick=true },
@@ -459,6 +459,19 @@ minetest.register_chatcommand("serverpass", {
minetest.chat_send_player(name, "Changed server password to \""..param.."\".")
end
})
+ minetest.register_chatcommand("serverpass_get", {
+ description = "view the server password",
+ params = "",
+ privs = { kick=true },
+ func = function(name,param)
+ local pass = minetest.settings:get("default_password")
+ if not pass or pass == "" then
+ minetest.chat_send_player(name,"No password set. Server is open to the public")
+ else
+ minetest.chat_send_player(name,"Current password: \""..pass.."\"")
+ end
+ end
+ })
minetest.register_chatcommand("xban_wl", {
description = "Manages the whitelist",
--
2.33.0
The current way how we use this function was to set a random password to
prevent new users from joining at all, so if people wanted to join, we
reset the password to some known value, and let people join.