Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Commit

Permalink
[_misc & chatplus] Unlock shout's system, and fix noshout
Browse files Browse the repository at this point in the history
 - Fix noshout message not being sent
 - Fix chatplus to block messages when people dont' have the shout privilege
 - Translate the greeting messages
  • Loading branch information
Lymkwi committed Sep 26, 2015
1 parent d9e0c72 commit aebd448
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion mods/_misc/give_initial_stuff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ minetest.register_on_newplayer(function(player)
player:get_inventory():add_item('main', 'moreblocks:all_faces_tree 99')
end
end)

7 changes: 3 additions & 4 deletions mods/_misc/irc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,22 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "irc" then return end
local name = player:get_player_name()
if fields.accept then
minetest.chat_send_player(name, "Merci d'avoir accepte les regles, vous etes maintenant capable de parler.")
minetest.chat_send_player(name, "Pour plus d'informations tapez /news")
minetest.chat_send_player(name, "Thank you for agreeing, have a nice time playing!")
minetest.chat_send_player(name, "For more informations type /news")
local privs = minetest.get_player_privs(name)
privs.shout = true
minetest.set_player_privs(name, privs)
--end
return
elseif fields.decline then
minetest.kick_player(name, "Aurevoir ! Vous devez accepter les regles de l'irc pour jouer sur le serveur (revennez si vous changez d'avis).")
minetest.kick_player(name, "Good bye ! You need to accept the irc's rules to player on the server (come back if you change your mind).")
return
end
end)

minetest.register_chatcommand("irc",{
params = "",
description = "Montre les regles de l'irc",
privs = {spawn=true},
func = function (name,params)
local player = minetest.get_player_by_name(name)
minetest.after(1, function()
Expand Down
2 changes: 1 addition & 1 deletion mods/_misc/noshout_messages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end

minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
if not minetest.check_player_privs(name, {interact=true}) and players[name] == nil then
if minetest.check_player_privs(name, {shout=false}) and players[name] == nil then
minetest.after(5, tick, name)
players[name] = true
end
Expand Down
4 changes: 4 additions & 0 deletions mods/chatplus/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ function chatplus.send(from, msg)
return false
end

if not minetest.get_player_privs(from).shout then
return false
end

-- Log chat message
if chatplus.log_handle ~= nil then
chatplus.log_handle:write(
Expand Down

0 comments on commit aebd448

Please sign in to comment.