Untitled
String item = config.getString("spawner.item"); Material material = Material.matchMaterial(item); ItemStack mobFarmBlock = new ItemStack(material, amount); ItemMeta meta = mobFarmBlock.getItemMeta(); if (meta != null) { meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString("spawner.name"))); meta.setLore(new ArrayList<>()); List<String> lore = config.getStringList("spawner.lore").stream() .map(line -> ChatColor.translateAlternateColorCodes('&', line)) .collect(Collectors.toList()); meta.setLore(lore); if (config.getBoolean("spawner.enchanted")) { meta.addItemFlags(ItemFlag.HIDE_ENCHANTS); meta.addEnchant(Enchantment.INFINITY, 1, true); } mobFarmBlock.setItemMeta(meta); } return mobFarmBlock;
Leave a Comment