Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Inventory getAM(final FileConfiguration config, final String path, final Player player, final PlaceholderReplacer loreReplacer) {
- Menu menu = new Menu(player,Commons.getInstance().getColorUtil().color(config.getString(path+".Title")),Integer.parseInt(config.getString(path+".Size")));
- Inventory gui = menu.createMenu();
- final ConfigurationSection menuSection = config.getConfigurationSection(path);
- for (String keys : config.getConfigurationSection(path + ".Borders").getKeys(false)) {
- ItemStack border = Commons.getInstance().getUtils().getItemFromConfig(config, path + ".Borders." + keys).parse();
- Iterator iterator = config.getIntegerList(path + ".Borders." + keys + ".Slots").iterator();
- while (iterator.hasNext()) {
- int i = (Integer) iterator.next();
- gui.setItem(i, border);
- }
- }
- final ConfigurationSection configItems = config.getConfigurationSection(path+".Items");
- configItems.getKeys(false).forEach(key -> {
- ItemStack inventoryItem = getQItemFromConfig(config, path+".Items."+key, loreReplacer);
- gui.setItem(config.getInt(path+".Items."+key+".Slot"), inventoryItem);
- });
- return gui;
- }
- public ItemStack getQItemFromConfig(final FileConfiguration config, final String path, final PlaceholderReplacer loreReplacer) {
- ItemStack item;
- final ItemBuilder itemBuilder = new ItemBuilder(config.getString(path + ".Material", "BARRIER"), 1).setDurability(config.get(path + ".Durability", 0)).setGlow(config.getBoolean(path + ".Glow", false)).setName(config.getString(path + ".Name", "Invalid Name")).setLore(config.getStringList(path + ".Lore")).setSkull(config.getString(path + ".Skull", "")).setAmount(config.getInt(path + ".Amount", 1)).setColor(config.getInt(path + ".Color", 5));
- item = itemBuilder.parse();
- ItemMeta meta = item.getItemMeta();
- List<String> lore = meta.getLore();
- for (String string : lore) {
- if (loreReplacer != null) {
- string = loreReplacer.parse(string);
- List<String> newLore= new ArrayList<>();
- newLore.add(string);
- meta.setLore(newLore);
- } else {
- meta.setLore(lore);
- }
- }
- item.setItemMeta(meta);
- return item;
- }
Add Comment
Please, Sign In to add comment