Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.09 KB | None | 0 0
  1. package net.austriaminer.InventoryClick;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import org.bukkit.Material;
  7. import org.bukkit.Sound;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.event.EventHandler;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.inventory.InventoryClickEvent;
  12.  
  13. import de.Schraubi.Coins.CoinAPI;
  14. import net.austriaminer.main;
  15. import net.austriaminer.MySQL.SQLAustriaminer;
  16. import net.austriaminer.MySQL.SQLDerMeinieLp;
  17. import net.austriaminer.MySQL.SQLKuchenLauch;
  18. import net.austriaminer.utils.items;
  19. import net.austriaminer.utils.items.Items;
  20.  
  21. public class Köpfe implements Listener{
  22. @SuppressWarnings("unchecked")
  23.  
  24. @EventHandler
  25. public void onClick(InventoryClickEvent e)
  26. {
  27. try
  28. {
  29. Player p = (Player)e.getWhoClicked();
  30. if (e.getClickedInventory().getName().equalsIgnoreCase("§aKöpfe")) {
  31. e.setCancelled(true);
  32. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§4§oKuchenLauch"))
  33. {
  34. if (SQLKuchenLauch.getAktiv(p.getUniqueId().toString()).intValue() == 0)
  35. {
  36. if (CoinAPI.getCoins(p.getUniqueId().toString()) >= 1000)
  37. {
  38. SQLKuchenLauch.setAktiv(p.getUniqueId().toString(), Integer.valueOf(1));
  39. CoinAPI.removeCoins(p.getUniqueId().toString(), 1000);
  40. p.sendMessage(main.prefix + "§7Du hast §4§oKuchenLauch §7erfolgreich gekauft!");
  41. p.closeInventory();
  42. p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.0F, 1.0F);
  43. }
  44. else
  45. {
  46. p.sendMessage(main.prefix + "§cDu hast nicht genügend Coins!");
  47. p.playSound(p.getLocation(), Sound.BAT_DEATH, 1.0F, 1.0F);
  48. }
  49. }
  50. else if (SQLKuchenLauch.getAktiv(p.getUniqueId().toString()).intValue() == 1)
  51. {
  52. if (p.getInventory().getItem(8).getType() == Material.BARRIER)
  53. {
  54. @SuppressWarnings({ "rawtypes"})
  55. List<String> lore = new ArrayList();
  56. lore.add("§bBeschreibung:");
  57. lore.add("§7Team Lauch");
  58. p.getInventory().setItem(8, items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
  59. p.getInventory().setHelmet(items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
  60. p.sendMessage(main.prefix + "§7Du hast §aKuchenLauch §f§7aktiviert");
  61. p.closeInventory();
  62. return;
  63. }
  64. if (p.getInventory().getItem(8) != null) {
  65. if (p.getInventory().getItem(8).getItemMeta().getDisplayName().equalsIgnoreCase("§4§oKuchenLauch"))
  66. {
  67. p.getInventory().setBoots(null);
  68. p.getInventory().setChestplate(null);
  69. p.getInventory().setHelmet(null);
  70. p.getInventory().setLeggings(null);
  71. p.getInventory().setItem(8, Items.createItem(Material.BARRIER, "§cKein Gadget ausgewählt", true, 1));
  72. p.sendMessage(main.prefix + "§cDu hast §4§oKuchenLauch §f§cdeaktiviert");
  73. p.closeInventory();
  74. }
  75. else
  76. {
  77. @SuppressWarnings({ "rawtypes"})
  78. List<String> lore = new ArrayList();
  79. lore.add("§bBeschreibung:");
  80. lore.add("§7Team Lauch");
  81. p.getInventory().setBoots(null);
  82. p.getInventory().setChestplate(null);
  83. p.getInventory().setHelmet(items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
  84. p.getInventory().setLeggings(null);
  85. p.getInventory().setItem(8, items.createHeadWithLore("KuchenLauch", "§4§oKuchenLauch", lore));
  86. p.sendMessage(main.prefix + "§7Du hast dein Gadget geändert");
  87.  
  88. }
  89. }
  90. }
  91. }else if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§4§oDerMeinieLp"))
  92. {
  93. if (SQLDerMeinieLp.getAktiv(p.getUniqueId().toString()).intValue() == 0)
  94. {
  95. if (CoinAPI.getCoins(p.getUniqueId().toString()) >= 1000)
  96. {
  97. SQLDerMeinieLp.setAktiv(p.getUniqueId().toString(), Integer.valueOf(1));
  98. CoinAPI.removeCoins(p.getUniqueId().toString(), 1000);
  99. p.sendMessage(main.prefix + "§7Du hast §4§oDerMeinieLp §7erfolgreich gekauft!");
  100. p.closeInventory();
  101. p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.0F, 1.0F);
  102. }
  103. else
  104. {
  105. p.sendMessage(main.prefix + "§cDu hast nicht genügend Coins!");
  106. p.playSound(p.getLocation(), Sound.BAT_DEATH, 1.0F, 1.0F);
  107. }
  108. }
  109. else if (SQLDerMeinieLp.getAktiv(p.getUniqueId().toString()).intValue() == 1)
  110. {
  111. if (p.getInventory().getItem(8).getType() == Material.BARRIER)
  112. {
  113. @SuppressWarnings({ "rawtypes"})
  114. List<String> lore = new ArrayList();
  115. lore.add("§bBeschreibung:");
  116. lore.add("§7Team Owener");
  117. p.getInventory().setItem(8, items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore ));
  118. p.getInventory().setHelmet(items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore));
  119. p.sendMessage(main.prefix + "§7Du hast §4§oDerMeinieLp §f§7aktiviert");
  120. p.closeInventory();
  121. return;
  122. }
  123. if (p.getInventory().getItem(8) != null) {
  124. if (p.getInventory().getItem(8).getItemMeta().getDisplayName().equalsIgnoreCase("§4§oDerMeinieLp"))
  125. {
  126. p.getInventory().setBoots(null);
  127. p.getInventory().setChestplate(null);
  128. p.getInventory().setHelmet(null);
  129. p.getInventory().setLeggings(null);
  130. p.getInventory().setItem(8, Items.createItem(Material.BARRIER, "§cKein Gadget ausgewählt", true, 1));
  131. p.sendMessage(main.prefix + "§cDu hast §4§oDerMeinieLp §f§cdeaktiviert");
  132. p.closeInventory();
  133. }
  134. else
  135. {
  136. @SuppressWarnings({ "rawtypes"})
  137. List<String> lore = new ArrayList();
  138. lore.add("§bBeschreibung:");
  139. lore.add("§7Team Owner");
  140. p.getInventory().setBoots(null);
  141. p.getInventory().setChestplate(null);
  142. p.getInventory().setHelmet(items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore));
  143. p.getInventory().setLeggings(null);
  144. p.getInventory().setItem(8, items.createHeadWithLore("DerMeinieLp", "§4§oDerMeinieLp", lore));
  145. p.sendMessage(main.prefix + "§7Du hast dein Gadget geändert");
  146.  
  147. }
  148. }
  149. }
  150. }else if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§4§oAustriaminer"))
  151. {
  152. if (SQLAustriaminer.getAktiv(p.getUniqueId().toString()).intValue() == 0)
  153. {
  154. if (CoinAPI.getCoins(p.getUniqueId().toString()) >= 1000)
  155. {
  156. SQLAustriaminer.setAktiv(p.getUniqueId().toString(), Integer.valueOf(1));
  157. CoinAPI.removeCoins(p.getUniqueId().toString(), 1000);
  158. p.sendMessage(main.prefix + "§7Du hast §4§oAustriaminer §7erfolgreich gekauft!");
  159. p.closeInventory();
  160. p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.0F, 1.0F);
  161. }
  162. else
  163. {
  164. p.sendMessage(main.prefix + "§cDu hast nicht genügend Coins!");
  165. p.playSound(p.getLocation(), Sound.BAT_DEATH, 1.0F, 1.0F);
  166. }
  167. }
  168. else if (SQLAustriaminer.getAktiv(p.getUniqueId().toString()).intValue() == 1)
  169. {
  170. if (p.getInventory().getItem(8).getType() == Material.BARRIER)
  171. {
  172. @SuppressWarnings({ "rawtypes"})
  173. List<String> lore = new ArrayList();
  174. lore.add("§bBeschreibung:");
  175. lore.add("§7Team Miner");
  176. p.getInventory().setItem(8, items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore ));
  177. p.getInventory().setHelmet(items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore));
  178. p.sendMessage(main.prefix + "§7Du hast §aAustriaminer §f§7aktiviert");
  179. p.closeInventory();
  180. return;
  181. }
  182. if (p.getInventory().getItem(8) != null) {
  183. if (p.getInventory().getItem(8).getItemMeta().getDisplayName().equalsIgnoreCase("§4§oAustriaminer"))
  184. {
  185. p.getInventory().setBoots(null);
  186. p.getInventory().setChestplate(null);
  187. p.getInventory().setHelmet(null);
  188. p.getInventory().setLeggings(null);
  189. p.getInventory().setItem(8, Items.createItem(Material.BARRIER, "§cKein Gadget ausgewählt", true, 1));
  190. p.sendMessage(main.prefix + "§cDu hast §4§oAustriaminer §f§cdeaktiviert");
  191. p.closeInventory();
  192. }
  193. else
  194. {
  195. @SuppressWarnings({ "rawtypes"})
  196. List<String> lore = new ArrayList();
  197. lore.add("§bBeschreibung:");
  198. lore.add("§7Team Miner");
  199. p.getInventory().setBoots(null);
  200. p.getInventory().setChestplate(null);
  201. p.getInventory().setHelmet(items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore));
  202. p.getInventory().setLeggings(null);
  203. p.getInventory().setItem(8, items.createHeadWithLore("Austriaminer", "§4§oAustriaminer", lore));
  204. p.sendMessage(main.prefix + "§7Du hast dein Gadget geändert");
  205.  
  206. }
  207. }
  208. }
  209. }
  210. }
  211. }
  212. catch (Exception localException) {}
  213. }
  214. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement