From 640871d6964fb82ddb3adf31b9958800c0593fe9 Mon Sep 17 00:00:00 2001 From: Svenja Reissaus Date: Thu, 2 Aug 2018 15:05:39 -0300 Subject: [PATCH] Double check to prevent /f upgrades items showing up when disabled --- .../zcore/fupgrades/FUpgradesGUI.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java index d87eecac..4e269cdc 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java @@ -37,22 +37,29 @@ public void openMainMenu(FPlayer fme) { inventory.setItem(dummySlots.get(i), dummyItem); } ItemStack[] items = buildItems(fme); - List cropSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots"); - for (int i = 0; i <= cropSlots.size() - 1; i++) { - inventory.setItem(cropSlots.get(i), items[2]); - } List spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); - for (int i = 0; i <= spawnerSlots.size() - 1; i++) { - inventory.setItem(spawnerSlots.get(i), items[1]); - } List expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); - for (int i = 0; i <= expSlots.size() - 1; i++) { - inventory.setItem(expSlots.get(i), items[0]); - } List chestSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots"); - for (int i = 0; i <= chestSlots.size() - 1; i++) { - inventory.setItem(chestSlots.get(i), items[3]); + if (cropSlots != -1) { + for (int i = 0; i <= cropSlots.size() - 1; i++) { + inventory.setItem(cropSlots.get(i), items[2]); + } + } + if (spawnerSlots != -1) { + for (int i = 0; i <= spawnerSlots.size() - 1; i++) { + inventory.setItem(spawnerSlots.get(i), items[1]); + } + } + if (expSlots != -1) { + for (int i = 0; i <= expSlots.size() - 1; i++) { + inventory.setItem(expSlots.get(i), items[0]); + } + } + if (chestSlots != -1) { + for (int i = 0; i <= chestSlots.size() - 1; i++) { + inventory.setItem(chestSlots.get(i), items[3]); + } } fme.getPlayer().openInventory(inventory); }