Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* */ package pl.dajman.core.listeners;
- /* */
- /* */ import org.bukkit.Material;
- /* */ import org.bukkit.entity.Player;
- /* */ import org.bukkit.event.inventory.InventoryClickEvent;
- /* */ import org.bukkit.inventory.ItemStack;
- /* */ import pl.dajman.core.data.base.User;
- /* */ import pl.dajman.core.lang.Config;
- /* */ import pl.dajman.core.lang.Kits;
- /* */ import pl.dajman.core.utils.TimeUtil;
- /* */ import pl.dajman.core.utils.Util;
- /* */
- /* */ public class KitListener implements org.bukkit.event.Listener
- /* */ {
- /* */ @org.bukkit.event.EventHandler
- /* */ public void onClick(InventoryClickEvent e)
- /* */ {
- /* 18 */ if (!(e.getWhoClicked() instanceof Player)) {
- /* 19 */ return;
- /* */ }
- /* 21 */ if ((e.getInventory().getName() == null) || (!e.getInventory().getName().equalsIgnoreCase("§9» §6§lZestawy: §9«"))) {
- /* 22 */ return;
- /* */ }
- /* 24 */ Player p = (Player)e.getWhoClicked();
- /* 25 */ User u = pl.dajman.core.managers.UserManager.getUser(p);
- /* 26 */ e.setCancelled(true);
- /* 27 */ ItemStack is = e.getCurrentItem();
- /* 28 */ if ((is == null) || (is.getType().equals(Material.AIR)) || (!is.hasItemMeta()) || (is.getItemMeta().getDisplayName() == null)) {
- /* 29 */ return;
- /* */ }
- /* 31 */ String name = is.getItemMeta().getDisplayName();
- /* 32 */ if (name.equalsIgnoreCase("§9» §c§lJedzenie: §9«")) {
- /* 33 */ ItemStack admin1 = new ItemStack(Material.GRILLED_PORK, 64);
- /* 34 */ Util.giveItems(p, new ItemStack[] { admin1 });
- /* 35 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit mieso");
- /* 36 */ p.closeInventory();
- /* */ }
- /* 38 */ else if (name.equalsIgnoreCase("§9» §c§lDrewno: §9«")) {
- /* 39 */ ItemStack wood = new ItemStack(Material.WOOD, 64);
- /* 40 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitDrewno() > System.currentTimeMillis())) {
- /* 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 */ return;
- /* */ }
- /* 44 */ u.setKitDrewno(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_DREWNO));
- /* 45 */ Util.giveItems(p, new ItemStack[] { wood });
- /* 46 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit drewno!");
- /* 47 */ p.closeInventory();
- /* */ }
- /* 49 */ else if (name.equalsIgnoreCase("§9» §§&lEnderChest: §9«")) {
- /* 50 */ ItemStack ender = new ItemStack(Material.ENDER_CHEST);
- /* 51 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitEnderChest() > System.currentTimeMillis())) {
- /* 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 */ return;
- /* */ }
- /* 55 */ u.setKitEnderChest(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_ENDERCHEST));
- /* 56 */ Util.giveItems(p, new ItemStack[] { ender });
- /* 57 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit enderchest!");
- /* 58 */ p.closeInventory();
- /* */ }
- /* 60 */ else if (name.equalsIgnoreCase("§9» §c§lVIP: §9«")) {
- /* 61 */ if (!p.hasPermission("kiroksiewicz.vip")) {
- /* 62 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cAby uzyc tego zestawu musisz posidac range vip wiecej info pod &b/vip");
- /* 63 */ return;
- /* */ }
- /* 65 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitVip() > System.currentTimeMillis())) {
- /* 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 */ return;
- /* */ }
- /* 69 */ u.setKitVip(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_VIP));
- /* 70 */ Kits.GiveToPlayerVip(p);
- /* 71 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit vip!");
- /* 72 */ p.closeInventory();
- /* */ }
- /* 74 */ else if (name.equalsIgnoreCase("§9» §c§lSuperVIP: §9«")) {
- /* 75 */ if (!p.hasPermission("kiroksiewicz.svip")) {
- /* 76 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &cAby uzyc tego zestawu musisz posidac range svip wiecej info pod &b/svip&c!");
- /* 77 */ return;
- /* */ }
- /* 79 */ if ((!p.hasPermission("kiroksiewicz.admin")) && (u.getKitSvip() > System.currentTimeMillis())) {
- /* 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 */ return;
- /* */ }
- /* 83 */ u.setKitSvip(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(Config.KIT_SVIP));
- /* 84 */ Kits.GiveToPlayerSvip(p);
- /* 85 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit svip!");
- /* 86 */ p.closeInventory();
- /* */ }
- /* */ else {
- /* 89 */ if (!name.equalsIgnoreCase("§9» §c§lAdmin: §9«")) {
- /* 90 */ return;
- /* */ }
- /* 92 */ ItemStack admin2 = new ItemStack(Material.COMPASS);
- /* 93 */ ItemStack admin3 = new ItemStack(Material.GRILLED_PORK, 64);
- /* 94 */ ItemStack admin4 = new ItemStack(Material.STICK);
- /* 95 */ if (!p.hasPermission("kiroksiewicz.mod")) {
- /* 96 */ String msg = pl.dajman.core.lang.Lang.MSG_ERROR_DONTHAVEPERMISSION;
- /* 97 */ msg = msg.replace("{PERM}", "kiroksiewicz.mod");
- /* 98 */ Util.sendMsg(p, msg);
- /* 99 */ return;
- /* */ }
- /* 101 */ Util.giveItems(p, new ItemStack[] { admin2, admin4, admin3 });
- /* 102 */ Util.sendMsg(p, "§7[§cKiroksiewicz.pl§7] §f» &aPomyslnie otrzymales kit admin!");
- /* 103 */ p.closeInventory();
- /* */ }
- /* */ }
- /* */ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement