From f91af02c456589406f5e25d5a3a7529daf2b209f Mon Sep 17 00:00:00 2001
From: stujones11 <stujones111@gmail.com>
Date: Sun, 19 Mar 2017 18:06:54 +0000
Subject: [PATCH] Fix inventory paging bugs caused by previous commit

---
 3d_armor/init.lua | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/3d_armor/init.lua b/3d_armor/init.lua
index 0ab0558..f0e9ecd 100644
--- a/3d_armor/init.lua
+++ b/3d_armor/init.lua
@@ -76,7 +76,10 @@ if minetest.get_modpath("inventory_plus") then
 	armor:register_on_update(function(player)
 		local name = player:get_player_name()
 		local formspec = armor:get_armor_formspec(name, true)
-		inventory_plus.set_inventory_formspec(player, formspec)
+		local page = player:get_inventory_formspec()
+		if page:find("detached:"..name.."_armor") then
+			inventory_plus.set_inventory_formspec(player, formspec)
+		end
 	end)
 	if minetest.get_modpath("crafting") then
 		inventory_plus.get_formspec = function(player, page)
@@ -132,14 +135,7 @@ elseif minetest.get_modpath("sfinv") then
 	armor.inv_mod = "sfinv"
 	armor.formspec = armor_formpage
 	armor:register_on_update(function(player)
-		if sfinv.set_page then
-			sfinv.set_page(player, "3d_armor:armor")
-		else
-			-- Backwards compat
-			sfinv.set_player_inventory_formspec(player, {
-				page = "3d_armor:armor"
-			})
-		end
+		sfinv.set_player_inventory_formspec(player)
 	end)
 	sfinv.register_page("3d_armor:armor", {
 		title = "Armor",