Skip to content

Commit

Permalink
Creative: Fix '-' glitch in playername
Browse files Browse the repository at this point in the history
Fix the glitch when players use the '-' character in their username
on a server, causing creative inventory to not pass page 2
  • Loading branch information
tenplus1 authored and paramat committed May 7, 2016
1 parent 8ea031e commit 3976dc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mods/creative/init.lua
Expand Up @@ -194,8 +194,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
creative.set_creative_formspec(player, 0)
else
local formspec = player:get_inventory_formspec()
local start_i = formspec:match("list%[.-" .. player_name .. ";.-;(%d+)%]")
start_i = tonumber(start_i) or 0
local start_i = player_inventory[player_name].start_i or 0

if fields.creative_prev then
start_i = start_i - 3*8
Expand All @@ -212,6 +211,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end

player_inventory[player_name].start_i = start_i
creative.set_creative_formspec(player, start_i)
end
end)
Expand Down

0 comments on commit 3976dc6

Please sign in to comment.