Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.endrju.ytcore.listeners;
- import org.bukkit.command.*;
- import pl.endrju.ytcore.data.base.*;
- import org.bukkit.inventory.*;
- import org.bukkit.event.*;
- import org.bukkit.*;
- import pl.endrju.api.*;
- import org.bukkit.enchantments.*;
- import pl.endrju.ytcore.managers.*;
- import pl.endrju.ytcore.data.base.user.*;
- import pl.endrju.ytcore.data.base.guild.*;
- import pl.endrju.ytcore.commands.cmd.*;
- import java.util.*;
- import pl.endrju.ytcore.utils.*;
- import org.bukkit.inventory.meta.*;
- import org.bukkit.entity.*;
- import magiccase.managers.*;
- import pl.endrju.ytcore.gui.*;
- import org.bukkit.event.inventory.*;
- public class InventoryClickListener implements Listener
- {
- @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
- public void onClickBackup(final InventoryClickEvent e) {
- if (e.getInventory().getName().contains(ChatUtil.fixColor("&7Backup'y gracza"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final Inventory inventory = e.getInventory();
- final ItemStack is = e.getCurrentItem();
- if (inventory != null) {
- if (is == null || !is.hasItemMeta() || is.getItemMeta().getDisplayName() == null) {
- return;
- }
- final Player p = (Player)e.getWhoClicked();
- final String name = is.getItemMeta().getLore().get(0).substring(11);
- final long time = Long.parseLong(is.getItemMeta().getDisplayName().substring(4));
- final Player o = Bukkit.getPlayer(name);
- if (o == null) {
- ChatUtil.sendMessage((CommandSender)p, "&c&lBlad: &7Gracz offline!");
- return;
- }
- Backup.restore(o, time, this.swich(e), p);
- }
- }
- }
- @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
- public void onClick(final InventoryClickEvent e) {
- final Player p = (Player)e.getWhoClicked();
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lItemy na gildie"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- return;
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lStatystyki"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- return;
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCraftingi"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final int slot = e.getSlot();
- if (slot == 0) {
- CraftingUtil.openEndStone(p);
- return;
- }
- if (slot == 2) {
- CraftingUtil.openEnderchest(p);
- return;
- }
- if (slot == 4) {
- CraftingUtil.openBoy(p);
- return;
- }
- if (slot == 6) {
- CraftingUtil.openAntyNogi(p);
- return;
- }
- if (slot == 8) {
- CraftingUtil.openCow(p);
- return;
- }
- if (slot == 13) {
- CraftingUtil.openTnt(p);
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("§c§lSchowek"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final User u = UserManager.getUser(p);
- int koxw = 0;
- int refw = 0;
- int perlaw = 0;
- final int i = ItemStackUtil.getAmountOfItem(Material.GOLDEN_APPLE, p, (short)1);
- final int ii = ItemStackUtil.getAmountOfItem(Material.GOLDEN_APPLE, p, (short)0);
- final int iii = ItemStackUtil.getAmountOfItem(Material.ENDER_PEARL, p, (short)0);
- final int slot2 = e.getSlot();
- if (slot2 == 11) {
- if (u.getKox() <= 0) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cNie posiadasz koxow do wyplacenia!");
- return;
- }
- if (i >= Config.LIMIT_KOX) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cOsiagneles juz limit koxow!");
- return;
- }
- if (u.getKox() <= Config.LIMIT_KOX) {
- refw = u.getKox();
- u.removeKox(refw);
- u.save();
- ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, refw, (short)1).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " koxy");
- SchowekGui.show(p);
- return;
- }
- if (i < Config.LIMIT_KOX) {
- final int ref = i - Config.LIMIT_KOX;
- koxw = ref * -1;
- u.removeKox(koxw);
- u.save();
- ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, koxw, (short)1).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + koxw + " koxy");
- SchowekGui.show(p);
- return;
- }
- }
- if (slot2 == 13) {
- if (u.getRefil() <= 0) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cNie posiadasz refow do wyplacenia!");
- return;
- }
- if (ii >= Config.LIMIT_REFILE) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cOsiagneles juz limit refili!");
- return;
- }
- if (u.getRefil() <= Config.LIMIT_REFILE) {
- refw = u.getRefil();
- u.removeRefil(refw);
- u.save();
- ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, refw, (short)0).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " refile");
- SchowekGui.show(p);
- return;
- }
- if (ii < Config.LIMIT_REFILE) {
- final int ref = ii - Config.LIMIT_REFILE;
- refw = ref * -1;
- u.removeRefil(refw);
- u.save();
- ChatUtil.giveItems(p, new ItemBuilder(Material.GOLDEN_APPLE, refw, (short)0).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " refile");
- SchowekGui.show(p);
- return;
- }
- }
- if (slot2 == 15) {
- if (u.getPerly() <= 0) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cNie posiadasz perel do wyplacenia!");
- return;
- }
- if (iii >= Config.LIMIT_PEARL) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cOsiagneles juz limit perel!");
- return;
- }
- if (u.getPerly() <= Config.LIMIT_PEARL) {
- refw = u.getPerly();
- u.removePerly(refw);
- u.save();
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_PEARL, refw, (short)0).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + refw + " perly");
- SchowekGui.show(p);
- return;
- }
- if (iii < Config.LIMIT_PEARL) {
- final int ref = iii - Config.LIMIT_PEARL;
- perlaw = ref * -1;
- u.removePerly(perlaw);
- u.save();
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_PEARL, perlaw, (short)0).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Wyplaciles &6" + perlaw + " perly");
- SchowekGui.show(p);
- return;
- }
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lKity"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final User u = UserManager.getUser(p);
- final int slot3 = e.getSlot();
- if (slot3 == 11) {
- if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
- return;
- }
- if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.vip")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostep! Zakup range!");
- return;
- }
- if (u.isKitVip() && !p.hasPermission("core.cmd.admin")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit vip mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_vip()));
- return;
- }
- u.setKit_vip(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
- ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit vip!");
- p.closeInventory();
- return;
- }
- else if (slot3 == 11) {
- if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
- return;
- }
- if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.svip")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostepu! Zakup range!");
- return;
- }
- if (u.isKitSvip() && !p.hasPermission("core.cmd.admin")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit svip mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_svip()));
- return;
- }
- u.setKit_svip(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
- ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit svip!");
- p.closeInventory();
- return;
- }
- else if (slot3 == 11) {
- if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
- return;
- }
- if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.youtibe")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostepu! Zakup range!");
- return;
- }
- if (u.isKitYouTube() && !p.hasPermission("core.cmd.admin")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit youtube mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_youtube()));
- return;
- }
- u.setKit_youtube(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
- ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit youtube!");
- p.closeInventory();
- return;
- }
- else if (slot3 == 11) {
- if (!p.hasPermission("core.cmd.admin") && !Config.ENABLE_KIT) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cKity sa tymczasowo wylaczone!");
- return;
- }
- if (!p.hasPermission("core.cmd.admin") && !p.hasPermission("core.kit.streamer")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &cAby posiadac dostepu! Zakup range!");
- return;
- }
- if (u.isKitStreamer() && !p.hasPermission("core.cmd.admin")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit streamer mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_streamer()));
- return;
- }
- u.setKit_streamer(System.currentTimeMillis() + TimeUtil.HOUR.getTime(2));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.FIRE_ASPECT, 2).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 5).addEnchantment(Enchantment.KNOCKBACK, 2).build());
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 3, (short)1));
- ChatUtil.giveItems(p, new ItemStack(Material.GOLDEN_APPLE, 12));
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.IRON_PICKAXE).addEnchantment(Enchantment.DIG_SPEED, 5).addEnchantment(Enchantment.DURABILITY, 3).addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3).build());
- ChatUtil.giveItems(p, new ItemStack(Material.ENDER_PEARL, 4));
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit streamer!");
- p.closeInventory();
- return;
- }
- else if (slot3 == 11) {
- if (u.isKitStart() && !p.hasPermission("core.cmd.admin")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit start mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_start()));
- return;
- }
- u.setKit_start(System.currentTimeMillis() + TimeUtil.HOUR.getTime(1));
- ChatUtil.giveItems(p, new ItemStack(Material.IRON_PICKAXE));
- ChatUtil.giveItems(p, new ItemStack(Material.IRON_SWORD));
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
- ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit start!");
- p.closeInventory();
- return;
- }
- else if (slot3 == 11) {
- if (u.isKitMieso() && !p.hasPermission("core.cmd.admin")) {
- ChatUtil.sendMessage((CommandSender)p, "&8 &7Kit mieso mozesz uzyc dopiero za &a&l" + DataUtil.secondsToString(u.getKit_mieso()));
- return;
- }
- u.setKit_mieso(System.currentTimeMillis() + TimeUtil.SECOND.getTime(60));
- ChatUtil.giveItems(p, new ItemStack(Material.COOKED_BEEF, 128));
- ChatUtil.sendMessage((CommandSender)p, "&8 &aOtrzymales kit mieso!");
- p.closeInventory();
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 1/6"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final int slot = e.getSlot();
- if (slot == 49) {
- CraftingUtil.openMenu(p);
- return;
- }
- if (slot == 19) {
- final String cost = "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston";
- if (!ItemUtil.checkItems(p, "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston", 1)) {
- ItemUtil.getItem(p, "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston", 1);
- return;
- }
- ItemUtil.removeItems(p, "4:0-6:Cobblestone;331:0-2:Redstone;33:0-1:Piston", 1);
- ChatUtil.giveItems(p, new ItemBuilder(Material.ENDER_STONE, 1).setTitle(ChatUtil.fixColor("&a&lStoniarka")).build());
- ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles stoniarke!");
- p.closeInventory();
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 2/6"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final int slot = e.getSlot();
- if (slot == 49) {
- CraftingUtil.openMenu(p);
- return;
- }
- if (slot == 19) {
- final String cost = "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone";
- if (!ItemUtil.checkItems(p, "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone", 1)) {
- ItemUtil.getItem(p, "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone", 1);
- return;
- }
- ItemUtil.removeItems(p, "49:0-6:Obsidian;265:0-2:Iron Ingot;331:0-1:Redstone", 1);
- ChatUtil.giveItems(p, new ItemBuilder(Material.BEDROCK, 1).setTitle(ChatUtil.fixColor("&a&lBoyFarmer")).addLore(ChatUtil.fixColor("&6Zmienia 100 blokow pod soba na obsydian")).build());
- ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles boyfarmer!");
- p.closeInventory();
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 3/6"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final int slot = e.getSlot();
- if (slot == 49) {
- CraftingUtil.openMenu(p);
- return;
- }
- if (slot == 19) {
- final String cost = "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone";
- if (!ItemUtil.checkItems(p, "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone", 1)) {
- ItemUtil.getItem(p, "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone", 1);
- return;
- }
- ItemUtil.removeItems(p, "4:0-6:Cobblestone;388:0-2:Emerald;331:0-1:Redstone", 1);
- 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());
- ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles fosafarmer!");
- p.closeInventory();
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 4/5"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final int slot = e.getSlot();
- if (slot == 49) {
- CraftingUtil.openMenu(p);
- return;
- }
- if (slot == 19) {
- final String cost = "41:0-8:Gold Block;69:0-1:Lever;";
- if (!ItemUtil.checkItems(p, "41:0-8:Gold Block;69:0-1:Lever;", 1)) {
- ItemUtil.getItem(p, "41:0-8:Gold Block;69:0-1:Lever;", 1);
- return;
- }
- ItemUtil.removeItems(p, "41:0-8:Gold Block;69:0-1:Lever;", 1);
- 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());
- ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles Anty Nogi");
- p.closeInventory();
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 5/6"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final int slot = e.getSlot();
- if (slot == 49) {
- CraftingUtil.openMenu(p);
- return;
- }
- if (slot == 19) {
- final String cost = "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone";
- if (!ItemUtil.checkItems(p, "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone", 1)) {
- ItemUtil.getItem(p, "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone", 1);
- return;
- }
- ItemUtil.removeItems(p, "12:0-6:Sand;266:0-2:Gold_Ingot;331:0:0-1:Redstone", 1);
- ChatUtil.giveItems(p, new ItemBuilder(Material.SANDSTONE, 1).setTitle(ChatUtil.fixColor("&a&lSandFarmer")).addLore(ChatUtil.fixColor("&6Zmienia 100 blokow pod soba na piasek")).build());
- ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles sandfarmer!");
- p.closeInventory();
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCrafting 6/6"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final int slot = e.getSlot();
- if (slot == 49) {
- CraftingUtil.openMenu(p);
- return;
- }
- if (slot == 19) {
- final String cost = "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel";
- if (!ItemUtil.checkItems(p, "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel", 1)) {
- ItemUtil.getItem(p, "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel", 1);
- return;
- }
- ItemUtil.removeItems(p, "46:0:0-8:Tnt;259:0:0-1:Flint_And_Steel", 1);
- ChatUtil.giveItems(p, new ItemBuilder(Material.TNT, 1).setTitle(ChatUtil.fixColor("&cRzucane TNT")).build());
- ChatUtil.sendMessage((CommandSender)p, "&a&lGratulacje! &7Utworzyles tnt!");
- p.closeInventory();
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lSprzedaz itemow za coinsy!"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final User user = UserManager.getUser(p);
- final int slot4 = e.getSlot();
- if (slot4 == 0) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.DIRT), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz dirtu! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.DIRT, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano dirt! &8(&764 szt.&8)!"));
- user.addCoins(10);
- user.save();
- }
- if (slot4 == 1) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.COBBLESTONE), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz cobblestone! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.COBBLESTONE, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano cobblestone! &8(&764 szt.&8)!"));
- user.addCoins(20);
- user.save();
- }
- if (slot4 == 2) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.getMaterial(17)), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz drewna! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.getMaterial(17), 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano drewno! &8(&764 szt.&8)!"));
- user.addCoins(25);
- user.save();
- }
- if (slot4 == 3) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.WOOD), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz desek! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.WOOD, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano deski! &8(&764 szt.&8)!"));
- user.addCoins(15);
- user.save();
- }
- if (slot4 == 4) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.DIAMOND), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz diamentow! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.DIAMOND, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano diamenty! &8(&764 szt.&8)!"));
- user.addCoins(40);
- user.save();
- }
- if (slot4 == 5) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.EMERALD), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz szmaragdow! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.EMERALD, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano szmaragdy! &8(&764 szt.&8)!"));
- user.addCoins(40);
- user.save();
- }
- if (slot4 == 6) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.IRON_INGOT), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz sztabek zelaza! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.IRON_INGOT, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano sztabki zelaza! &8(&764 szt.&8)!"));
- user.addCoins(25);
- user.save();
- }
- if (slot4 == 7) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.GOLD_INGOT), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz sztabek zlota! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.GOLD_INGOT, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano sztabki zlota! &8(&764 szt.&8)!"));
- user.addCoins(50);
- user.save();
- }
- if (slot4 == 8) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.ENDER_PEARL), 16)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz perel! &8(&716 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ENDER_PEARL, 16) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano perly! &8(&716 szt.&8)!"));
- user.addCoins(100);
- user.save();
- }
- if (slot4 == 9) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.getMaterial(289)), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz prochu! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.getMaterial(289), 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano proch! &8(&764 szt.&8)!"));
- user.addCoins(80);
- user.save();
- }
- if (slot4 == 10) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.STONE), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz kamienia! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.STONE, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano kamien! &8(&764 szt.&8)!"));
- user.addCoins(50);
- user.save();
- }
- if (slot4 == 11) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.ANVIL), 8)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz kowadel! &8(&78 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ANVIL, 8) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano kowadla! &8(&78 szt.&8)!"));
- user.addCoins(100);
- user.save();
- }
- if (slot4 == 12) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.APPLE), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz jablek! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.APPLE, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano jablka! &8(&764 szt.&8)!"));
- user.addCoins(150);
- user.save();
- }
- if (slot4 == 13) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.BOOK), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz ksiazek! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.BOOK, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano ksiazek! &8(&764 szt.&8)!"));
- user.addCoins(100);
- user.save();
- }
- if (slot4 == 14) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.OBSIDIAN), 64)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz obsydianu! &8(&764 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.OBSIDIAN, 64) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano obydianu! &8(&764 szt.&8)!"));
- user.addCoins(80);
- user.save();
- }
- if (slot4 == 15) {
- if (!p.getInventory().containsAtLeast(new ItemStack(Material.ENDER_CHEST), 8)) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Nie posiadasz enderchestow! &8(&78 szt.&8)"));
- return;
- }
- p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ENDER_CHEST, 8) });
- p.sendMessage(ChatUtil.fixColor("&8 &aPomyslnie sprzedano enderchest! &8(&78 szt.&8)!"));
- user.addCoins(40);
- user.save();
- }
- if (slot4 == 35) {
- SklepGui.show(p);
- return;
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lBoosty za coinsy!"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final User u = UserManager.getUser(p);
- final int slot4 = e.getSlot();
- if (slot4 == 0) {
- if (!Config.ENABLE_WYMIANA) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
- return;
- }
- if (p.hasPermission("core.create.vip")) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
- return;
- }
- if (u.getLvl() < 50) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &650 &7lvl"));
- return;
- }
- if (u.getLvl() > 49) {
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, zakladanie gildi za polowe ceny!"));
- p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- u.removeLvl(50);
- u.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add core.create.vip");
- p.closeInventory();
- }
- }
- if (slot4 == 1) {
- if (!Config.ENABLE_WYMIANA) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
- return;
- }
- if (p.hasPermission("core.drop.vip")) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
- return;
- }
- if (u.getLvl() < 70) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &670 &7lvl"));
- return;
- }
- if (u.getLvl() > 69) {
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, wiekszy drop!"));
- p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- u.removeLvl(70);
- u.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add core.drop.vip");
- p.closeInventory();
- }
- }
- if (slot4 == 2) {
- if (!Config.ENABLE_WYMIANA) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
- return;
- }
- if (p.hasPermission("disco.disco")) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
- return;
- }
- if (u.getLvl() < 40) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &670 &7lvl"));
- return;
- }
- if (u.getLvl() > 39) {
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, DiscoZbroje!"));
- p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- u.removeLvl(40);
- u.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add disco.disco");
- p.closeInventory();
- }
- }
- if (slot4 == 3) {
- if (!Config.ENABLE_WYMIANA) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie wymiana za lvl jest wylaczona!"));
- return;
- }
- if (p.hasPermission("core.cmd.repair")) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz juz tego boosta!"));
- return;
- }
- if (u.getLvl() < 90) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &690 &7lvl"));
- return;
- }
- if (u.getLvl() > 89) {
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- p.sendMessage(ChatUtil.fixColor("&8 &7Kupiles boosta, Dostep do komendy Repair!"));
- p.sendMessage(ChatUtil.fixColor(" &aGRATULACJE!"));
- p.sendMessage(ChatUtil.fixColor("&8&m----------------------------------"));
- u.removeLvl(40);
- u.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "pex user " + u.getName() + " add core.cmd.repair");
- p.closeInventory();
- }
- }
- if (slot4 == 26) {
- SklepGui.show(p);
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lPanel Gildyjny"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final Guild g = GuildManager.getGuild(p);
- final int slot4 = e.getSlot();
- if (slot4 == 1) {
- if (!Config.ENABLE_PANEL) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
- return;
- }
- if (g.getHp() > 999) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Gildia posiada maksymalna ilosc hp!"));
- return;
- }
- if (g.getCoins() < 2500) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c2500 &7coins"));
- return;
- }
- if (g.getCoins() > 2499) {
- g.removeCoins(2500);
- g.setHp(1000);
- Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7zakupila odnowienie &3hp"));
- p.sendMessage(ChatUtil.fixColor("&8 &aOdnowiles hp gildyjne"));
- p.closeInventory();
- }
- }
- if (slot4 == 19) {
- if (!Config.ENABLE_PANEL) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
- return;
- }
- if (g.getCoins() < 4000) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c4000 &7coins"));
- return;
- }
- if (g.getCoins() > 3999) {
- g.removeCoins(4000);
- g.setLife(g.getLife() + 1);
- Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7zakupila dodatkowe &3zycie&7!"));
- p.sendMessage(ChatUtil.fixColor("&8 &aZakupiles dodatkowe zycie!"));
- p.closeInventory();
- }
- }
- if (slot4 == 7) {
- if (!Config.ENABLE_PANEL) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
- return;
- }
- if (g.getCoins() < 3000) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c3000 &7coins"));
- return;
- }
- if (g.getCoins() > 2999) {
- g.removeCoins(3000);
- g.setSojusz(g.getSojusz() + 1);
- Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7zakupila dodatkowy &3sojusz&7!"));
- p.sendMessage(ChatUtil.fixColor("&8 &aZakupiles dodatkowy sojusz!"));
- p.closeInventory();
- }
- }
- if (slot4 == 37) {
- if (!Config.ENABLE_PANEL) {
- p.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aktualnie panel jest wylaczony!"));
- return;
- }
- if (g.getCoins() < 1000) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Gildia nie posiada &c1000 &7coins"));
- return;
- }
- if (g.getCoins() > 999) {
- g.removeCoins(1000);
- p.closeInventory();
- final Guild g2 = GuildManager.getGuild(p);
- final EffectType effectType = EffectType.getEffectTypeRandom();
- if (effectType != null) {
- Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGPANEL &8* &8[&c" + g2.getTag() + "&8] &b" + g2.getName() + " &7zakupila losowy efekt &3" + effectType));
- for (final Player p2 : g2.getOnlineMembers()) {
- EffectType.applyPotion(p2, effectType, 1L);
- }
- }
- }
- }
- }
- if (e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lWymiana za coinsy!"))) {
- e.setCancelled(true);
- e.setResult(Event.Result.DENY);
- final Guild g = GuildManager.getGuild(p);
- final User u2 = UserManager.getUser(p);
- final int slot5 = e.getSlot();
- if (slot5 == 10) {
- if (u2.getCoins() < 3500) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c3500 &7coins"));
- }
- if (u2.getCoins() > 3499) {
- u2.removeCoins(3500);
- u2.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 46 32");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lTnt x32 &7/sklep");
- p.closeInventory();
- return;
- }
- }
- }
- }
- if (slot5 == 11) {
- if (u2.getCoins() < 6000) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c6000 &7coins"));
- }
- if (u2.getCoins() > 5999) {
- u2.removeCoins(6000);
- u2.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "stats " + u2.getName() + " restart 1");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lReset Statystyk &7/sklep");
- p.closeInventory();
- return;
- }
- }
- }
- }
- if (slot5 == 12) {
- if (u2.getCoins() < 7500) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c7500 &7coins"));
- }
- if (u2.getCoins() > 7499) {
- u2.removeCoins(7500);
- u2.save();
- p.closeInventory();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 138 1");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lBeacon &7/sklep");
- return;
- }
- }
- }
- }
- if (slot5 == 13) {
- if (u2.getCoins() < 2300) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c2300 &7coins"));
- }
- if (u2.getCoins() > 2299) {
- u2.removeCoins(2300);
- u2.save();
- ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- ChatUtil.giveItems(p, new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).addEnchantment(Enchantment.DURABILITY, 3).build());
- p.closeInventory();
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lSet 4/3 &7/sklep");
- return;
- }
- }
- }
- }
- if (slot5 == 14) {
- if (u2.getCoins() < 5000) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c5000 &7coins"));
- }
- if (u2.getCoins() > 4999) {
- u2.removeCoins(5000);
- u2.save();
- p.closeInventory();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "jajo " + u2.getName() + " 2");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lJajo x2 &7/sklep");
- return;
- }
- }
- }
- }
- if (slot5 == 15) {
- if (u2.getCoins() < 1500) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c1500 &7coins"));
- }
- if (u2.getCoins() > 1499) {
- u2.removeCoins(1500);
- u2.save();
- p.closeInventory();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "turbo drop " + u2.getName() + " 20m");
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "turbo exp " + u2.getName() + " 20m");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lTurbo Drop/Exp &7/sklep");
- return;
- }
- }
- }
- }
- if (slot5 == 16) {
- if (u2.getCoins() < 3200) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c3200 &7coins"));
- }
- if (u2.getCoins() > 3199) {
- u2.removeCoins(3200);
- u2.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 322:1 4");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lKoxy x4 &7/sklep");
- p.closeInventory();
- return;
- }
- }
- }
- }
- if (slot5 == 21) {
- if (u2.getCoins() < 4000) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c4000 &7coins"));
- }
- if (u2.getCoins() > 3999) {
- u2.removeCoins(4000);
- u2.save();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "give " + u2.getName() + " 368 4");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lPerly x4 &7/sklep");
- p.closeInventory();
- return;
- }
- }
- }
- }
- if (slot5 == 22) {
- if (u2.getCoins() < 3400) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c3400 &7coins"));
- }
- if (u2.getCoins() > 3399) {
- u2.removeCoins(3400);
- u2.save();
- p.closeInventory();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "case key " + u2.getName() + " 4");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lMagiczne Klucze x4 &7/sklep");
- return;
- }
- }
- }
- }
- if (slot5 == 23) {
- if (u2.getCoins() < 5500) {
- p.sendMessage(ChatUtil.fixColor("&8 &7Nie posiadasz &c5500 &7coins"));
- }
- if (u2.getCoins() > 5499) {
- u2.removeCoins(5500);
- u2.save();
- p.closeInventory();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "zdrapka " + u2.getName() + " 2");
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u3 = UserManager.getUser(po);
- if (u3.isShopMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&3&lSKLEP &8* &7Gracz &b" + u2.getName() + " &7zakupil &3&lZdrapki x2 &7/sklep");
- return;
- }
- }
- }
- }
- if (slot5 == 45) {
- SklepGui.show1(p);
- return;
- }
- if (slot5 == 53) {
- SklepGui.show(p);
- }
- }
- }
- @EventHandler(priority = EventPriority.MONITOR)
- public void onClickAll(final InventoryClickEvent e) {
- final Player p = (Player)e.getWhoClicked();
- if ("&7Zdrap nagrode gwarantowana".equalsIgnoreCase(e.getInventory().getName())) {
- e.setCancelled(true);
- final ItemStack item = e.getCurrentItem();
- if (item != null) {
- final ItemMeta meta = item.getItemMeta();
- if (meta != null) {
- if (item.getType().equals((Object)Material.STAINED_GLASS_PANE) && item.getData().getData() == 14) {
- ItemStack drop = ZdrapkaCommand.drops1.get(RandomUtil.getRandInt(0, ZdrapkaCommand.drops1.size() - 1));
- if (drop.getType().equals((Object)Material.DIAMOND_PICKAXE)) {
- final Random r = new Random();
- final int ins = r.nextInt(4);
- if (ins != 0) {
- drop = ZdrapkaCommand.drops1.get(RandomUtil.getRandInt(0, ZdrapkaCommand.drops1.size() - 1));
- }
- }
- e.setCurrentItem(drop);
- final Material win = drop.getType();
- for (final Player po : Bukkit.getOnlinePlayers()) {
- final User u1 = UserManager.getUser(po);
- if (u1.isScratchesMessages()) {
- ChatUtil.sendMessage((CommandSender)po, "&7Gracz &e" + p.getName() + " &7zdrapal &a&lzdrapke &7i wygral &6" + PolishItemNames.getPolishName(win) + " &7z nagrody gwarantowanej!");
- }
- }
- final User u2 = UserManager.getUser(p);
- u2.addCoins(50);
- u2.addZdrapkaopen(1);
- u2.save();
- final ItemStack is = drop.clone();
- p.getInventory().addItem(new ItemStack[] { is });
- }
- return;
- }
- }
- }
- if ("7Gracze do uratowania".equalsIgnoreCase(e.getInventory().getName())) {
- e.setCancelled(true);
- final ItemStack item = e.getCurrentItem();
- if (item != null) {
- final ItemMeta meta = item.getItemMeta();
- if (meta != null && item.getType().equals((Object)Material.SKULL_ITEM)) {
- final Player pl = Bukkit.getPlayer(meta.getDisplayName().replace("6", ""));
- pl.sendMessage(ChatUtil.fixColor("&8 &7Zostales uratowany z nozek przez &6" + p.getName() + "&8 dzieki &6&lAnty Nogi"));
- p.sendMessage(ChatUtil.fixColor("&8 &7Uratowales gracza &6" + pl.getName()));
- pl.teleport(p.getLocation());
- ChatUtil.sendTitleMessage(pl, ChatUtil.fixColor("&6&lAnty Nogi"), ChatUtil.fixColor("&8 &7Zostales uratowany z nozek!"), 2, 2, 2);
- Bukkit.broadcastMessage(ChatUtil.fixColor("&7Gracz &e" + pl.getName() + " &7zostal uratowany z nozek przez &3" + p.getName() + "&7!"));
- 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);
- p.getInventory().removeItem(new ItemStack[] { anty.build() });
- p.closeInventory();
- final User u3 = UserManager.getUser(p);
- u3.addCoins(100);
- u3.save();
- u3.setLastPearl(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(30));
- }
- }
- }
- }
- @EventHandler
- public static void onClickGEfekt(final InventoryClickEvent event) {
- final HumanEntity whoClicked = event.getWhoClicked();
- if (event.getClickedInventory() != null && event.getView().getTopInventory() == event.getClickedInventory() && event.getClickedInventory().getTitle().equals(ChatUtil.fixColor("&c&lEfekty dla Gildii"))) {
- final Player player = (Player)whoClicked;
- UserManager.getUser(whoClicked.getName());
- final Guild g = GuildManager.getGuild(player);
- final ItemStack itemClicked = event.getCurrentItem();
- event.setCancelled(true);
- event.getView().setCursor((ItemStack)null);
- if (g == null) {
- player.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Aby uruchomic musisz posiadac gildie!"));
- return;
- }
- final EffectType effectType = EffectType.getEffectType(itemClicked);
- if (effectType != null) {
- final ItemStack payment = new ItemStack(Material.GOLD_BLOCK, effectType.getCost());
- if (whoClicked.getInventory().containsAtLeast(payment, effectType.getCost())) {
- whoClicked.getInventory().removeItem(new ItemStack[] { payment });
- Bukkit.broadcastMessage(ChatUtil.fixColor("&3&lGEFEKT &8* &8[&c" + g.getTag() + "&8] &b" + g.getName() + " &7aktywowala efekt &3" + effectType));
- for (final Player p : g.getOnlineMembers()) {
- EffectType.applyPotion(p, effectType, 1L);
- }
- }
- else {
- player.sendMessage(ChatUtil.fixColor("&c&lBlad: &7Posiadasz za malo blokow zlota aby to kupic!"));
- }
- }
- }
- }
- @EventHandler(priority = EventPriority.MONITOR)
- public void onClickSklep(final InventoryClickEvent e) {
- if (!ChatUtil.fixColor("&c&lSklep").equalsIgnoreCase(e.getInventory().getName())) {
- return;
- }
- final Player p = (Player)e.getWhoClicked();
- e.setCancelled(true);
- final ItemStack item = e.getCurrentItem();
- if (item != null) {
- final ItemMeta meta = item.getItemMeta();
- if (meta != null) {
- if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lSprzedaz itemow za coinsy!"))) {
- p.closeInventory();
- SklepGui.show1(p);
- }
- if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lWymiana za coinsy!"))) {
- p.closeInventory();
- SklepGui.show2(p);
- }
- if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lBoosty za coinsy!"))) {
- p.closeInventory();
- SklepGui.show3(p);
- }
- }
- }
- }
- @EventHandler(priority = EventPriority.MONITOR)
- public void onClickCc(final InventoryClickEvent e) {
- if (!ChatUtil.fixColor("&c&lZarzadzanie chatem").equalsIgnoreCase(e.getInventory().getName())) {
- return;
- }
- e.setCancelled(true);
- final ItemStack item = e.getCurrentItem();
- final Player p = (Player)e.getWhoClicked();
- final User u = UserManager.getUser(p);
- if (item != null) {
- final ItemMeta meta = item.getItemMeta();
- if (meta != null) {
- if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lAutomatyczne wiadomosci"))) {
- u.setAutoMessages(!u.isAutoMessages());
- p.closeInventory();
- WiadomosciGui.show(p);
- }
- else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lPrywatne wiadomosci"))) {
- u.setPrivateMessages(!u.isPrivateMessages());
- p.closeInventory();
- WiadomosciGui.show(p);
- }
- else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci o smierciach"))) {
- u.setDeathMessages(!u.isDeathMessages());
- p.closeInventory();
- WiadomosciGui.show(p);
- }
- else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z jajek"))) {
- u.setEggsMessages(!u.isEggsMessages());
- p.closeInventory();
- WiadomosciGui.show(p);
- }
- else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z magicznych skrzynek"))) {
- u.setCratesMessages(!u.isCratesMessages());
- p.closeInventory();
- WiadomosciGui.show(p);
- }
- else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z zdrapek"))) {
- u.setScratchesMessages(!u.isScratchesMessages());
- p.closeInventory();
- WiadomosciGui.show(p);
- }
- else if (meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&8&lWiadomosci z sklepu"))) {
- u.setShopMessages(!u.isShopMessages());
- p.closeInventory();
- WiadomosciGui.show(p);
- }
- }
- }
- }
- @EventHandler
- public void onClickCase(final InventoryClickEvent e) {
- if (!e.getInventory().getName().equalsIgnoreCase(ChatUtil.fixColor("&c&lCASE MENU"))) {
- return;
- }
- e.setCancelled(true);
- final Player p = (Player)e.getWhoClicked();
- final ItemStack item = e.getCurrentItem();
- if (item != null) {
- final ItemMeta meta = item.getItemMeta();
- if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lDwie Skrzynki"))) {
- if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 2)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c2 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
- return;
- }
- if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 2)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c2 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
- return;
- }
- CaseGui.OneCase(p);
- p.closeInventory();
- }
- if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lJedna Skrzynka"))) {
- if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 1)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c1 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
- return;
- }
- if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 1)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c1 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
- return;
- }
- CaseGui.SecondCase(p);
- p.closeInventory();
- }
- if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lTrzy Skrzynki"))) {
- if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 3)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c3 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
- return;
- }
- if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 3)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c3 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
- return;
- }
- CaseGui.ThirdCase(p);
- p.closeInventory();
- }
- if (meta != null && meta.getDisplayName() != null && meta.getDisplayName().equals(ChatUtil.fixColor("&a&lCztery Skrzynki"))) {
- if (!p.getInventory().containsAtLeast(CaseManager.key.build(), 4)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz klucz aby otworzyc ta skrzynke: &c4 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczny Klucz &7mozesz kupic na stronie &c" + Config.IP);
- return;
- }
- if (!p.getInventory().containsAtLeast(CaseManager.mcase.build(), 4)) {
- ChatUtil.sendMessage((CommandSender)p, "&7Potrzebujesz magiczna skrzynke aby przejsc dalej: &c4 Szt.");
- ChatUtil.sendMessage((CommandSender)p, "&cMagiczna Skrzynke &7mozesz wykopac ze stone!");
- return;
- }
- CaseGui.ForthCase(p);
- p.closeInventory();
- }
- }
- }
- private int swich(final InventoryClickEvent e) {
- if (e.getClick() == ClickType.LEFT) {
- return 0;
- }
- if (e.getClick() == ClickType.RIGHT) {
- return 1;
- }
- if (e.getClick() == ClickType.SHIFT_LEFT) {
- return 2;
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement