Double check to prevent /f upgrades items showing up when disabled

This commit is contained in:
Svenja Reissaus 2018-08-02 15:05:39 -03:00
parent 5fe55afc68
commit 640871d696

View File

@ -37,23 +37,30 @@ public class FUpgradesGUI implements Listener {
inventory.setItem(dummySlots.get(i), dummyItem); inventory.setItem(dummySlots.get(i), dummyItem);
} }
ItemStack[] items = buildItems(fme); ItemStack[] items = buildItems(fme);
List<Integer> cropSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots"); List<Integer> cropSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots");
List<Integer> spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots");
List<Integer> expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots");
List<Integer> chestSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots");
if (cropSlots != -1) {
for (int i = 0; i <= cropSlots.size() - 1; i++) { for (int i = 0; i <= cropSlots.size() - 1; i++) {
inventory.setItem(cropSlots.get(i), items[2]); inventory.setItem(cropSlots.get(i), items[2]);
} }
List<Integer> spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); }
if (spawnerSlots != -1) {
for (int i = 0; i <= spawnerSlots.size() - 1; i++) { for (int i = 0; i <= spawnerSlots.size() - 1; i++) {
inventory.setItem(spawnerSlots.get(i), items[1]); inventory.setItem(spawnerSlots.get(i), items[1]);
} }
List<Integer> expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); }
if (expSlots != -1) {
for (int i = 0; i <= expSlots.size() - 1; i++) { for (int i = 0; i <= expSlots.size() - 1; i++) {
inventory.setItem(expSlots.get(i), items[0]); inventory.setItem(expSlots.get(i), items[0]);
} }
List<Integer> chestSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots"); }
if (chestSlots != -1) {
for (int i = 0; i <= chestSlots.size() - 1; i++) { for (int i = 0; i <= chestSlots.size() - 1; i++) {
inventory.setItem(chestSlots.get(i), items[3]); inventory.setItem(chestSlots.get(i), items[3]);
} }
}
fme.getPlayer().openInventory(inventory); fme.getPlayer().openInventory(inventory);
} }