public void populateChest(Chest chest, String chestfile) { Inventory inventory = chest.getBlockInventory(); inventory.clear(); int added = 0; Collections.shuffle(randomLoc); if (chestfile.equalsIgnoreCase("op")) { for (ChestItem chestItem : opChestItemList) { if (random.nextInt(100) + 1 <= chestItem.getChance()) { inventory.setItem(randomLoc.get(added), chestItem.getItem()); if (added++ >= inventory.getSize() - 1) { break; } } } } else if (chestfile.equalsIgnoreCase("basic")) { for (ChestItem chestItem : basicChestItemList) { if (random.nextInt(100) + 1 <= chestItem.getChance()) { inventory.setItem(randomLoc.get(added), chestItem.getItem()); if (added++ >= inventory.getSize() - 1) { break; } } } } else { for (ChestItem chestItem : chestItemList) { if (random.nextInt(100) + 1 <= chestItem.getChance()) { inventory.setItem(randomLoc.get(added), chestItem.getItem()); if (added++ >= inventory.getSize() - 1) { break; } } } } }
public void populateDoubleChest(DoubleChest chest, String chestfile) { String type = chestfile; if (SkyWarsReloaded.getCfg().doubleChestAlwaysOP()) type = "op"; Inventory inventory = chest.getInventory(); inventory.clear(); int added = 0; Collections.shuffle(randomDLoc); if (type.equalsIgnoreCase("op")) { for (ChestItem chestItem : opChestItemList) { if (random.nextInt(100) + 1 <= chestItem.getChance()) { inventory.setItem(randomDLoc.get(added), chestItem.getItem()); if (added++ >= inventory.getSize() - 1) { break; } } } } else if (type.equalsIgnoreCase("basic")) { for (ChestItem chestItem : basicChestItemList) { if (random.nextInt(100) + 1 <= chestItem.getChance()) { inventory.setItem(randomDLoc.get(added), chestItem.getItem()); if (added++ >= inventory.getSize() - 1) { break; } } } } else { for (ChestItem chestItem : chestItemList) { if (random.nextInt(100) + 1 <= chestItem.getChance()) { inventory.setItem(randomDLoc.get(added), chestItem.getItem()); if (added++ >= inventory.getSize() - 1) { break; } } } } }