Fix player tracking.
Previously, on servers without or with non-standard join messages, you would have to run /status any time someone in a channel joined or left. Chat channels will now also search players that are visible to the client.
This commit is contained in:
parent
53fbd7e6d9
commit
6b58d8ddc2
18
init.lua
18
init.lua
|
@ -76,7 +76,17 @@ chat_channels.get_channel_users = function(c)
|
|||
return false
|
||||
end
|
||||
elseif prefix == '@' then
|
||||
if not connected_players[name] then return {} end
|
||||
if not connected_players[name] then
|
||||
local empty = true
|
||||
local visible_players = minetest.get_player_names()
|
||||
for _, player in ipairs(visible_players) do
|
||||
if player == name then
|
||||
empty = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if empty then return {} end
|
||||
end
|
||||
return {name}
|
||||
else
|
||||
show_main_channel = true
|
||||
|
@ -152,9 +162,11 @@ minetest.register_on_sending_chat_messages(function(msg)
|
|||
then
|
||||
local players = chat_channels.get_channel_users(msg)
|
||||
if players and msg ~= '@' and msg:sub(1, 2) ~= '@/' then
|
||||
local empty = true
|
||||
local empty = true
|
||||
local visible_players = minetest.get_player_names()
|
||||
for p = 1, #players do
|
||||
if connected_players[players[p]] then
|
||||
if connected_players[players[p]]
|
||||
or visible_players[players[p]] then
|
||||
empty = false
|
||||
break
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue