forked from BlockySurvival/bls_custom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprivs.lua
35 lines (32 loc) · 1.19 KB
/
privs.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
minetest.register_privilege("caps", "Allows a player to use capital letters in chat")
minetest.register_on_chat_message(function(name, message)
message = message:gsub("%%", "%%%%")
if not minetest.check_player_privs(name, {caps=true}) then
local m
if minetest.format_chat_message then
m = minetest.format_chat_message(name, message:lower())
else
m = ("<%s> %s"):format(name, message:lower())
end
minetest.chat_send_all(m)
return true
end
end)
if minetest.global_exists("irc") and irc.playerMessage then
local old_irc_playerMessage = irc.playerMessage
function irc.playerMessage(name, message)
if not minetest.check_player_privs(name, {caps=true}) then
message = message:lower()
end
return old_irc_playerMessage(name, message)
end
end
if minetest.global_exists("irc2") and irc2.playerMessage then
local old_irc2_playerMessage = irc2.playerMessage
function irc2.playerMessage(name, message)
if not minetest.check_player_privs(name, {caps=true}) then
message = message:lower()
end
return old_irc2_playerMessage(name, message)
end
end