Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.30 KB | None | 0 0
  1. /* */ package pl.dajman.core.listeners;
  2. /* */
  3. /* */ import org.bukkit.Material;
  4. /* */ import org.bukkit.entity.Player;
  5. /* */ import org.bukkit.event.inventory.InventoryClickEvent;
  6. /* */ import org.bukkit.inventory.ItemStack;
  7. /* */ import pl.dajman.core.data.base.User;
  8. /* */ import pl.dajman.core.lang.Config;
  9. /* */ import pl.dajman.core.lang.Kits;
  10. /* */ import pl.dajman.core.utils.TimeUtil;
  11. /* */ import pl.dajman.core.utils.Util;
  12. /* */
  13. /* */ public class KitListener implements org.bukkit.event.Listener
  14. /* */ {
  15. /* */ @org.bukkit.event.EventHandler
  16. /* */ public void onClick(InventoryClickEvent e)
  17. /* */ {
  18. /* 18 */ if (!(e.getWhoClicked() instanceof Player)) {
  19. /* 19 */ return;
  20. /* */ }
  21. /* 21 */ if ((e.getInventory().getName() == null) || (!e.getInventory().getName().equalsIgnoreCase("§9» §6§lZestawy: §9«"))) {
  22. /* 22 */ return;
  23. /* */ }
  24. /* 24 */ Player p = (Player)e.getWhoClicked();
  25. /* 25 */ User u = pl.dajman.core.managers.UserManager.getUser(p);
  26. /* 26 */ e.setCancelled(true);
  27. /* 27 */ ItemStack is = e.getCurrentItem();
  28. /* 28 */ if ((is == null) || (is.getType().equals(Material.AIR)) || (!is.hasItemMeta()) || (is.getItemMeta().getDisplayName() == null)) {
  29. /* 29 */ return;
  30. /* */ }
  31. /* 31 */ String name = is.getItemMeta().getDisplayName();
  32. /* 32 */ if (name.equalsIgnoreCase("§9» §c§lJedzenie: §9«")) {
  33. /* 33 */ ItemStack admin1 = new ItemStack(Material.GRILLED_PORK, 64);
  34. /* 34 */ Util.giveItems(p, new ItemStack[] { admin1 });
  35. /* 35 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit mieso");
  36. /* 36 */ p.closeInventory();
  37. /* */ }
  38. /* 38 */ else if (name.equalsIgnoreCase("§9» §c§lDrewno: §9«")) {
  39. /* 39 */ ItemStack wood = new ItemStack(Material.WOOD, 64);
  40. /* 40 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitDrewno() > System.currentTimeMillis())) {
  41. /* 41 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cKit drewno mozesz wziac dopiero za &f" + Util.secondsToString((int)(u.getKitDrewno() - System.currentTimeMillis()) / 1000) + "&c!");
  42. /* 42 */ return;
  43. /* */ }
  44. /* 44 */ u.setKitDrewno(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_DREWNO));
  45. /* 45 */ Util.giveItems(p, new ItemStack[] { wood });
  46. /* 46 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit drewno!");
  47. /* 47 */ p.closeInventory();
  48. /* */ }
  49. /* 49 */ else if (name.equalsIgnoreCase("§9» §§&lEnderChest: §9«")) {
  50. /* 50 */ ItemStack ender = new ItemStack(Material.ENDER_CHEST);
  51. /* 51 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitEnderChest() > System.currentTimeMillis())) {
  52. /* 52 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cKit enderchest mozesz wziac dopiero za &f" + Util.secondsToString((int)(u.getKitEnderChest() - System.currentTimeMillis()) / 1000) + "&c!");
  53. /* 53 */ return;
  54. /* */ }
  55. /* 55 */ u.setKitEnderChest(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_ENDERCHEST));
  56. /* 56 */ Util.giveItems(p, new ItemStack[] { ender });
  57. /* 57 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit enderchest!");
  58. /* 58 */ p.closeInventory();
  59. /* */ }
  60. /* 60 */ else if (name.equalsIgnoreCase("§9» §c§lVIP: §9«")) {
  61. /* 61 */ if (!p.hasPermission("kiroksiewicz.vip")) {
  62. /* 62 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cAby uzyc tego zestawu musisz posidac range vip wiecej info pod &b/vip");
  63. /* 63 */ return;
  64. /* */ }
  65. /* 65 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitVip() > System.currentTimeMillis())) {
  66. /* 66 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cKit vip mozesz wziac dopiero za &f" + Util.secondsToString((int)(u.getKitVip() - System.currentTimeMillis()) / 1000) + "&c!");
  67. /* 67 */ return;
  68. /* */ }
  69. /* 69 */ u.setKitVip(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_VIP));
  70. /* 70 */ Kits.GiveToPlayerVip(p);
  71. /* 71 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit vip!");
  72. /* 72 */ p.closeInventory();
  73. /* */ }
  74. /* 74 */ else if (name.equalsIgnoreCase("§9» §c§lSuperVIP: §9«")) {
  75. /* 75 */ if (!p.hasPermission("kiroksiewicz.svip")) {
  76. /* 76 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cAby uzyc tego zestawu musisz posidac range svip wiecej info pod &b/svip&c!");
  77. /* 77 */ return;
  78. /* */ }
  79. /* 79 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitSvip() > System.currentTimeMillis())) {
  80. /* 80 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cKit svip mozesz wziac dopiero za &f" + Util.secondsToString((int)(u.getKitSvip() - System.currentTimeMillis()) / 1000) + "&c!");
  81. /* 81 */ return;
  82. /* */ }
  83. /* 83 */ u.setKitSvip(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_SVIP));
  84. /* 84 */ Kits.GiveToPlayerSvip(p);
  85. /* 85 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit svip!");
  86. /* 86 */ p.closeInventory();
  87. /* */ }
  88. /* */ else {
  89. /* 89 */ if (!name.equalsIgnoreCase("§9» §c§lAdmin: §9«")) {
  90. /* 90 */ return;
  91. /* */ }
  92. /* 92 */ ItemStack admin2 = new ItemStack(Material.COMPASS);
  93. /* 93 */ ItemStack admin3 = new ItemStack(Material.GRILLED_PORK, 64);
  94. /* 94 */ ItemStack admin4 = new ItemStack(Material.STICK);
  95. /* 95 */ if (!p.hasPermission("kiroksiewicz.mod")) {
  96. /* 96 */ String msg = pl.dajman.core.lang.Lang.MSG_ERROR_DONTHAVEPERMISSION;
  97. /* 97 */ msg = msg.replace("{PERM}", "kiroksiewicz.mod");
  98. /* 98 */ Util.sendMsg(p, msg);
  99. /* 99 */ return;
  100. /* */ }
  101. /* 101 */ Util.giveItems(p, new ItemStack[] { admin2, admin4, admin3 });
  102. /* 102 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit admin!");
  103. /* 103 */ p.closeInventory();
  104. /* */ }
  105. /* */ }
  106. /* */ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement