Skip to content

Commit

Permalink
Require shout priv to send mails to non-staff (#1297)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
src4026 and LoneWolfHT authored Jun 1, 2024
1 parent 2837285 commit 6660f57
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mods/other/email/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,14 @@ minetest.register_chatcommand("mail", {
func = function(name, param)
local to, msg = string.match(param, "^([%a%d_-]+) (.+)")
if to and msg then
return email.send_mail(name, to, msg)
if minetest.check_player_privs(name, "shout") then
return email.send_mail(name, to, msg)
elseif not minetest.check_player_privs(name, "shout") and
minetest.check_player_privs(to, "basic_privs") then
return email.send_mail(name, to, msg)
else
return false, S("-!- You don't have the permission to speak, so you can only mail staff members.")
end
else
return false, S("Usage: mail <playername> <some message>")
end
Expand Down

0 comments on commit 6660f57

Please sign in to comment.