aboutsummaryrefslogtreecommitdiff
path: root/builtin/game/chatcommands.lua
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-02-27 22:54:16 +0100
committerest31 <MTest31@outlook.com>2015-02-27 23:00:28 +0100
commit1a175c6982375c996d747ad5569d5d829fa2dde4 (patch)
treede39d97a2bcd01c5cc6bb68dbf9a76cc805d230a /builtin/game/chatcommands.lua
parentd4a6dedc88d8ffeb7e760677d9d7dabd833e52d7 (diff)
downloadminetest-1a175c6982375c996d747ad5569d5d829fa2dde4.tar.gz
minetest-1a175c6982375c996d747ad5569d5d829fa2dde4.tar.bz2
minetest-1a175c6982375c996d747ad5569d5d829fa2dde4.zip
Add /setpassword and /clearpassword logging
Diffstat (limited to 'builtin/game/chatcommands.lua')
-rw-r--r--builtin/game/chatcommands.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua
index 91b685fdf..46e2d03de 100644
--- a/builtin/game/chatcommands.lua
+++ b/builtin/game/chatcommands.lua
@@ -229,21 +229,28 @@ core.register_chatcommand("setpassword", {
if not toname then
return false, "Name field required"
end
- local actstr = "?"
+ local act_str_past = "?"
+ local act_str_pres = "?"
if not raw_password then
core.set_player_password(toname, "")
- actstr = "cleared"
+ act_str_past = "cleared"
+ act_str_pres = "clears"
else
core.set_player_password(toname,
core.get_password_hash(toname,
raw_password))
- actstr = "set"
+ act_str_past = "set"
+ act_str_pres = "sets"
end
if toname ~= name then
core.chat_send_player(toname, "Your password was "
- .. actstr .. " by " .. name)
+ .. act_str_past .. " by " .. name)
end
- return true, "Password of player \"" .. toname .. "\" " .. actstr
+
+ core.log("action", name .. " " .. act_str_pres
+ .. " password of " .. toname .. ".")
+
+ return true, "Password of player \"" .. toname .. "\" " .. act_str_past
end,
})
@@ -257,6 +264,9 @@ core.register_chatcommand("clearpassword", {
return false, "Name field required"
end
core.set_player_password(toname, '')
+
+ core.log("action", name .. " clears password of " .. toname .. ".")
+
return true, "Password of player \"" .. toname .. "\" cleared"
end,
})