Only update skins page if on skins page

This commit is contained in:
Wuzzy 2019-10-24 13:48:52 +02:00
parent 7bfa3c1766
commit 18344863b2
1 changed files with 5 additions and 7 deletions

View File

@ -212,13 +212,11 @@ minetest.register_chatcommand(
player_skins.set_skin(name, param)
local form = player_skins.get_formspec(name)
local player = minetest.get_player_by_name(name)
if player then
--[[ This updates inventory menu to make sure the
checkmark is updated. However, it will force-change
the inventory menu page to skins, even when sth else
was selected. This is a minor annoyance, but not a big problem.
TODO: Only do this when we're on the skins page. ]]
player:set_inventory_formspec(form)
if player and default.ui.current_page[name] then
if default.ui.current_page[name] == "player_skins:player_skins" then
-- This updates inventory menu to make sure the checkmark is updated
player:set_inventory_formspec(form)
end
end
return true, S("Skin set to “@1”.", param)
elseif param == "" then