Improved and translatable client version check
This commit is contained in:
parent
47bee9dbae
commit
7de30c0886
@ -75,7 +75,6 @@ end
|
||||
|
||||
for k, v in pairs(minetest) do nodecore[k .. "_raw"] = v end
|
||||
|
||||
include("compat_clientversion")
|
||||
include("compat_creative")
|
||||
include("compat_issue10127")
|
||||
include("compat_legacyent")
|
||||
@ -133,3 +132,4 @@ include("item_groupdump")
|
||||
include("item_tiledump")
|
||||
|
||||
include("setup_serverversion")
|
||||
include("setup_clientversion")
|
||||
|
@ -1,6 +1,8 @@
|
||||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local minetest
|
||||
= minetest
|
||||
local minetest, nodecore, string
|
||||
= minetest, nodecore, string
|
||||
local string_format
|
||||
= string.format
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
|
||||
local minproto = 41
|
||||
@ -8,17 +10,23 @@ local minrelease = "5.6"
|
||||
|
||||
local rejected = {}
|
||||
|
||||
local kickmsg = string_format("\n\n%s\n%s",
|
||||
nodecore.translate("Your Minetest version is outdated, please update!"),
|
||||
nodecore.translate("Version @1 or higher is required.", minrelease))
|
||||
|
||||
local announce = "@1 rejected. (protocol version @2)"
|
||||
nodecore.translate_inform(announce)
|
||||
|
||||
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")
|
||||
minetest.kick_player(pname, kickmsg)
|
||||
return minetest.after(0, function()
|
||||
return minetest.chat_send_all("*** " .. pname
|
||||
.. " rejected. (protocol version "
|
||||
.. (pinfo and pinfo.protocol_version or "unknown") .. ")")
|
||||
return minetest.chat_send_all("*** "
|
||||
.. nodecore.translate(announce, pname,
|
||||
pinfo and pinfo.protocol_version or "unknown"))
|
||||
end)
|
||||
else
|
||||
rejected[pname] = nil
|
Loading…
x
Reference in New Issue
Block a user