Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.40 KB | None | 0 0
  1. package Listener;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Material;
  5. import org.bukkit.Sound;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.block.Action;
  10. import org.bukkit.event.inventory.InventoryClickEvent;
  11. import org.bukkit.event.player.PlayerInteractEvent;
  12. import org.bukkit.inventory.Inventory;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.inventory.meta.ItemMeta;
  15.  
  16. public class Schwerter implements Listener {
  17.  
  18. @EventHandler
  19. public void onInteract(PlayerInteractEvent e){
  20. Player p = e.getPlayer();
  21. if(e.getClickedBlock().getType() == Material.DIAMOND_BLOCK){
  22. if(e.getAction() == Action.RIGHT_CLICK_BLOCK){
  23. p.sendMessage("§7Du hast das Inventar §bgeöffnet!");
  24. Inventory inv = Bukkit.createInventory(null, 27, "§bSchwerter");
  25.  
  26. ItemStack Schwert = new ItemStack(Material.WOOD_SWORD);
  27. ItemMeta SM = Schwert.getItemMeta();
  28. SM.setDisplayName("§bHolzschwert");
  29. Schwert.setItemMeta(SM);
  30. inv.setItem(10, Schwert);
  31.  
  32.  
  33.  
  34. ItemStack Schwert1 = new ItemStack(Material.GOLD_SWORD);
  35. ItemMeta SM1 = Schwert1.getItemMeta();
  36. SM1.setDisplayName("§bGoldschwert");
  37. Schwert1.setItemMeta(SM1);
  38. inv.setItem(12, Schwert1);
  39.  
  40. ItemStack Schwert2 = new ItemStack(Material.IRON_SWORD);
  41. ItemMeta SMS1 = Schwert2.getItemMeta();
  42. SMS1.setDisplayName("§bEisenschwert");
  43. Schwert2.setItemMeta(SMS1);
  44. inv.setItem(14, Schwert2);
  45.  
  46. ItemStack Schwert3 = new ItemStack(Material.DIAMOND_SWORD);
  47. ItemMeta SMS2 = Schwert3.getItemMeta();
  48. SMS2.setDisplayName("§bDiamantschwert");
  49. Schwert3.setItemMeta(SMS2);
  50. inv.setItem(16, Schwert3);
  51.  
  52. ItemStack Glas = new ItemStack(Material.STAINED_GLASS_PANE);
  53. ItemMeta SM2 = Glas.getItemMeta();
  54. SM2.setDisplayName("§b");
  55. Glas.setItemMeta(SM2);
  56. inv.setItem(0, Glas);
  57.  
  58. ItemStack Glas1 = new ItemStack(Material.STAINED_GLASS_PANE);
  59. ItemMeta SM3 = Glas1.getItemMeta();
  60. SM3.setDisplayName("§b");
  61. Glas1.setItemMeta(SM3);
  62. inv.setItem(1, Glas1);
  63.  
  64. ItemStack Glas2 = new ItemStack(Material.STAINED_GLASS_PANE);
  65. ItemMeta SM4 = Glas2.getItemMeta();
  66. SM4.setDisplayName("§b");
  67. Glas2.setItemMeta(SM4);
  68. inv.setItem(2, Glas2);
  69.  
  70. ItemStack Glas3 = new ItemStack(Material.STAINED_GLASS_PANE);
  71. ItemMeta SM5 = Glas3.getItemMeta();
  72. SM5.setDisplayName("§b");
  73. Glas3.setItemMeta(SM5);
  74. inv.setItem(3, Glas3);
  75.  
  76. ItemStack Glas4 = new ItemStack(Material.STAINED_GLASS_PANE);
  77. ItemMeta SM6 = Glas4.getItemMeta();
  78. SM6.setDisplayName("§b");
  79. Glas4.setItemMeta(SM6);
  80. inv.setItem(4, Glas4);
  81.  
  82. ItemStack Glas5 = new ItemStack(Material.STAINED_GLASS_PANE);
  83. ItemMeta SM7 = Glas4.getItemMeta();
  84. SM7.setDisplayName("§b");
  85. Glas5.setItemMeta(SM7);
  86. inv.setItem(5, Glas5);
  87.  
  88. ItemStack Glas6 = new ItemStack(Material.STAINED_GLASS_PANE);
  89. ItemMeta SM8 = Glas6.getItemMeta();
  90. SM8.setDisplayName("§b");
  91. Glas6.setItemMeta(SM8);
  92. inv.setItem(6, Glas6);
  93.  
  94. ItemStack Glas7 = new ItemStack(Material.STAINED_GLASS_PANE);
  95. ItemMeta SM9 = Glas7.getItemMeta();
  96. SM9.setDisplayName("§b");
  97. Glas7.setItemMeta(SM9);
  98. inv.setItem(7, Glas7);
  99.  
  100. ItemStack Glas8 = new ItemStack(Material.STAINED_GLASS_PANE);
  101. ItemMeta SM10 = Glas8.getItemMeta();
  102. SM10.setDisplayName("§b");
  103. Glas8.setItemMeta(SM10);
  104. inv.setItem(8, Glas8);
  105.  
  106. ItemStack Glas9 = new ItemStack(Material.STAINED_GLASS_PANE);
  107. ItemMeta SM11 = Glas9.getItemMeta();
  108. SM11.setDisplayName("§b");
  109. Glas9.setItemMeta(SM11);
  110. inv.setItem(9, Glas9);
  111.  
  112. ItemStack Glas10 = new ItemStack(Material.STAINED_GLASS_PANE);
  113. ItemMeta SM12 = Glas10.getItemMeta();
  114. SM12.setDisplayName("§b");
  115. Glas10.setItemMeta(SM12);
  116. inv.setItem(11, Glas10);
  117.  
  118. ItemStack Glas11 = new ItemStack(Material.STAINED_GLASS_PANE);
  119. ItemMeta SM13 = Glas11.getItemMeta();
  120. SM13.setDisplayName("§b");
  121. Glas11.setItemMeta(SM13);
  122. inv.setItem(13, Glas11);
  123.  
  124. ItemStack Glas12 = new ItemStack(Material.STAINED_GLASS_PANE);
  125. ItemMeta SM14 = Glas12.getItemMeta();
  126. SM14.setDisplayName("§b");
  127. Glas12.setItemMeta(SM14);
  128. inv.setItem(15, Glas12);
  129.  
  130. ItemStack Glas13 = new ItemStack(Material.STAINED_GLASS_PANE);
  131. ItemMeta SM15 = Glas13.getItemMeta();
  132. SM15.setDisplayName("§b");
  133. Glas13.setItemMeta(SM15);
  134. inv.setItem(17, Glas13);
  135.  
  136. ItemStack Glas14 = new ItemStack(Material.STAINED_GLASS_PANE);
  137. ItemMeta SM16 = Glas14.getItemMeta();
  138. SM16.setDisplayName("§b");
  139. Glas14.setItemMeta(SM16);
  140. inv.setItem(18, Glas14);
  141.  
  142. ItemStack Glas15 = new ItemStack(Material.STAINED_GLASS_PANE);
  143. ItemMeta SM17 = Glas15.getItemMeta();
  144. SM17.setDisplayName("§b");
  145. Glas15.setItemMeta(SM17);
  146. inv.setItem(19, Glas15);
  147.  
  148. ItemStack Glas16 = new ItemStack(Material.STAINED_GLASS_PANE);
  149. ItemMeta SM18 = Glas16.getItemMeta();
  150. SM18.setDisplayName("§b");
  151. Glas16.setItemMeta(SM18);
  152. inv.setItem(20, Glas16);
  153.  
  154. ItemStack Glas17 = new ItemStack(Material.STAINED_GLASS_PANE);
  155. ItemMeta SM19 = Glas17.getItemMeta();
  156. SM19.setDisplayName("§b");
  157. Glas17.setItemMeta(SM19);
  158. inv.setItem(21, Glas17);
  159.  
  160. ItemStack Glas18 = new ItemStack(Material.STAINED_GLASS_PANE);
  161. ItemMeta SM20 = Glas18.getItemMeta();
  162. SM20.setDisplayName("§b");
  163. Glas18.setItemMeta(SM20);
  164. inv.setItem(22, Glas18);
  165.  
  166. ItemStack Glas19 = new ItemStack(Material.STAINED_GLASS_PANE);
  167. ItemMeta SM21 = Glas19.getItemMeta();
  168. SM21.setDisplayName("§b");
  169. Glas19.setItemMeta(SM21);
  170. inv.setItem(23, Glas19);
  171.  
  172. ItemStack Glas20 = new ItemStack(Material.STAINED_GLASS_PANE);
  173. ItemMeta SM22 = Glas20.getItemMeta();
  174. SM22.setDisplayName("§b");
  175. Glas20.setItemMeta(SM22);
  176. inv.setItem(24, Glas20);
  177.  
  178. ItemStack Glas21 = new ItemStack(Material.STAINED_GLASS_PANE);
  179. ItemMeta SM23 = Glas21.getItemMeta();
  180. SM23.setDisplayName("§b");
  181. Glas21.setItemMeta(SM23);
  182. inv.setItem(25, Glas21);
  183.  
  184. ItemStack Slime = new ItemStack(Material.SLIME_BALL);
  185. ItemMeta SMS = Slime.getItemMeta();
  186. SMS.setDisplayName("§aWeiter");
  187. Slime.setItemMeta(SMS);
  188. inv.setItem(26, Slime);
  189.  
  190. p.openInventory(inv);
  191. p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
  192.  
  193.  
  194.  
  195.  
  196. }}}
  197. @EventHandler
  198. public void onClick(InventoryClickEvent e){
  199. Player p = (Player) e.getWhoClicked();
  200. if(e.getInventory().getName().equals("§bSchwerter")){
  201. e.setCancelled(true);
  202. if(e.getCurrentItem().getType() == Material.WOOD_SWORD){
  203. p.sendMessage("§7Du hast ein §bHolzschwert §7erhalten!");
  204. p.playSound(p.getLocation(), Sound.LEVEL_UP, 4, 4);
  205. p.closeInventory();
  206. ItemStack Schwert = new ItemStack(Material.WOOD_SWORD);
  207. p.getInventory().addItem(Schwert);
  208.  
  209. if(e.getInventory().getName().equals("§bSchwerter")){
  210. e.setCancelled(true);
  211. if(e.getCurrentItem().getType() == Material.GOLD_SWORD){
  212. p.sendMessage("§7Du hast ein §bGoldschwert §7erhalten!");
  213. p.playSound(p.getLocation(), Sound.LEVEL_UP, 4, 4);
  214. p.closeInventory();
  215. ItemStack Schwert1 = new ItemStack(Material.GOLD_SWORD);
  216. p.getInventory().addItem(Schwert1);
  217.  
  218.  
  219.  
  220.  
  221. }}}}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement