Advertisement
Guest User

AlphaShopInventory Class

a guest
Jan 17th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 21.59 KB | None | 0 0
  1. package com.infinity.survival.story;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.Material;
  9. import org.bukkit.enchantments.Enchantment;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.event.EventHandler;
  12. import org.bukkit.event.Listener;
  13. import org.bukkit.event.inventory.InventoryClickEvent;
  14. import org.bukkit.event.inventory.InventoryCloseEvent;
  15. import org.bukkit.inventory.Inventory;
  16. import org.bukkit.inventory.ItemStack;
  17. import org.bukkit.inventory.meta.ItemMeta;
  18. import org.bukkit.inventory.meta.SkullMeta;
  19.  
  20. import com.infinity.survival.Main;
  21. import com.rit.sucy.EnchantmentAPI;
  22.  
  23. public class AlphaShopInventory implements Listener{
  24.  
  25.     List<Player> confirm_list = new ArrayList<Player>();
  26.     List<Player> draco_confirm_list = new ArrayList<Player>();
  27.     List<Player> triskull_confirm_list = new ArrayList<Player>();
  28.    
  29.     //Item Places
  30.     public static Inventory shopInventory = Bukkit.createInventory(null, 54, "The Alpha's Shop");
  31.     static{
  32.        
  33.         List<String> llore = new ArrayList<String>();
  34.         llore.add(ChatColor.GREEN + "Lapis Lazuli is my 2nd favorite mineral.");
  35.         llore.add(ChatColor.GREEN + "If you want, by some from me!");
  36.         ItemStack lapisore = new ItemStack(Material.LAPIS_ORE, 5);
  37.         ItemMeta lom = lapisore.getItemMeta();
  38.         lom.setLore(llore);
  39.         lom.setDisplayName(ChatColor.BLUE + "Lapis For XPCurrency");
  40.         lapisore.setItemMeta(lom);
  41.         shopInventory.setItem(2, lapisore);
  42.         shopInventory.setItem(6, lapisore);
  43.        
  44.         List<String> kslore = new ArrayList<String>();
  45.         kslore.add(ChatColor.GREEN + "A common sword used by Alpha Knights");
  46.         ItemStack ksword = createItem(Material.IRON_SWORD, ChatColor.BLUE + "Alpha Knight Sword", true, kslore);
  47.         EnchantmentAPI.getEnchantment("Sharpness+").addToItem(ksword, 5);
  48.         shopInventory.setItem(11, ksword);
  49.        
  50.         List<String> khlore = new ArrayList<String>();
  51.         khlore.add(ChatColor.GREEN + "A helmet used by Alpha Knights.");
  52.         ItemStack khelm = createItem(Material.IRON_HELMET, ChatColor.BLUE + "Alpha Knight Helmet", true, khlore);
  53.         EnchantmentAPI.getEnchantment("Protection+").addToItem(khelm, 5);
  54.         shopInventory.setItem(12, khelm);
  55.        
  56.         List<String> kclore = new ArrayList<String>();
  57.         kclore.add(ChatColor.GREEN + "A chestplate used by Alpha Knights");
  58.         ItemStack kchest = createItem(Material.IRON_CHESTPLATE, ChatColor.BLUE + "Alpha Knight Chestplate", true, kclore);
  59.         EnchantmentAPI.getEnchantment("Protection+").addToItem(kchest, 5);
  60.         shopInventory.setItem(13, kchest);
  61.        
  62.         List<String> kllore = new ArrayList<String>();
  63.         kllore.add(ChatColor.GREEN + "Leggings used by Alpha Knights");
  64.         ItemStack klegs = createItem(Material.IRON_LEGGINGS, ChatColor.BLUE + "Alpha Knight Leggings", true, kllore);
  65.         EnchantmentAPI.getEnchantment("Protection+").addToItem(klegs, 5);
  66.         shopInventory.setItem(14, klegs);
  67.        
  68.         List<String> kblore = new ArrayList<String>();
  69.         kblore.add(ChatColor.GREEN + "A pair of boots used by Alpha Knights");
  70.         ItemStack kboots = createItem(Material.IRON_BOOTS, ChatColor.BLUE + "Alpha Knight Boots", true, kblore);
  71.         EnchantmentAPI.getEnchantment("Protection+").addToItem(kboots, 5);
  72.         shopInventory.setItem(15, kboots);
  73.        
  74.         List<String> alslore = new ArrayList<String>();
  75.         alslore.add(ChatColor.GREEN + "The mighty sword that helped Alexander");
  76.         alslore.add(ChatColor.GREEN + "overcome the World, that has slain");
  77.         alslore.add(ChatColor.GREEN + "many men!");
  78.         ItemStack alsword = createItem(Material.IRON_SWORD, ChatColor.GOLD + "Alexander's Sword", true, alslore);
  79.         EnchantmentAPI.getEnchantment("Sharpness+").addToItem(alsword, 10);
  80.         alsword.addEnchantment(Enchantment.DURABILITY, 3);
  81.         shopInventory.setItem(20, alsword);
  82.        
  83.         List<String> alhlore = new ArrayList<String>();
  84.         alhlore.add(ChatColor.GRAY + "The helmet of Alexander the Great!");
  85.         ItemStack alhelm = createItem(Material.CHAINMAIL_HELMET, "Royal Helmet", true, alhlore);
  86.         EnchantmentAPI.getEnchantment("Protection+").addToItem(alhelm, 10);
  87.         alhelm.addEnchantment(Enchantment.DURABILITY, 3);
  88.         shopInventory.setItem(21, alhelm);
  89.        
  90.         List<String> alclore = new ArrayList<String>();
  91.         alclore.add(ChatColor.GRAY + "The awesome chestplate of Alexander");
  92.         alclore.add(ChatColor.GRAY + "the Great!");
  93.         ItemStack alchest = createItem(Material.CHAINMAIL_CHESTPLATE, "Royal Chestplate", true, alclore);
  94.         alchest.addEnchantment(Enchantment.DURABILITY, 3);
  95.         EnchantmentAPI.getEnchantment("Protection+").addToItem(alchest, 10);
  96.         shopInventory.setItem(22, alchest);
  97.        
  98.         List<String> alllore = new ArrayList<String>();
  99.         alllore.add(ChatColor.GRAY + "The leggings donned many times by");
  100.         alllore.add(ChatColor.GRAY + "Alexander the Great!");
  101.         ItemStack allegs = createItem(Material.CHAINMAIL_LEGGINGS, "Royal Leggings", true, alllore);
  102.         allegs.addEnchantment(Enchantment.DURABILITY, 3);
  103.         EnchantmentAPI.getEnchantment("Protection+").addToItem(allegs, 10);
  104.         shopInventory.setItem(23, allegs);
  105.        
  106.         List<String> alblore = new ArrayList<String>();
  107.         alblore.add(ChatColor.GRAY + "The steel-hard boots of Alexander");
  108.         alblore.add(ChatColor.GRAY + "the Great!");
  109.         ItemStack alboots = createItem(Material.CHAINMAIL_BOOTS, "Royal Boots", true, alblore);
  110.         alboots.addEnchantment(Enchantment.DURABILITY, 3);
  111.         EnchantmentAPI.getEnchantment("Protection+").addToItem(alboots, 10);
  112.         shopInventory.setItem(24, alboots);
  113.        
  114.         List<String> fslore = new ArrayList<String>();
  115.         fslore.add(ChatColor.GREEN + "A sword once used by Helios,");
  116.         fslore.add(ChatColor.GREEN + "it is sure to burn down your foes!");
  117.         ItemStack fsword = createItem(Material.GOLD_SWORD, ChatColor.GOLD + "Flaming Sword", true, fslore);
  118.         fsword.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 5);
  119.         EnchantmentAPI.getEnchantment("Sharpness+").addToItem(fsword, 15);
  120.         fsword.addUnsafeEnchantment(Enchantment.DURABILITY, 12);
  121.         shopInventory.setItem(29, fsword);
  122.        
  123.         List<String> sblore = new ArrayList<String>();
  124.         sblore.add(ChatColor.GREEN + "A pair of boots used by Helios!");
  125.         ItemStack sboots = createItem(Material.GOLD_BOOTS, ChatColor.RED + "Burning Boots", true, sblore);
  126.         EnchantmentAPI.getEnchantment("Flame Coat").addToItem(sboots, 5);
  127.         EnchantmentAPI.getEnchantment("Protection+").addToItem(sboots, 15);
  128.         sboots.addUnsafeEnchantment(Enchantment.DURABILITY, 12);
  129.         shopInventory.setItem(33, sboots);
  130.        
  131.         List<String> sllore = new ArrayList<String>();
  132.         sllore.add(ChatColor.GREEN + "Leggings used by Helios!");
  133.         ItemStack sleggings = createItem(Material.GOLD_LEGGINGS, ChatColor.RED + "Past-Flaming Pants", true, sllore);
  134.         EnchantmentAPI.getEnchantment("Flame Coat").addToItem(sleggings, 5);
  135.         EnchantmentAPI.getEnchantment("Protection+").addToItem(sleggings, 15);
  136.         sleggings.addUnsafeEnchantment(Enchantment.DURABILITY, 12);
  137.         shopInventory.setItem(32, sleggings);
  138.        
  139.         List<String> sclore = new ArrayList<String>();
  140.         sclore.add(ChatColor.GREEN + "A chestplate used by Helios!");
  141.         ItemStack schest = createItem(Material.GOLD_CHESTPLATE, ChatColor.RED + "Sizziling Chestplate", true, sclore);
  142.         EnchantmentAPI.getEnchantment("Flame Coat").addToItem(schest, 5);
  143.         EnchantmentAPI.getEnchantment("Protection+").addToItem(schest, 15);
  144.         schest.addUnsafeEnchantment(Enchantment.DURABILITY, 12);
  145.         shopInventory.setItem(31, schest);
  146.        
  147.         List<String> shlore = new ArrayList<String>();
  148.         shlore.add(ChatColor.GREEN + "A helmet used by Helios!");
  149.         ItemStack shelm = createItem(Material.GOLD_HELMET, ChatColor.RED + "Heated Helmet", true, shlore);
  150.         EnchantmentAPI.getEnchantment("Flame Coat").addToItem(shelm, 5);
  151.         EnchantmentAPI.getEnchantment("Protection+").addToItem(shelm, 15);
  152.         shelm.addUnsafeEnchantment(Enchantment.DURABILITY, 12);
  153.         shopInventory.setItem(30, shelm);
  154.        
  155.         ItemStack balance = new ItemStack(Material.EXP_BOTTLE);
  156.         ItemMeta bmeta = balance.getItemMeta();
  157.         bmeta.setDisplayName(ChatColor.GOLD + "Currency XP Balance");
  158.         List<String> balance_lore = new ArrayList<String>();
  159.         balance_lore.add(ChatColor.GREEN + "Click this to see your XPCurrency balance.");
  160.         bmeta.setLore(balance_lore);
  161.         balance.setItemMeta(bmeta);
  162.         shopInventory.setItem(4, balance);
  163.        
  164.         ItemStack netherstar = new ItemStack(Material.NETHER_STAR);
  165.         ItemMeta nsmeta = netherstar.getItemMeta();
  166.         nsmeta.setDisplayName(ChatColor.GRAY + "General TriSkull's Heart Trade");
  167.         List<String> nslore = new ArrayList<String>();
  168.         nslore.add(ChatColor.GREEN + "If General TriSkull's Heart is in your hand,");
  169.         nslore.add(ChatColor.GREEN + "I'll trade for it!");
  170.         nsmeta.setLore(nslore);
  171.         netherstar.setItemMeta(nsmeta);
  172.         shopInventory.setItem(5, netherstar);
  173.        
  174.         ItemStack skull = new ItemStack(Material.SKULL_ITEM);
  175.         SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
  176.         skull.setDurability((short) 3);
  177.         skullMeta.setOwner("KingEnderman");
  178.         skull.setItemMeta(skullMeta);
  179.         ItemMeta skullIMeta = skull.getItemMeta();
  180.         skullIMeta.setDisplayName(ChatColor.RED + "General Draco's Head");
  181.         List<String> slore = new ArrayList<String>();
  182.         slore.add(ChatColor.GREEN + "If General Draco's Head is in your hand,");
  183.         slore.add(ChatColor.GREEN + "I'll trade for it!");
  184.         skullMeta.setLore(slore);
  185.         skull.setItemMeta(skullIMeta);
  186.         shopInventory.setItem(3, skull);
  187.        
  188.         ItemStack dsword = new ItemStack(Material.DIAMOND_SWORD);
  189.         ItemMeta dsmeta = dsword.getItemMeta();
  190.         dsmeta.setDisplayName("" + ChatColor.GREEN + ChatColor.BOLD + "The Delta Sword");
  191.         List<String> dslore = new ArrayList<String>();
  192.         dslore.add(ChatColor.GOLD + "The Delta Sword contains the ancient ");
  193.         dslore.add(ChatColor.GOLD + "forbidden power to damage a immortal.");
  194.         dsmeta.setLore(dslore);
  195.         dsword.setItemMeta(dsmeta);
  196.         EnchantmentAPI.getEnchantment("Sharpness+").addToItem(dsword, 10);
  197.         dsword.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
  198.         dsword.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);
  199.         EnchantmentAPI.getEnchantment("Alpha's Blessing").addToItem(dsword, 1);
  200.         shopInventory.setItem(38, dsword);
  201.        
  202.         ItemStack ahelmet = new ItemStack(Material.DIAMOND_HELMET);
  203.         ItemMeta ahmeta = ahelmet.getItemMeta();
  204.         ahmeta.setDisplayName(ChatColor.BLUE + "The Alpha's Helmet");
  205.         List<String> ahlore = new ArrayList<String>();
  206.         ahlore.add(ChatColor.GOLD + "A helmet blessed by the Alpha herself.");
  207.         ahmeta.setLore(ahlore);
  208.         ahelmet.setItemMeta(ahmeta);
  209.         ahelmet.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 19);
  210.         ahelmet.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
  211.         EnchantmentAPI.getEnchantment("Alpha's Blessing").addToItem(ahelmet, 1);
  212.         shopInventory.setItem(39, ahelmet);
  213.        
  214.         ItemStack achest = new ItemStack(Material.DIAMOND_CHESTPLATE);
  215.         ItemMeta acmeta = achest.getItemMeta();
  216.         acmeta.setDisplayName(ChatColor.BLUE + "The Alpha's Chestplate");
  217.         List<String> aclore = new ArrayList<String>();
  218.         aclore.add(ChatColor.GOLD + "A chestplate blessed by the Alpha herself.");
  219.         acmeta.setLore(aclore);
  220.         achest.setItemMeta(acmeta);
  221.         achest.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 19);
  222.         achest.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
  223.         EnchantmentAPI.getEnchantment("Alpha's Blessing").addToItem(achest, 1);
  224.         shopInventory.setItem(40, achest);
  225.        
  226.         ItemStack alegs = new ItemStack(Material.DIAMOND_LEGGINGS);
  227.         ItemMeta almeta = alegs.getItemMeta();
  228.         almeta.setDisplayName(ChatColor.BLUE + "The Alpha's Leggings");
  229.         List<String> allore = new ArrayList<String>();
  230.         allore.add(ChatColor.GOLD + "Leggings that are blessed by the Alpha herself.");
  231.         almeta.setLore(allore);
  232.         alegs.setItemMeta(almeta);
  233.         alegs.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 19);
  234.         alegs.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
  235.         EnchantmentAPI.getEnchantment("Alpha's Blessing").addToItem(alegs, 1);
  236.         shopInventory.setItem(41, alegs);
  237.        
  238.         ItemStack aboots = new ItemStack(Material.DIAMOND_BOOTS);
  239.         ItemMeta abmeta = aboots.getItemMeta();
  240.         abmeta.setDisplayName(ChatColor.BLUE + "The Alpha's Boots");
  241.         List<String> ablore = new ArrayList<String>();
  242.         ablore.add(ChatColor.GOLD + "A pair of boots blessed by the Alpha herself.");
  243.         abmeta.setLore(ablore);
  244.         aboots.setItemMeta(abmeta);
  245.         aboots.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 19);
  246.         aboots.addUnsafeEnchantment(Enchantment.DURABILITY, 4);
  247.         EnchantmentAPI.getEnchantment("Alpha's Blessing").addToItem(aboots, 1);
  248.         shopInventory.setItem(42, aboots);
  249.        
  250.     }
  251.    
  252.     @EventHandler
  253.     public void inventoryClickEvent(InventoryClickEvent e){
  254.        
  255.         Player p = (Player) e.getWhoClicked();
  256.         ItemStack clicked = e.getCurrentItem();
  257.         Inventory inventory = e.getInventory();
  258.        
  259.         if(inventory.getName().equals(shopInventory.getName())){
  260.             if(clicked.getType() != null || clicked.getType() != Material.AIR){
  261.                
  262.                 e.setCancelled(true);
  263.                
  264.                 Material type = clicked.getType();
  265.                
  266.                 if(type == Material.DIAMOND_HELMET){
  267.                     buyItem(p, clicked, 5000);
  268.                 }else if(type == Material.DIAMOND_CHESTPLATE){
  269.                     buyItem(p, clicked, 8000);
  270.                 }else if(type == Material.DIAMOND_LEGGINGS){
  271.                     buyItem(p, clicked, 7000);
  272.                 }else if(type == Material.DIAMOND_BOOTS){
  273.                     buyItem(p, clicked, 4000);
  274.                 }else if(type == Material.DIAMOND_SWORD){
  275.                     buyItem(p, clicked, 10000);
  276.                 }else if(type == Material.EXP_BOTTLE){
  277.                     p.sendMessage(StoryCommand.alphatag + "You have " + Main.instance.getConfig().getLong(p.getUniqueId() + ".XPCurrency") + " XP Currnecy.");
  278.                 }else if(type == Material.SKULL_ITEM || type == Material.NETHER_STAR){
  279.                     bossTrade(p, p.getItemInHand());
  280.                 }else if(type == Material.GOLD_HELMET){
  281.                     buyItem(p, clicked, 2250);
  282.                 }else if(type == Material.GOLD_CHESTPLATE){
  283.                     buyItem(p, clicked, 3950);
  284.                 }else if(type == Material.GOLD_LEGGINGS){
  285.                     buyItem(p, clicked, 2950);
  286.                 }else if(type == Material.GOLD_BOOTS){
  287.                     buyItem(p, clicked, 1800);
  288.                 }else if(type == Material.GOLD_SWORD){
  289.                     buyItem(p, clicked, 4250);
  290.                 }else if(type == Material.CHAINMAIL_HELMET){
  291.                     buyItem(p, clicked, 1550);
  292.                 }else if(type == Material.CHAINMAIL_CHESTPLATE){
  293.                     buyItem(p, clicked, 3200);
  294.                 }else if(type == Material.CHAINMAIL_LEGGINGS){
  295.                     buyItem(p, clicked, 2560);
  296.                 }else if(type == Material.CHAINMAIL_BOOTS){
  297.                     buyItem(p, clicked, 1000);
  298.                 }else if(type == Material.IRON_SWORD){
  299.                     if(clicked.getItemMeta().getDisplayName().equals(ChatColor.GOLD + "Alexander's Sword")){
  300.                         buyItem(p, clicked, 3375);
  301.                     }else{
  302.                         buyItem(p, clicked, 325);
  303.                     }
  304.                 }else if(type == Material.IRON_HELMET){
  305.                     buyItem(p, clicked, 515);
  306.                 }else if(type == Material.IRON_CHESTPLATE){
  307.                     buyItem(p, clicked, 1050);
  308.                 }else if(type == Material.IRON_LEGGINGS){
  309.                     buyItem(p, clicked, 850);
  310.                 }else if(type == Material.IRON_BOOTS){
  311.                     buyItem(p, clicked, 300);
  312.                 }else if(type == Material.LAPIS_ORE){
  313.                     buyItem(p, clicked, 75);
  314.                 }
  315.                
  316.             }
  317.         }
  318.        
  319.     }
  320.    
  321.     public void buyItem(Player p, ItemStack item, int price){
  322.         long xpCurrency = Main.instance.getConfig().getLong(p.getUniqueId() + ".XPCurrency");
  323.         if(xpCurrency < price){
  324.             long remaining = price - xpCurrency;
  325.             p.sendMessage(StoryCommand.alphatag + "I'm sorry, but you don't have enough XP Currency to buy this! You need " + ChatColor.AQUA + remaining + ChatColor.RED + " more XPCurrency to buy this!");
  326.         }else{
  327.             if(confirm_list.contains(p)){
  328.                 p.sendMessage(StoryCommand.alphatag + "Thank you for your purchase!");
  329.                 p.getInventory().addItem(item);
  330.                 Main.instance.getConfig().set(p.getUniqueId() + ".XPCurrency", xpCurrency - price);
  331.                 p.closeInventory();
  332.                 confirm_list.remove(p);
  333.             }else if(!confirm_list.contains(p)){
  334.                 p.sendMessage(StoryCommand.alphatag + "You chose the " + item.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GREEN + " which is priced at " + ChatColor.AQUA + price + " Currency XP" + ChatColor.GREEN + ".");
  335.                 p.sendMessage(StoryCommand.alphatag + "Are you sure you want to do this? If you are, click this item again. If you don't, exit the inventory.");
  336.                 confirm_list.add(p);
  337.             }
  338.         }
  339.     }
  340.    
  341.     public void bossTrade(Player p, ItemStack item){
  342.         if(item.getType() == Material.NETHER_STAR){
  343.             if(EnchantmentAPI.itemHasEnchantment(item, "Evil Aura")){
  344.                 if(triskull_confirm_list.contains(p)){
  345.                     p.getInventory().removeItem(item);
  346.                     Main.instance.getConfig().set(p.getUniqueId() + ".XPCurrency", Main.instance.getConfig().getLong(p.getUniqueId() + ".XPCurrency") + 100);
  347.                     Main.instance.saveConfig();
  348.                     Main.instance.reloadConfig();
  349.                     p.sendMessage(StoryCommand.alphatag + "Thank you for the heart. Here's your XPCurrency. Pleasure doing business with you.");
  350.                 }else{
  351.                     triskull_confirm_list.add(p);
  352.                     p.sendMessage(StoryCommand.alphatag + "You have General TriSkull's heart? Very impressive. If you allow me, I'll buy it for 100 XPCurrency.");
  353.                     p.sendMessage(StoryCommand.alphatag + "If you want me to buy it, click the Nether Star again. If not, close the inventory.");
  354.                 }
  355.             }else{
  356.                 p.sendMessage(StoryCommand.alphatag + "I'm sorry, but this is not General TriSkull's heart. Yet it seems... similar.");
  357.             }
  358.         }else if(item.getType() == Material.SKULL_ITEM){
  359.             if(EnchantmentAPI.itemHasEnchantment(item, "Evil Aura")){
  360.                 if(draco_confirm_list.contains(p)){
  361.                     p.getInventory().removeItem(item);
  362.                     Main.instance.getConfig().set(p.getUniqueId() + ".XPCurrency", Main.instance.getConfig().getLong(p.getUniqueId() + ".XPCurrency") + 250);
  363.                     Main.instance.saveConfig();
  364.                     Main.instance.reloadConfig();
  365.                     p.sendMessage(StoryCommand.alphatag + "Thank you for the head. Here's your XPCurrency. Pleasure doing business with you.");
  366.                 }else{
  367.                     draco_confirm_list.add(p);
  368.                     p.sendMessage(StoryCommand.alphatag + "You have General Draco's head? I'm astonished! If you allow me, I'll buy it for 250 XPCurrency.");
  369.                     p.sendMessage(StoryCommand.alphatag + "If you want me to buy it, click General Draco's head again. If not, close the inventory.");
  370.                 }
  371.             }else{
  372.                 p.sendMessage(StoryCommand.alphatag + "I'm sorry, but this is not General Draco's head.");
  373.             }
  374.         }else{
  375.             p.sendMessage(StoryCommand.alphatag + "I'm sorry, but you don't have General TriSkull's heart or General Draco's head!");
  376.         }
  377.     }
  378.    
  379.     public static ItemStack createItem(Material type, String name, boolean hasLore, List<String> lore){
  380.         ItemStack item = new ItemStack(type);
  381.         ItemMeta imeta = item.getItemMeta();
  382.         imeta.setDisplayName(name);
  383.         if(hasLore == true){
  384.             imeta.setLore(lore);
  385.         }
  386.         item.setItemMeta(imeta);
  387.         return item;
  388.     }
  389.    
  390.     @EventHandler
  391.     public void inventoryClose(InventoryCloseEvent e){
  392.         if(e.getInventory().getName().equals(shopInventory.getName())){
  393.             Player p = (Player) e.getPlayer();
  394.             if(confirm_list.contains(p)){
  395.                 confirm_list.remove(p);
  396.             }
  397.             if(draco_confirm_list.contains(p)){
  398.                 draco_confirm_list.remove(p);
  399.             }
  400.             if(triskull_confirm_list.contains(p)){
  401.                 triskull_confirm_list.remove(p);
  402.             }
  403.         }
  404.     }
  405.    
  406. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement