Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Gui {
- public void shopGui (Player sender) {
- String mainShop = getConfig().getString("Settings.Main Shop");
- Logger log = Bukkit.getLogger();
- log.info("Started the function");
- log.info(mainShop);
- Inventory open = Bukkit.createInventory(sender, 9, getConfig().getString("Shop." + mainShop + ".Name Of Shop"));
- log.info("Created the inventory");
- //Set<String> cmdList = getConfig().getConfigurationSection("Shop." + mainShop + ".Items").getKeys(false);
- for (String key : getConfig().getConfigurationSection("Shop." + mainShop + ".Items").getKeys(false)) {
- log.info("For Looped Around");
- String itemIcon = (String) getConfig().get("Shop." + mainShop + ".Items." + key + ".Icon");
- log.info("got icon name from config");
- ItemStack item = new ItemStack(Material.getMaterial(itemIcon.toUpperCase()), 1);
- log.info("Got the item correctly");
- String itemName = (String) getConfig().get("Shop." + mainShop + ".Items." + key + ".Name Of Item");
- log.info("got the item name from config");
- List<String> itemLore = getConfig().getStringList("Shop." + mainShop + ".Items." + key + ".Lore");
- log.info("Got The Lore");
- open.setItem(getConfig().getInt("Shop." + mainShop + ".Items." + key + ".Slot") - 1, setValues(item, itemName, itemLore));;
- log.info("Put Item In the inventory");
- }
- log.info("Looped through the things");
- sender.openInventory(open);
- }
- public ItemStack setValues(ItemStack item, String name, List<String> lore) {
- for (String string : lore) {
- lore.add(ChatColor.translateAlternateColorCodes('~', string));
- }
- ItemMeta itemMeta = item.getItemMeta();
- Bukkit.getLogger().info("Started the rename process");
- itemMeta.setDisplayName(name);
- Bukkit.getLogger().info("Set The Name Of The Item");
- itemMeta.setLore(lore);
- Bukkit.getLogger().info("Should return item");
- item.setItemMeta(itemMeta);
- return item;
- }
Advertisement
Add Comment
Please, Sign In to add comment