Skip to content

Commit 6660f57

Browse files
src4026LoneWolfHT
andauthored
Require shout priv to send mails to non-staff (#1297)
* If a player does not have shout priv, allow them to only mail staff members (basic_privs) * Oops, forgot to return false * Update init.lua --------- Co-authored-by: LoneWolfHT <[email protected]>
1 parent 2837285 commit 6660f57

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mods/other/email/init.lua

+8-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,14 @@ minetest.register_chatcommand("mail", {
240240
func = function(name, param)
241241
local to, msg = string.match(param, "^([%a%d_-]+) (.+)")
242242
if to and msg then
243-
return email.send_mail(name, to, msg)
243+
if minetest.check_player_privs(name, "shout") then
244+
return email.send_mail(name, to, msg)
245+
elseif not minetest.check_player_privs(name, "shout") and
246+
minetest.check_player_privs(to, "basic_privs") then
247+
return email.send_mail(name, to, msg)
248+
else
249+
return false, S("-!- You don't have the permission to speak, so you can only mail staff members.")
250+
end
244251
else
245252
return false, S("Usage: mail <playername> <some message>")
246253
end

0 commit comments

Comments
 (0)