use of io.github.wysohn.triggerreactor.bukkit.bridge.BukkitItemStack in project TriggerReactor by wysohn.
the class InventoryTriggerManager method parseItemsList.
@SuppressWarnings("unchecked")
private void parseItemsList(ConfigurationSection itemSection, Map<Integer, IItemStack> items, int size) {
for (int i = 0; i < size; i++) {
ConfigurationSection section = itemSection.getConfigurationSection(String.valueOf(i));
if (section == null)
continue;
Material type = Material.valueOf((String) section.get("Type", Material.DIRT.name()));
int amount = section.getInt("Amount", 1);
short data = (short) section.getInt("Data", 0);
ItemMeta IM = (ItemMeta) section.get("Meta");
ItemStack IS = new ItemStack(type, amount, data);
if (IM == null)
IM = IS.getItemMeta();
if (IM != null) {
// leave these for backward compatibility
String title = section.getString("Title", null);
Object lore = section.get("Lore", null);
if (title != null)
IM.setDisplayName(title);
if (lore != null && lore instanceof List)
IM.setLore((List<String>) lore);
IS.setItemMeta(IM);
}
items.put(i, new BukkitItemStack(IS));
}
}
Aggregations