diff --git a/common.lua b/common.lua index 21dc47c..f8ffd30 100644 --- a/common.lua +++ b/common.lua @@ -1,8 +1,14 @@ beerchat.has_player_muted_player = function(name, other_name) + -- ignore muting for jailed users + if beerchat.is_player_jailed(name) then + return false + end local player = minetest.get_player_by_name(name) -- check jic method is used incorrectly - if not player then return true end + if not player then + return true + end local key = "beerchat:muted:" .. other_name local meta = player:get_meta() @@ -15,7 +21,15 @@ beerchat.is_player_subscribed_to_channel = function(name, channel) end -- is_player_subscribed_to_channel beerchat.send_message = function(name, message, channel) + local jailed = beerchat.is_player_jailed(name) + local is_jail_channel = channel == beerchat.jail_channel_name + if jailed and not is_jail_channel then + return + end minetest.chat_send_player(name, message) + if is_jail_channel then + return + end -- TODO: read player settings for channel sounds if beerchat.enable_sounds and channel ~= beerchat.main_channel_name then minetest.sound_play(beerchat.channel_message_sound, { to_player = name, gain = beerchat.sounds_default_gain } ) diff --git a/init.lua b/init.lua index 543934e..203d48e 100644 --- a/init.lua +++ b/init.lua @@ -41,11 +41,11 @@ beerchat = { } local MP = minetest.get_modpath("beerchat") +dofile(MP.."/jail.lua") dofile(MP.."/common.lua") dofile(MP.."/format_message.lua") dofile(MP.."/hooks.lua") dofile(MP.."/storage.lua") -dofile(MP.."/jail.lua") dofile(MP.."/session.lua") dofile(MP.."/pm.lua") dofile(MP.."/hash.lua")