Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 71.34 KB | None | 0 0
  1. package pl.endrju.ytcore.listeners;
  2.  
  3. import org.bukkit.command.*;
  4. import pl.endrju.ytcore.data.base.*;
  5. import org.bukkit.inventory.*;
  6. import org.bukkit.event.*;
  7. import org.bukkit.*;
  8. import pl.endrju.api.*;
  9. import org.bukkit.enchantments.*;
  10. import pl.endrju.ytcore.managers.*;
  11. import pl.endrju.ytcore.data.base.user.*;
  12. import pl.endrju.ytcore.data.base.guild.*;
  13. import pl.endrju.ytcore.commands.cmd.*;
  14. import java.util.*;
  15. import pl.endrju.ytcore.utils.*;
  16. import org.bukkit.inventory.meta.*;
  17. import org.bukkit.entity.*;
  18. import magiccase.managers.*;
  19. import pl.endrju.ytcore.gui.*;
  20. import org.bukkit.event.inventory.*;
  21.  
  22. public class InventoryClickListener implements Listener
  23. {
  24. @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
  25. public void onClickBackup(final InventoryClickEvent e) {
  26. if (e.getInventory().getName().contains(ChatUtil.fixColor("&7Backup'y gracza"))) {
  27. e.setCancelled(true);
  28. e.setResult(Event.Result.DENY);
  29. final Inventory inventory = e.getInventory();
  30. final ItemStack is = e.getCurrentItem();
  31. if (inventory != null) {
  32. if (is == null || !is.hasItemMeta() || is.getItemMeta().getDisplayName() == null) {
  33. return;
  34. }
  35. final Player p = (Player)e.getWhoClicked();
  36. final String name = is.getItemMeta().getLore().get(0).substring(11);
  37. final long time = Long.parseLong(is.getItemMeta().getDisplayName().substring(4));
  38. final Player o = Bukkit.getPlayer(name);
  39. if (o == null) {
  40. ChatUtil.sendMessage((CommandSender)p, "&c&lBlad: &7Gracz offline!");
  41. return;
  42. }
  43. Backup.restore(o, time, this.swich(e), p);
  44. }
  45. }
  46. }
  47.  
  48. @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
  49. public void onClick(final InventoryClickEvent e) {
  50. final Player p = (Player)e.getWhoClicked();
  51. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lItemy na gildie"))) {
  52. e.setCancelled(true);
  53. e.setResult(Event.Result.DENY);
  54. return;
  55. }
  56. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lStatystyki"))) {
  57. e.setCancelled(true);
  58. e.setResult(Event.Result.DENY);
  59. return;
  60. }
  61. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCraftingi"))) {
  62. e.setCancelled(true);
  63. e.setResult(Event.Result.DENY);
  64. final int slot = e.getSlot();
  65. if (slot == 0) {
  66. CraftingUtil.openEndStone(p);
  67. return;
  68. }
  69. if (slot == 2) {
  70. CraftingUtil.openEnderchest(p);
  71. return;
  72. }
  73. if (slot == 4) {
  74. CraftingUtil.openBoy(p);
  75. return;
  76. }
  77. if (slot == 6) {
  78. CraftingUtil.openAntyNogi(p);
  79. return;
  80. }
  81.  
  82. if (slot == 8) {
  83. CraftingUtil.openCow(p);
  84. return;
  85. }
  86.  
  87. if (slot == 13) {
  88. CraftingUtil.openTnt(p);
  89. return;
  90. }
  91. }
  92. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("§c§lSchowek"))) {
  93. e.setCancelled(true);
  94. e.setResult(Event.Result.DENY);
  95. final User u = UserManager.getUser(p);
  96. int koxw = 0;
  97. int refw = 0;
  98. int perlaw = 0;
  99. final int i = ItemStackUtil.getAmountOfItem(Material.GOLDEN_APPLE, p, (short)1);
  100. final int ii = ItemStackUtil.getAmountOfItem(Material.GOLDEN_APPLE, p, (short)0);
  101. final int iii = ItemStackUtil.getAmountOfItem(Material.ENDER_PEARL, p, (short)0);
  102. final int slot2 = e.getSlot();
  103. if (slot2 == 11) {
  104. if (u.getKox() <= 0) {
  105. ChatUtil.sendMessage((CommandSender)p, "&8 &cNie posiadasz koxow do wyplacenia!");
  106. return;
  107. }
  108. if (i >= Config.LIMIT_KOX) {
  109. ChatUtil.sendMessage((CommandSender)p, "&8 &cOsiagneles juz limit koxow!");
  110. return;
  111. }
  112. if (u.getKox() <= Config.LIMIT_KOX) {
  113. refw = u.getKox();
  114. u.removeKox(refw);
  115. u.save();
  116. ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, refw, (short)1).build());
  117. ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " koxy");
  118. SchowekGui.show(p);
  119. return;
  120. }
  121. if (i < Config.LIMIT_KOX) {
  122. final int ref = i - Config.LIMIT_KOX;
  123. koxw = ref * -1;
  124. u.removeKox(koxw);
  125. u.save();
  126. ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, koxw, (short)1).build());
  127. ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + koxw + " koxy");
  128. SchowekGui.show(p);
  129. return;
  130. }
  131. }
  132. if (slot2 == 13) {
  133. if (u.getRefil() <= 0) {
  134. ChatUtil.sendMessage((CommandSender)p, "&8 &cNie posiadasz refow do wyplacenia!");
  135. return;
  136. }
  137. if (ii >= Config.LIMIT_REFILE) {
  138. ChatUtil.sendMessage((CommandSender)p, "&8 &cOsiagneles juz limit refili!");
  139. return;
  140. }
  141. if (u.getRefil() <= Config.LIMIT_REFILE) {
  142. refw = u.getRefil();
  143. u.removeRefil(refw);
  144. u.save();
  145. ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, refw, (short)0).build());
  146. ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " refile");
  147. SchowekGui.show(p);
  148. return;
  149. }
  150. if (ii < Config.LIMIT_REFILE) {
  151. final int ref = ii - Config.LIMIT_REFILE;
  152. refw = ref * -1;
  153. u.removeRefil(refw);
  154. u.save();
  155. ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, refw, (short)0).build());
  156. ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " refile");
  157. SchowekGui.show(p);
  158. return;
  159. }
  160. }
  161. if (slot2 == 15) {
  162. if (u.getPerly() <= 0) {
  163. ChatUtil.sendMessage((CommandSender)p, "&8 &cNie posiadasz perel do wyplacenia!");
  164. return;
  165. }
  166. if (iii >= Config.LIMIT_PEARL) {
  167. ChatUtil.sendMessage((CommandSender)p, "&8 &cOsiagneles juz limit perel!");
  168. return;
  169. }
  170. if (u.getPerly() <= Config.LIMIT_PEARL) {
  171. refw = u.getPerly();
  172. u.removePerly(refw);
  173. u.save();
  174. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_PEARL, refw, (short)0).build());
  175. ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " perly");
  176. SchowekGui.show(p);
  177. return;
  178. }
  179. if (iii < Config.LIMIT_PEARL) {
  180. final int ref = iii - Config.LIMIT_PEARL;
  181. perlaw = ref * -1;
  182. u.removePerly(perlaw);
  183. u.save();
  184. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_PEARL, perlaw, (short)0).build());
  185. ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + perlaw + " perly");
  186. SchowekGui.show(p);
  187. return;
  188. }
  189. }
  190. }
  191. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lKity"))) {
  192. e.setCancelled(true);
  193. e.setResult(Event.Result.DENY);
  194. final User u = UserManager.getUser(p);
  195. final int slot3 = e.getSlot();
  196. if (slot3 == 11) {
  197. if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
  198. ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
  199. return;
  200. }
  201. if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.vip")) {
  202. ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostep! Zakup range!");
  203. return;
  204. }
  205. if (u.isKitVip() && !p.hasPermission("core.cmd.admin")) {
  206. ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit vip mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_vip()));
  207. return;
  208. }
  209. u.setKit_vip(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
  210. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
  211. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
  212. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
  213. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
  214. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  215. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  216. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  217. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  218. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
  219. ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
  220. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
  221. ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit vip!");
  222. p.closeInventory();
  223. return;
  224. }
  225. else if (slot3 == 11) {
  226. if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
  227. ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
  228. return;
  229. }
  230. if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.svip")) {
  231. ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostepu! Zakup range!");
  232. return;
  233. }
  234. if (u.isKitSvip() && !p.hasPermission("core.cmd.admin")) {
  235. ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit svip mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_svip()));
  236. return;
  237. }
  238. u.setKit_svip(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
  239. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
  240. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
  241. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
  242. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
  243. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  244. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  245. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  246. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  247. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
  248. ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
  249. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
  250. ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit svip!");
  251. p.closeInventory();
  252. return;
  253. }
  254. else if (slot3 == 11) {
  255. if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
  256. ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
  257. return;
  258. }
  259. if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.youtibe")) {
  260. ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostepu! Zakup range!");
  261. return;
  262. }
  263. if (u.isKitYouTube() && !p.hasPermission("core.cmd.admin")) {
  264. ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit youtube mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_youtube()));
  265. return;
  266. }
  267. u.setKit_youtube(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
  268. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
  269. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
  270. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
  271. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
  272. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  273. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  274. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  275. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  276. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
  277. ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
  278. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
  279. ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit youtube!");
  280. p.closeInventory();
  281. return;
  282. }
  283. else if (slot3 == 11) {
  284. if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
  285. ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
  286. return;
  287. }
  288. if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.streamer")) {
  289. ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostepu! Zakup range!");
  290. return;
  291. }
  292. if (u.isKitStreamer() && !p.hasPermission("core.cmd.admin")) {
  293. ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit streamer mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_streamer()));
  294. return;
  295. }
  296. u.setKit_streamer(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
  297. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
  298. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
  299. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
  300. ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
  301. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  302. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  303. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  304. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  305. ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
  306. ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
  307. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
  308. ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit streamer!");
  309. p.closeInventory();
  310. return;
  311. }
  312. else if (slot3 == 11) {
  313. if (u.isKitStart() && !p.hasPermission("core.cmd.admin")) {
  314. ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit start mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_start()));
  315. return;
  316. }
  317. u.setKit_start(System.currentTimeMillis() + TimeUtil.HOUR.getTime(1));
  318. ChatUtil.giveItems(p, new ItemStack(Material.IRON_PICKAXE));
  319. ChatUtil.giveItems(p, new ItemStack(Material.IRON_SWORD));
  320. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
  321. ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit start!");
  322. p.closeInventory();
  323. return;
  324. }
  325. else if (slot3 == 11) {
  326. if (u.isKitMieso() && !p.hasPermission("core.cmd.admin")) {
  327. ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit mieso mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_mieso()));
  328. return;
  329. }
  330. u.setKit_mieso(System.currentTimeMillis() + TimeUtil.SECOND.getTime(60));
  331. ChatUtil.giveItems(p, new ItemStack(Material.COOKED_BEEF, 128));
  332. ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit mieso!");
  333. p.closeInventory();
  334. return;
  335. }
  336. }
  337. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 1/6"))) {
  338. e.setCancelled(true);
  339. e.setResult(Event.Result.DENY);
  340. final int slot = e.getSlot();
  341. if (slot == 49) {
  342. CraftingUtil.openMenu(p);
  343. return;
  344. }
  345. if (slot == 19) {
  346. final String cost = "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston";
  347. if (!ItemUtil.checkItems(p, "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston", 1)) {
  348. ItemUtil.getItem(p, "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston", 1);
  349. return;
  350. }
  351. ItemUtil.removeItems(p, "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston", 1);
  352. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
  353. ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles stoniarke!");
  354. p.closeInventory();
  355. return;
  356. }
  357. }
  358. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 2/6"))) {
  359. e.setCancelled(true);
  360. e.setResult(Event.Result.DENY);
  361. final int slot = e.getSlot();
  362. if (slot == 49) {
  363. CraftingUtil.openMenu(p);
  364. return;
  365. }
  366. if (slot == 19) {
  367. final String cost = "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone";
  368. if (!ItemUtil.checkItems(p, "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone", 1)) {
  369. ItemUtil.getItem(p, "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone", 1);
  370. return;
  371. }
  372. ItemUtil.removeItems(p, "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone", 1);
  373. ChatUtil.giveItems(p, new ItemBuilder(Material.BEDROCK, 1).setTitle(ChatUtil.fixColor("&a&lBoyFarmer")).addLore(ChatUtil.fixColor("&6Zmienia 100 blokow pod soba na obsydian")).build());
  374. ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles boyfarmer!");
  375. p.closeInventory();
  376. return;
  377. }
  378. }
  379. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 3/6"))) {
  380. e.setCancelled(true);
  381. e.setResult(Event.Result.DENY);
  382. final int slot = e.getSlot();
  383. if (slot == 49) {
  384. CraftingUtil.openMenu(p);
  385. return;
  386. }
  387. if (slot == 19) {
  388. final String cost = "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone";
  389. if (!ItemUtil.checkItems(p, "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone", 1)) {
  390. ItemUtil.getItem(p, "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone", 1);
  391. return;
  392. }
  393. ItemUtil.removeItems(p, "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone", 1);
  394. ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_PORTAL_FRAME, 1).setTitle(ChatUtil.fixColor("&a&lFosaFarmer")).addLore(ChatUtil.fixColor("&aKopie 100 blokow pod soba")).addLore(ChatUtil.fixColor("&adzieki czemu ty nie musisz sie meczyc :P")).build());
  395. ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles fosafarmer!");
  396. p.closeInventory();
  397. return;
  398. }
  399. }
  400. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 4/5"))) {
  401. e.setCancelled(true);
  402. e.setResult(Event.Result.DENY);
  403. final int slot = e.getSlot();
  404. if (slot == 49) {
  405. CraftingUtil.openMenu(p);
  406. return;
  407. }
  408. if (slot == 19) {
  409. final String cost = "41:0-8:Gold Block;69:0-1:Lever;";
  410. if (!ItemUtil.checkItems(p, "41:0-8:Gold Block;69:0-1:Lever;", 1)) {
  411. ItemUtil.getItem(p, "41:0-8:Gold Block;69:0-1:Lever;", 1);
  412. return;
  413. }
  414. ItemUtil.removeItems(p, "41:0-8:Gold Block;69:0-1:Lever;", 1);
  415. ChatUtil.giveItems(p, new ItemBuilder(Material.NAME_TAG, 1).setTitle(ChatUtil.fixColor("&6&lAnty Nogi")).addLore(ChatUtil.fixColor("")).addLore(ChatUtil.fixColor("&8 &2Kliknij PPM, aby uratowac czlonka gildii!")).addEnchantment(Enchantment.DURABILITY, 2).build());
  416. ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles Anty Nogi");
  417. p.closeInventory();
  418. return;
  419. }
  420. }
  421. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 5/6"))) {
  422. e.setCancelled(true);
  423. e.setResult(Event.Result.DENY);
  424. final int slot = e.getSlot();
  425. if (slot == 49) {
  426. CraftingUtil.openMenu(p);
  427. return;
  428. }
  429. if (slot == 19) {
  430. final String cost = "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone";
  431. if (!ItemUtil.checkItems(p, "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone", 1)) {
  432. ItemUtil.getItem(p, "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone", 1);
  433. return;
  434. }
  435. ItemUtil.removeItems(p, "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone", 1);
  436. ChatUtil.giveItems(p, new ItemBuilder(Material.SANDSTONE, 1).setTitle(ChatUtil.fixColor("&a&lSandFarmer")).addLore(ChatUtil.fixColor("&6Zmienia 100 blokow pod soba na piasek")).build());
  437. ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles sandfarmer!");
  438. p.closeInventory();
  439. return;
  440. }
  441. }
  442. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 6/6"))) {
  443. e.setCancelled(true);
  444. e.setResult(Event.Result.DENY);
  445. final int slot = e.getSlot();
  446. if (slot == 49) {
  447. CraftingUtil.openMenu(p);
  448. return;
  449. }
  450. if (slot == 19) {
  451. final String cost = "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel";
  452. if (!ItemUtil.checkItems(p, "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel", 1)) {
  453. ItemUtil.getItem(p, "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel", 1);
  454. return;
  455. }
  456. ItemUtil.removeItems(p, "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel", 1);
  457. ChatUtil.giveItems(p, new ItemBuilder(Material.TNT, 1).setTitle(ChatUtil.fixColor("&cRzucane TNT")).build());
  458. ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles tnt!");
  459. p.closeInventory();
  460. return;
  461. }
  462. }
  463. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lSprzedaz itemow za coinsy!"))) {
  464. e.setCancelled(true);
  465. e.setResult(Event.Result.DENY);
  466. final User user = UserManager.getUser(p);
  467. final int slot4 = e.getSlot();
  468. if (slot4 == 0) {
  469. if (!p.getInventory().containsAtLeast(new ItemStack(Material.DIRT), 64)) {
  470. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz dirtu! &8(&764 szt.&8)"));
  471. return;
  472. }
  473. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.DIRT, 64) });
  474. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano dirt! &8(&764 szt.&8)!"));
  475. user.addCoins(10);
  476. user.save();
  477. }
  478. if (slot4 == 1) {
  479. if (!p.getInventory().containsAtLeast(new ItemStack(Material.COBBLESTONE), 64)) {
  480. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz cobblestone! &8(&764 szt.&8)"));
  481. return;
  482. }
  483. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.COBBLESTONE, 64) });
  484. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano cobblestone! &8(&764 szt.&8)!"));
  485. user.addCoins(20);
  486. user.save();
  487. }
  488. if (slot4 == 2) {
  489. if (!p.getInventory().containsAtLeast(new ItemStack(Material.getMaterial(17)), 64)) {
  490. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz drewna! &8(&764 szt.&8)"));
  491. return;
  492. }
  493. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.getMaterial(17), 64) });
  494. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano drewno! &8(&764 szt.&8)!"));
  495. user.addCoins(25);
  496. user.save();
  497. }
  498. if (slot4 == 3) {
  499. if (!p.getInventory().containsAtLeast(new ItemStack(Material.WOOD), 64)) {
  500. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz desek! &8(&764 szt.&8)"));
  501. return;
  502. }
  503. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.WOOD, 64) });
  504. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano deski! &8(&764 szt.&8)!"));
  505. user.addCoins(15);
  506. user.save();
  507. }
  508. if (slot4 == 4) {
  509. if (!p.getInventory().containsAtLeast(new ItemStack(Material.DIAMOND), 64)) {
  510. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz diamentow! &8(&764 szt.&8)"));
  511. return;
  512. }
  513. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.DIAMOND, 64) });
  514. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano diamenty! &8(&764 szt.&8)!"));
  515. user.addCoins(40);
  516. user.save();
  517. }
  518. if (slot4 == 5) {
  519. if (!p.getInventory().containsAtLeast(new ItemStack(Material.EMERALD), 64)) {
  520. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz szmaragdow! &8(&764 szt.&8)"));
  521. return;
  522. }
  523. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.EMERALD, 64) });
  524. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano szmaragdy! &8(&764 szt.&8)!"));
  525. user.addCoins(40);
  526. user.save();
  527. }
  528. if (slot4 == 6) {
  529. if (!p.getInventory().containsAtLeast(new ItemStack(Material.IRON_INGOT), 64)) {
  530. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz sztabek zelaza! &8(&764 szt.&8)"));
  531. return;
  532. }
  533. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.IRON_INGOT, 64) });
  534. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano sztabki zelaza! &8(&764 szt.&8)!"));
  535. user.addCoins(25);
  536. user.save();
  537. }
  538. if (slot4 == 7) {
  539. if (!p.getInventory().containsAtLeast(new ItemStack(Material.GOLD_INGOT), 64)) {
  540. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz sztabek zlota! &8(&764 szt.&8)"));
  541. return;
  542. }
  543. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.GOLD_INGOT, 64) });
  544. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano sztabki zlota! &8(&764 szt.&8)!"));
  545. user.addCoins(50);
  546. user.save();
  547. }
  548. if (slot4 == 8) {
  549. if (!p.getInventory().containsAtLeast(new ItemStack(Material.ENDER_PEARL), 16)) {
  550. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz perel! &8(&716 szt.&8)"));
  551. return;
  552. }
  553. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ENDER_PEARL, 16) });
  554. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano perly! &8(&716 szt.&8)!"));
  555. user.addCoins(100);
  556. user.save();
  557. }
  558. if (slot4 == 9) {
  559. if (!p.getInventory().containsAtLeast(new ItemStack(Material.getMaterial(289)), 64)) {
  560. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz prochu! &8(&764 szt.&8)"));
  561. return;
  562. }
  563. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.getMaterial(289), 64) });
  564. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano proch! &8(&764 szt.&8)!"));
  565. user.addCoins(80);
  566. user.save();
  567. }
  568. if (slot4 == 10) {
  569. if (!p.getInventory().containsAtLeast(new ItemStack(Material.STONE), 64)) {
  570. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz kamienia! &8(&764 szt.&8)"));
  571. return;
  572. }
  573. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.STONE, 64) });
  574. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano kamien! &8(&764 szt.&8)!"));
  575. user.addCoins(50);
  576. user.save();
  577. }
  578. if (slot4 == 11) {
  579. if (!p.getInventory().containsAtLeast(new ItemStack(Material.ANVIL), 8)) {
  580. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz kowadel! &8(&78 szt.&8)"));
  581. return;
  582. }
  583. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ANVIL, 8) });
  584. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano kowadla! &8(&78 szt.&8)!"));
  585. user.addCoins(100);
  586. user.save();
  587. }
  588. if (slot4 == 12) {
  589. if (!p.getInventory().containsAtLeast(new ItemStack(Material.APPLE), 64)) {
  590. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz jablek! &8(&764 szt.&8)"));
  591. return;
  592. }
  593. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.APPLE, 64) });
  594. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano jablka! &8(&764 szt.&8)!"));
  595. user.addCoins(150);
  596. user.save();
  597. }
  598. if (slot4 == 13) {
  599. if (!p.getInventory().containsAtLeast(new ItemStack(Material.BOOK), 64)) {
  600. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz ksiazek! &8(&764 szt.&8)"));
  601. return;
  602. }
  603. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.BOOK, 64) });
  604. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano ksiazek! &8(&764 szt.&8)!"));
  605. user.addCoins(100);
  606. user.save();
  607. }
  608. if (slot4 == 14) {
  609. if (!p.getInventory().containsAtLeast(new ItemStack(Material.OBSIDIAN), 64)) {
  610. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz obsydianu! &8(&764 szt.&8)"));
  611. return;
  612. }
  613. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.OBSIDIAN, 64) });
  614. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano obydianu! &8(&764 szt.&8)!"));
  615. user.addCoins(80);
  616. user.save();
  617. }
  618. if (slot4 == 15) {
  619. if (!p.getInventory().containsAtLeast(new ItemStack(Material.ENDER_CHEST), 8)) {
  620. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz enderchestow! &8(&78 szt.&8)"));
  621. return;
  622. }
  623. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ENDER_CHEST, 8) });
  624. p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano enderchest! &8(&78 szt.&8)!"));
  625. user.addCoins(40);
  626. user.save();
  627. }
  628. if (slot4 == 35) {
  629. SklepGui.show(p);
  630. return;
  631. }
  632. }
  633. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lBoosty za coinsy!"))) {
  634. e.setCancelled(true);
  635. e.setResult(Event.Result.DENY);
  636. final User u = UserManager.getUser(p);
  637. final int slot4 = e.getSlot();
  638. if (slot4 == 0) {
  639. if (!Config.ENABLE_WYMIANA) {
  640. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
  641. return;
  642. }
  643. if (p.hasPermission("core.create.vip")) {
  644. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
  645. return;
  646. }
  647. if (u.getLvl() < 50) {
  648. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &650 &7lvl"));
  649. return;
  650. }
  651. if (u.getLvl() > 49) {
  652. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  653. p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, zakladanie gildi za polowe ceny!"));
  654. p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
  655. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  656. u.removeLvl(50);
  657. u.save();
  658. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add core.create.vip");
  659. p.closeInventory();
  660. }
  661. }
  662. if (slot4 == 1) {
  663. if (!Config.ENABLE_WYMIANA) {
  664. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
  665. return;
  666. }
  667. if (p.hasPermission("core.drop.vip")) {
  668. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
  669. return;
  670. }
  671. if (u.getLvl() < 70) {
  672. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &670 &7lvl"));
  673. return;
  674. }
  675. if (u.getLvl() > 69) {
  676. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  677. p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, wiekszy drop!"));
  678. p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
  679. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  680. u.removeLvl(70);
  681. u.save();
  682. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add core.drop.vip");
  683. p.closeInventory();
  684. }
  685. }
  686. if (slot4 == 2) {
  687. if (!Config.ENABLE_WYMIANA) {
  688. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
  689. return;
  690. }
  691. if (p.hasPermission("disco.disco")) {
  692. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
  693. return;
  694. }
  695. if (u.getLvl() < 40) {
  696. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &670 &7lvl"));
  697. return;
  698. }
  699. if (u.getLvl() > 39) {
  700. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  701. p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, DiscoZbroje!"));
  702. p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
  703. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  704. u.removeLvl(40);
  705. u.save();
  706. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add disco.disco");
  707. p.closeInventory();
  708. }
  709. }
  710. if (slot4 == 3) {
  711. if (!Config.ENABLE_WYMIANA) {
  712. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
  713. return;
  714. }
  715. if (p.hasPermission("core.cmd.repair")) {
  716. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
  717. return;
  718. }
  719. if (u.getLvl() < 90) {
  720. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &690 &7lvl"));
  721. return;
  722. }
  723. if (u.getLvl() > 89) {
  724. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  725. p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, Dostep do komendy Repair!"));
  726. p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
  727. p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
  728. u.removeLvl(40);
  729. u.save();
  730. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add core.cmd.repair");
  731. p.closeInventory();
  732. }
  733. }
  734. if (slot4 == 26) {
  735. SklepGui.show(p);
  736. }
  737. }
  738. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lPanel Gildyjny"))) {
  739. e.setCancelled(true);
  740. e.setResult(Event.Result.DENY);
  741. final Guild g = GuildManager.getGuild(p);
  742. final int slot4 = e.getSlot();
  743. if (slot4 == 1) {
  744. if (!Config.ENABLE_PANEL) {
  745. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
  746. return;
  747. }
  748. if (g.getHp() > 999) {
  749. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Gildia posiada maksymalna ilosc hp!"));
  750. return;
  751. }
  752. if (g.getCoins() < 2500) {
  753. p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c2500 &7coins"));
  754. return;
  755. }
  756. if (g.getCoins() > 2499) {
  757. g.removeCoins(2500);
  758. g.setHp(1000);
  759. Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7zakupila odnowienie &3hp"));
  760. p.sendMessage(ChatUtil.fixColor("&8 &aOdnowiles hp gildyjne"));
  761. p.closeInventory();
  762. }
  763. }
  764. if (slot4 == 19) {
  765. if (!Config.ENABLE_PANEL) {
  766. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
  767. return;
  768. }
  769. if (g.getCoins() < 4000) {
  770. p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c4000 &7coins"));
  771. return;
  772. }
  773. if (g.getCoins() > 3999) {
  774. g.removeCoins(4000);
  775. g.setLife(g.getLife() + 1);
  776. Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7zakupila dodatkowe &3zycie&7!"));
  777. p.sendMessage(ChatUtil.fixColor("&8 &aZakupiles dodatkowe zycie!"));
  778. p.closeInventory();
  779. }
  780. }
  781. if (slot4 == 7) {
  782. if (!Config.ENABLE_PANEL) {
  783. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
  784. return;
  785. }
  786. if (g.getCoins() < 3000) {
  787. p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c3000 &7coins"));
  788. return;
  789. }
  790. if (g.getCoins() > 2999) {
  791. g.removeCoins(3000);
  792. g.setSojusz(g.getSojusz() + 1);
  793. Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7zakupila dodatkowy &3sojusz&7!"));
  794. p.sendMessage(ChatUtil.fixColor("&8 &aZakupiles dodatkowy sojusz!"));
  795. p.closeInventory();
  796. }
  797. }
  798. if (slot4 == 37) {
  799. if (!Config.ENABLE_PANEL) {
  800. p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
  801. return;
  802. }
  803. if (g.getCoins() < 1000) {
  804. p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c1000 &7coins"));
  805. return;
  806. }
  807. if (g.getCoins() > 999) {
  808. g.removeCoins(1000);
  809. p.closeInventory();
  810. final Guild g2 = GuildManager.getGuild(p);
  811. final EffectType effectType = EffectType.getEffectTypeRandom();
  812. if (effectType != null) {
  813. Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g2.getTag() + "&8] &b" + g2.getName() + " &7zakupila losowy efekt &3" + effectType));
  814. for (final Player p2 : g2.getOnlineMembers()) {
  815. EffectType.applyPotion(p2, effectType, 1L);
  816. }
  817. }
  818. }
  819. }
  820. }
  821. if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lWymiana za coinsy!"))) {
  822. e.setCancelled(true);
  823. e.setResult(Event.Result.DENY);
  824. final Guild g = GuildManager.getGuild(p);
  825. final User u2 = UserManager.getUser(p);
  826. final int slot5 = e.getSlot();
  827. if (slot5 == 10) {
  828. if (u2.getCoins() < 3500) {
  829. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c3500 &7coins"));
  830. }
  831. if (u2.getCoins() > 3499) {
  832. u2.removeCoins(3500);
  833. u2.save();
  834. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 46 32");
  835. for (final Player po : Bukkit.getOnlinePlayers()) {
  836. final User u3 = UserManager.getUser(po);
  837. if (u3.isShopMessages()) {
  838. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lTnt x32 &7/sklep");
  839. p.closeInventory();
  840. return;
  841. }
  842. }
  843. }
  844. }
  845. if (slot5 == 11) {
  846. if (u2.getCoins() < 6000) {
  847. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c6000 &7coins"));
  848. }
  849. if (u2.getCoins() > 5999) {
  850. u2.removeCoins(6000);
  851. u2.save();
  852. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "stats " + u2.getName() + " restart 1");
  853. for (final Player po : Bukkit.getOnlinePlayers()) {
  854. final User u3 = UserManager.getUser(po);
  855. if (u3.isShopMessages()) {
  856. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lReset Statystyk &7/sklep");
  857. p.closeInventory();
  858. return;
  859. }
  860. }
  861. }
  862. }
  863. if (slot5 == 12) {
  864. if (u2.getCoins() < 7500) {
  865. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c7500 &7coins"));
  866. }
  867. if (u2.getCoins() > 7499) {
  868. u2.removeCoins(7500);
  869. u2.save();
  870. p.closeInventory();
  871. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 138 1");
  872. for (final Player po : Bukkit.getOnlinePlayers()) {
  873. final User u3 = UserManager.getUser(po);
  874. if (u3.isShopMessages()) {
  875. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lBeacon &7/sklep");
  876. return;
  877. }
  878. }
  879. }
  880. }
  881. if (slot5 == 13) {
  882. if (u2.getCoins() < 2300) {
  883. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c2300 &7coins"));
  884. }
  885. if (u2.getCoins() > 2299) {
  886. u2.removeCoins(2300);
  887. u2.save();
  888. ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  889. ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  890. ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  891. ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
  892. p.closeInventory();
  893. for (final Player po : Bukkit.getOnlinePlayers()) {
  894. final User u3 = UserManager.getUser(po);
  895. if (u3.isShopMessages()) {
  896. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lSet 4/3 &7/sklep");
  897. return;
  898. }
  899. }
  900. }
  901. }
  902. if (slot5 == 14) {
  903. if (u2.getCoins() < 5000) {
  904. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c5000 &7coins"));
  905. }
  906. if (u2.getCoins() > 4999) {
  907. u2.removeCoins(5000);
  908. u2.save();
  909. p.closeInventory();
  910. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "jajo " + u2.getName() + " 2");
  911. for (final Player po : Bukkit.getOnlinePlayers()) {
  912. final User u3 = UserManager.getUser(po);
  913. if (u3.isShopMessages()) {
  914. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lJajo x2 &7/sklep");
  915. return;
  916. }
  917. }
  918. }
  919. }
  920. if (slot5 == 15) {
  921. if (u2.getCoins() < 1500) {
  922. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c1500 &7coins"));
  923. }
  924. if (u2.getCoins() > 1499) {
  925. u2.removeCoins(1500);
  926. u2.save();
  927. p.closeInventory();
  928. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "turbo drop " + u2.getName() + " 20m");
  929. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "turbo exp " + u2.getName() + " 20m");
  930. for (final Player po : Bukkit.getOnlinePlayers()) {
  931. final User u3 = UserManager.getUser(po);
  932. if (u3.isShopMessages()) {
  933. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lTurbo Drop/Exp &7/sklep");
  934. return;
  935. }
  936. }
  937. }
  938. }
  939. if (slot5 == 16) {
  940. if (u2.getCoins() < 3200) {
  941. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c3200 &7coins"));
  942. }
  943. if (u2.getCoins() > 3199) {
  944. u2.removeCoins(3200);
  945. u2.save();
  946. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 322:1 4");
  947. for (final Player po : Bukkit.getOnlinePlayers()) {
  948. final User u3 = UserManager.getUser(po);
  949. if (u3.isShopMessages()) {
  950. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lKoxy x4 &7/sklep");
  951. p.closeInventory();
  952. return;
  953. }
  954. }
  955. }
  956. }
  957. if (slot5 == 21) {
  958. if (u2.getCoins() < 4000) {
  959. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c4000 &7coins"));
  960. }
  961. if (u2.getCoins() > 3999) {
  962. u2.removeCoins(4000);
  963. u2.save();
  964. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 368 4");
  965. for (final Player po : Bukkit.getOnlinePlayers()) {
  966. final User u3 = UserManager.getUser(po);
  967. if (u3.isShopMessages()) {
  968. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lPerly x4 &7/sklep");
  969. p.closeInventory();
  970. return;
  971. }
  972. }
  973. }
  974. }
  975. if (slot5 == 22) {
  976. if (u2.getCoins() < 3400) {
  977. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c3400 &7coins"));
  978. }
  979. if (u2.getCoins() > 3399) {
  980. u2.removeCoins(3400);
  981. u2.save();
  982. p.closeInventory();
  983. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "case key " + u2.getName() + " 4");
  984. for (final Player po : Bukkit.getOnlinePlayers()) {
  985. final User u3 = UserManager.getUser(po);
  986. if (u3.isShopMessages()) {
  987. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lMagiczne Klucze x4 &7/sklep");
  988. return;
  989. }
  990. }
  991. }
  992. }
  993. if (slot5 == 23) {
  994. if (u2.getCoins() < 5500) {
  995. p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c5500 &7coins"));
  996. }
  997. if (u2.getCoins() > 5499) {
  998. u2.removeCoins(5500);
  999. u2.save();
  1000. p.closeInventory();
  1001. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "zdrapka " + u2.getName() + " 2");
  1002. for (final Player po : Bukkit.getOnlinePlayers()) {
  1003. final User u3 = UserManager.getUser(po);
  1004. if (u3.isShopMessages()) {
  1005. ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lZdrapki x2 &7/sklep");
  1006. return;
  1007. }
  1008. }
  1009. }
  1010. }
  1011. if (slot5 == 45) {
  1012. SklepGui.show1(p);
  1013. return;
  1014. }
  1015. if (slot5 == 53) {
  1016. SklepGui.show(p);
  1017. }
  1018. }
  1019. }
  1020.  
  1021. @EventHandler(priority = EventPriority.MONITOR)
  1022. public void onClickAll(final InventoryClickEvent e) {
  1023. final Player p = (Player)e.getWhoClicked();
  1024. if ("&7Zdrap nagrode gwarantowana".equalsIgnoreCase(e.getInventory().getName())) {
  1025. e.setCancelled(true);
  1026. final ItemStack item = e.getCurrentItem();
  1027. if (item != null) {
  1028. final ItemMeta meta = item.getItemMeta();
  1029. if (meta != null) {
  1030. if (item.getType().equals((Object)Material.STAINED_GLASS_PANE) && item.getData().getData() == 14) {
  1031. ItemStack drop = ZdrapkaCommand.drops1.get(RandomUtil.getRandInt(0, ZdrapkaCommand.drops1.size() - 1));
  1032. if (drop.getType().equals((Object)Material.DIAMOND_PICKAXE)) {
  1033. final Random r = new Random();
  1034. final int ins = r.nextInt(4);
  1035. if (ins != 0) {
  1036. drop = ZdrapkaCommand.drops1.get(RandomUtil.getRandInt(0, ZdrapkaCommand.drops1.size() - 1));
  1037. }
  1038. }
  1039. e.setCurrentItem(drop);
  1040. final Material win = drop.getType();
  1041. for (final Player po : Bukkit.getOnlinePlayers()) {
  1042. final User u1 = UserManager.getUser(po);
  1043. if (u1.isScratchesMessages()) {
  1044. ChatUtil.sendMessage((CommandSender)po, "&7Gracz &e" + p.getName() + " &7zdrapal &a&lzdrapke &7i wygral &6" + PolishItemNames.getPolishName(win) + " &7z nagrody gwarantowanej!");
  1045. }
  1046. }
  1047. final User u2 = UserManager.getUser(p);
  1048. u2.addCoins(50);
  1049. u2.addZdrapkaopen(1);
  1050. u2.save();
  1051. final ItemStack is = drop.clone();
  1052. p.getInventory().addItem(new ItemStack[] { is });
  1053. }
  1054. return;
  1055. }
  1056. }
  1057. }
  1058. if ("7Gracze do uratowania".equalsIgnoreCase(e.getInventory().getName())) {
  1059. e.setCancelled(true);
  1060. final ItemStack item = e.getCurrentItem();
  1061. if (item != null) {
  1062. final ItemMeta meta = item.getItemMeta();
  1063. if (meta != null && item.getType().equals((Object)Material.SKULL_ITEM)) {
  1064. final Player pl = Bukkit.getPlayer(meta.getDisplayName().replace("6", ""));
  1065. pl.sendMessage(ChatUtil.fixColor("&8 &7Zostales uratowany z nozek przez &6" + p.getName() + "&8 dzieki &6&lAnty Nogi"));
  1066. p.sendMessage(ChatUtil.fixColor("&8 &7Uratowales gracza &6" + pl.getName()));
  1067. pl.teleport(p.getLocation());
  1068. ChatUtil.sendTitleMessage(pl, ChatUtil.fixColor("&6&lAnty Nogi"), ChatUtil.fixColor("&8 &7Zostales uratowany z nozek!"), 2, 2, 2);
  1069. Bukkit.broadcastMessage(ChatUtil.fixColor("&7Gracz &e" + pl.getName() + " &7zostal uratowany z nozek przez &3" + p.getName() + "&7!"));
  1070. final ItemBuilder anty = new ItemBuilder(Material.NAME_TAG, 1).setTitle(ChatUtil.fixColor("&6&lAnty Nogi")).addLore(ChatUtil.fixColor("")).addLore(ChatUtil.fixColor("&8 &2Kliknij PPM, aby uratowac czlonka gildii!")).addEnchantment(Enchantment.DURABILITY, 2);
  1071. p.getInventory().removeItem(new ItemStack[] { anty.build() });
  1072. p.closeInventory();
  1073. final User u3 = UserManager.getUser(p);
  1074. u3.addCoins(100);
  1075. u3.save();
  1076. u3.setLastPearl(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(30));
  1077. }
  1078. }
  1079. }
  1080. }
  1081.  
  1082. @EventHandler
  1083. public static void onClickGEfekt(final InventoryClickEvent event) {
  1084. final HumanEntity whoClicked = event.getWhoClicked();
  1085. if (event.getClickedInventory() != null && event.getView().getTopInventory() == event.getClickedInventory() && event.getClickedInventory().getTitle().equals(ChatUtil.fixColor("&c&lEfekty dla Gildii"))) {
  1086. final Player player = (Player)whoClicked;
  1087. UserManager.getUser(whoClicked.getName());
  1088. final Guild g = GuildManager.getGuild(player);
  1089. final ItemStack itemClicked = event.getCurrentItem();
  1090. event.setCancelled(true);
  1091. event.getView().setCursor((ItemStack)null);
  1092. if (g == null) {
  1093. player.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aby uruchomic musisz posiadac gildie!"));
  1094. return;
  1095. }
  1096. final EffectType effectType = EffectType.getEffectType(itemClicked);
  1097. if (effectType != null) {
  1098. final ItemStack payment = new ItemStack(Material.GOLD_BLOCK, effectType.getCost());
  1099. if (whoClicked.getInventory().containsAtLeast(payment, effectType.getCost())) {
  1100. whoClicked.getInventory().removeItem(new ItemStack[] { payment });
  1101. Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGEFEKT &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7aktywowala efekt &3" + effectType));
  1102. for (final Player p : g.getOnlineMembers()) {
  1103. EffectType.applyPotion(p, effectType, 1L);
  1104. }
  1105. }
  1106. else {
  1107. player.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz za malo blokow zlota aby to kupic!"));
  1108. }
  1109. }
  1110. }
  1111. }
  1112.  
  1113. @EventHandler(priority = EventPriority.MONITOR)
  1114. public void onClickSklep(final InventoryClickEvent e) {
  1115. if (!ChatUtil.fixColor("&c&lSklep").equalsIgnoreCase(e.getInventory().getName())) {
  1116. return;
  1117. }
  1118. final Player p = (Player)e.getWhoClicked();
  1119. e.setCancelled(true);
  1120. final ItemStack item = e.getCurrentItem();
  1121. if (item != null) {
  1122. final ItemMeta meta = item.getItemMeta();
  1123. if (meta != null) {
  1124. if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lSprzedaz itemow za coinsy!"))) {
  1125. p.closeInventory();
  1126. SklepGui.show1(p);
  1127. }
  1128. if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lWymiana za coinsy!"))) {
  1129. p.closeInventory();
  1130. SklepGui.show2(p);
  1131. }
  1132. if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lBoosty za coinsy!"))) {
  1133. p.closeInventory();
  1134. SklepGui.show3(p);
  1135. }
  1136. }
  1137. }
  1138. }
  1139.  
  1140. @EventHandler(priority = EventPriority.MONITOR)
  1141. public void onClickCc(final InventoryClickEvent e) {
  1142. if (!ChatUtil.fixColor("&c&lZarzadzanie chatem").equalsIgnoreCase(e.getInventory().getName())) {
  1143. return;
  1144. }
  1145. e.setCancelled(true);
  1146. final ItemStack item = e.getCurrentItem();
  1147. final Player p = (Player)e.getWhoClicked();
  1148. final User u = UserManager.getUser(p);
  1149. if (item != null) {
  1150. final ItemMeta meta = item.getItemMeta();
  1151. if (meta != null) {
  1152. if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lAutomatyczne wiadomosci"))) {
  1153. u.setAutoMessages(!u.isAutoMessages());
  1154. p.closeInventory();
  1155. WiadomosciGui.show(p);
  1156. }
  1157. else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lPrywatne wiadomosci"))) {
  1158. u.setPrivateMessages(!u.isPrivateMessages());
  1159. p.closeInventory();
  1160. WiadomosciGui.show(p);
  1161. }
  1162. else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci o smierciach"))) {
  1163. u.setDeathMessages(!u.isDeathMessages());
  1164. p.closeInventory();
  1165. WiadomosciGui.show(p);
  1166. }
  1167. else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z jajek"))) {
  1168. u.setEggsMessages(!u.isEggsMessages());
  1169. p.closeInventory();
  1170. WiadomosciGui.show(p);
  1171. }
  1172. else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z magicznych skrzynek"))) {
  1173. u.setCratesMessages(!u.isCratesMessages());
  1174. p.closeInventory();
  1175. WiadomosciGui.show(p);
  1176. }
  1177. else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z zdrapek"))) {
  1178. u.setScratchesMessages(!u.isScratchesMessages());
  1179. p.closeInventory();
  1180. WiadomosciGui.show(p);
  1181. }
  1182. else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z sklepu"))) {
  1183. u.setShopMessages(!u.isShopMessages());
  1184. p.closeInventory();
  1185. WiadomosciGui.show(p);
  1186. }
  1187. }
  1188. }
  1189. }
  1190.  
  1191. @EventHandler
  1192. public void onClickCase(final InventoryClickEvent e) {
  1193. if (!e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCASE MENU"))) {
  1194. return;
  1195. }
  1196. e.setCancelled(true);
  1197. final Player p = (Player)e.getWhoClicked();
  1198. final ItemStack item = e.getCurrentItem();
  1199. if (item != null) {
  1200. final ItemMeta meta = item.getItemMeta();
  1201. if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lDwie Skrzynki"))) {
  1202. if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 2)) {
  1203. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c2 Szt.");
  1204. ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
  1205. return;
  1206. }
  1207. if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 2)) {
  1208. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c2 Szt.");
  1209. ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
  1210. return;
  1211. }
  1212. CaseGui.OneCase(p);
  1213. p.closeInventory();
  1214. }
  1215. if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lJedna Skrzynka"))) {
  1216. if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 1)) {
  1217. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c1 Szt.");
  1218. ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
  1219. return;
  1220. }
  1221. if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 1)) {
  1222. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c1 Szt.");
  1223. ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
  1224. return;
  1225. }
  1226. CaseGui.SecondCase(p);
  1227. p.closeInventory();
  1228. }
  1229. if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lTrzy Skrzynki"))) {
  1230. if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 3)) {
  1231. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c3 Szt.");
  1232. ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
  1233. return;
  1234. }
  1235. if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 3)) {
  1236. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c3 Szt.");
  1237. ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
  1238. return;
  1239. }
  1240. CaseGui.ThirdCase(p);
  1241. p.closeInventory();
  1242. }
  1243. if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lCztery Skrzynki"))) {
  1244. if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 4)) {
  1245. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c4 Szt.");
  1246. ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
  1247. return;
  1248. }
  1249. if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 4)) {
  1250. ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c4 Szt.");
  1251. ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
  1252. return;
  1253. }
  1254. CaseGui.ForthCase(p);
  1255. p.closeInventory();
  1256. }
  1257. }
  1258. }
  1259.  
  1260. private int swich(final InventoryClickEvent e) {
  1261. if (e.getClick() == ClickType.LEFT) {
  1262. return 0;
  1263. }
  1264. if (e.getClick() == ClickType.RIGHT) {
  1265. return 1;
  1266. }
  1267. if (e.getClick() == ClickType.SHIFT_LEFT) {
  1268. return 2;
  1269. }
  1270. return 0;
  1271. }
  1272. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement