diff --git a/mods/boxes/nodes.lua b/mods/boxes/nodes.lua index fb40f7c..41aca88 100644 --- a/mods/boxes/nodes.lua +++ b/mods/boxes/nodes.lua @@ -434,7 +434,11 @@ local function grant_perks(box_id, boxes) end end if accepted >= 3 then - local limit = tonumber(builder:get_attribute("box_create_limit") or "3") + local player = minetest.get_player_by_name(builder) + if not player then + return + end + local limit = tonumber(player:get_attribute("box_create_limit") or "3") if limit <= 3 then minetest.log("perks: granted more boxes to " .. builder) announce.all(builder .. " has been granted the more boxes perk!") @@ -452,7 +456,7 @@ local function grant_perks(box_id, boxes) "--sofar" } }) - builder:set_attribute("box_create_limit", "5") + player:set_attribute("box_create_limit", "5") end end if accepted >= 5 then