Guest User

Untitled

a guest
Apr 30th, 2017
25
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.yhl;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Material;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.inventory.InventoryClickEvent;
  9. import org.bukkit.event.inventory.InventoryCloseEvent;
  10. import org.bukkit.inventory.ItemStack;
  11.  
  12. public class ListenerClass implements Listener {
  13. AnimationTimer at = new AnimationTimer(Miner.getInstance());
  14.  
  15.  
  16.  
  17. @EventHandler
  18. public void onClose(InventoryCloseEvent e) {
  19.  
  20. at.t.put(e.getInventory(), false);
  21. return;
  22. }
  23.  
  24. @SuppressWarnings("static-access")
  25. @EventHandler
  26. public void onInventoryInteract(InventoryClickEvent e){
  27. Player p = (Player) e.getWhoClicked();
  28. at.t.put(e.getInventory(), false);
  29.  
  30.  
  31. if(e.getInventory().getTitle().equals(ChatColor.GOLD + "" + ChatColor.BOLD + p.getName() + "'s Miner")){
  32.  
  33. if(e.getSlot() == 29){
  34.  
  35. if(e.getInventory().getItem(29).getType() == Material.DIAMOND_BLOCK){
  36.  
  37. at.t.put(e.getInventory(), false);
  38. p.sendMessage(" " + at.t.get(e.getInventory()));
  39. e.getInventory().setItem(29, new ItemStack(Material.REDSTONE_BLOCK));
  40.  
  41. } else if (e.getInventory().getItem(29).getType() == Material.REDSTONE_BLOCK){
  42.  
  43. at.t.put(e.getInventory(), true);
  44. p.sendMessage(" " + at.t.get(e.getInventory()));
  45. e.getInventory().setItem(29, new ItemStack(Material.DIAMOND_BLOCK));
  46.  
  47. }
  48.  
  49.  
  50. }
  51.  
  52. if(e.getSlot() == 31){
  53.  
  54.  
  55.  
  56. if(e.getCurrentItem().getType() == Material.COAL){
  57.  
  58. at.getItem(Material.IRON_INGOT, "&7&lIRON", e.getInventory(), 31);
  59. p.updateInventory();
  60. } else if(e.getCurrentItem().getType() == Material.IRON_INGOT){
  61.  
  62. at.getItem(Material.GOLD_INGOT, "&6&lGOLD", e.getInventory(), 31);
  63. } else if(e.getCurrentItem().getType() == Material.GOLD_INGOT){
  64.  
  65. at.getItem(Material.DIAMOND, "&3&lDIAMOND", e.getInventory(), 31);
  66. } else if(e.getCurrentItem().getType() == Material.DIAMOND){
  67.  
  68. at.getItem(Material.COAL, "&4&lCOAL", e.getInventory(), 31);
  69. }
  70. }
  71.  
  72. e.setCancelled(true);
  73. }
  74. }
  75.  
  76.  
  77. }
RAW Paste Data Copied