1513d7eb93
This way, at the time the announcement is made, the player has already been kicked, and any mods that check the player list based on this (i.e. szutil_nowonline) will show the correct list.
40 lines
1.2 KiB
Lua
40 lines
1.2 KiB
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local minetest
|
|
= minetest
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
local minproto = 39
|
|
local minrelease = "5.2"
|
|
|
|
local rejected = {}
|
|
|
|
minetest.register_on_joinplayer(function(player)
|
|
local pname = player:get_player_name()
|
|
local pinfo = minetest.get_player_information(pname)
|
|
if (not pinfo) or (pinfo.protocol_version < minproto) then
|
|
rejected[pname] = true
|
|
minetest.kick_player(pname, "Outdated client, "
|
|
.. minrelease .. " required")
|
|
return minetest.after(0, function()
|
|
return minetest.chat_send_all("*** " .. pname
|
|
.. " rejected. (protocol version "
|
|
.. (pinfo and pinfo.protocol_version or "unknown") .. ")")
|
|
end)
|
|
else
|
|
rejected[pname] = nil
|
|
end
|
|
end)
|
|
|
|
local oldjoined = minetest.send_join_message
|
|
function minetest.send_join_message(pname, ...)
|
|
local pinfo = minetest.get_player_information(pname)
|
|
if pinfo.protocol_version < minproto then return end
|
|
return oldjoined(pname, ...)
|
|
end
|
|
|
|
local oldleft = minetest.send_leave_message
|
|
function minetest.send_leave_message(pname, ...)
|
|
if rejected[pname] then return end
|
|
return oldleft(pname, ...)
|
|
end
|