Creative: Fix '-' glitch in playername

Fix the glitch when players use the '-' character in their username
on a server, causing creative inventory to not pass page 2
This commit is contained in:
tenplus1 2016-05-06 15:14:38 +01:00 committed by paramat
parent 8ea031ef77
commit 3976dc6a5b

View File

@ -194,8 +194,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
creative.set_creative_formspec(player, 0) creative.set_creative_formspec(player, 0)
else else
local formspec = player:get_inventory_formspec() local formspec = player:get_inventory_formspec()
local start_i = formspec:match("list%[.-" .. player_name .. ";.-;(%d+)%]") local start_i = player_inventory[player_name].start_i or 0
start_i = tonumber(start_i) or 0
if fields.creative_prev then if fields.creative_prev then
start_i = start_i - 3*8 start_i = start_i - 3*8
@ -212,6 +211,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
player_inventory[player_name].start_i = start_i
creative.set_creative_formspec(player, start_i) creative.set_creative_formspec(player, start_i)
end end
end) end)