forked from Mineclonia/Mineclonia
Fix malformed client ready packet crashing server
This commit is contained in:
parent
18e299d923
commit
76b6815a7a
|
@ -204,3 +204,26 @@ local test_minetest_find_nodes_in_area_implementation_equivalence = function()
|
|||
end
|
||||
|
||||
minetest.after( 0, test_minetest_find_nodes_in_area_implementation_equivalence )
|
||||
|
||||
--Workaround for Minetest bug #12073
|
||||
-- <https://github.com/minetest/minetest/issues/12073#issuecomment-1039389509>
|
||||
minetest.register_on_joinplayer(function(p)
|
||||
p:get_meta():set_string("joined","true")
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(p)
|
||||
p:get_meta():set_string("joined","")
|
||||
end)
|
||||
|
||||
local function is_real_player(p)
|
||||
if p:get_meta():get("joined") then return true end
|
||||
end
|
||||
|
||||
local mgcp = minetest.get_connected_players
|
||||
|
||||
function minetest.get_connected_players()
|
||||
local pp={}
|
||||
for k,p in pairs(mgcp()) do
|
||||
if is_real_player(p) then table.insert(pp,p) end
|
||||
end
|
||||
return pp
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue