Java 类org.bukkit.event.inventory.InventoryDragEvent 实例源码

项目:AddGun    文件:Guns.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void equipWeaponEvent(InventoryDragEvent event) {
    if (Result.DENY.equals(event.getResult())) return;
    HumanEntity human = event.getWhoClicked();

    Inventory inv = event.getInventory();
    ItemStack prior = event.getOldCursor();
    StandardGun priorGun = findGun(prior); 

    // Don't really care what sort of drag, if we have a gun in inv and this was a gun, deny.
    if (priorGun != null && inv != null && !InventoryType.PLAYER.equals(inv.getType()) && priorGun.isLimitToOne() && priorGun.hasGun(human)) {
        event.setResult(Result.DENY);
        // yes this will prevent drag style of weapon in chest invs. Oh well.
    }

}
项目:AddGun    文件:RailGun.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void equipWeaponEvent(InventoryDragEvent event) {
    if (!enabled) return;
    HumanEntity human = event.getWhoClicked();
    boolean alreadyHasGun = hasGun(human);

    Inventory inv = event.getInventory();
    ItemStack prior = event.getOldCursor();

    // Don't really care what sort of drag, if we have a gun in inv and this was a gun, deny.
    if (alreadyHasGun && (inv != null && !InventoryType.PLAYER.equals(inv.getType()))
            && (prior != null && isGun(prior))) {
        event.setResult(Result.DENY);
        // yes this will prevent drag style of weapon in chest invs. Oh well.
    }

}
项目:SmartInvs    文件:InventoryManager.java   
@EventHandler(priority = EventPriority.LOW)
public void onInventoryDrag(InventoryDragEvent e) {
    Player p = (Player) e.getWhoClicked();

    if(!inventories.containsKey(p))
        return;

    SmartInventory inv = inventories.get(p);

    for(int slot : e.getRawSlots()) {
        if(slot >= p.getOpenInventory().getTopInventory().getSize())
            continue;

        e.setCancelled(true);
        break;
    }

    inv.getListeners().stream()
            .filter(listener -> listener.getType() == InventoryDragEvent.class)
            .forEach(listener -> ((InventoryListener<InventoryDragEvent>) listener).accept(e));
}
项目:RPGInventory    文件:ItemListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void afterEquipChange(final InventoryDragEvent event) {
    final Player player = (Player) event.getWhoClicked();

    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    new BukkitRunnable() {
        @Override
        public void run() {
            InventoryView inventoryView = event.getView();
            for (int slot : event.getRawSlots()) {
                ItemStack item = inventoryView.getItem(slot);
                if (CustomItem.isCustomItem(item)) {
                    ItemManager.updateStats((Player) event.getWhoClicked());
                }
            }
        }
    }.runTaskLater(RPGInventory.getInstance(), 1);
}
项目:HCFCore    文件:EnderPearlTimer.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onInventoryDrag(InventoryDragEvent event) {
    HumanEntity humanEntity = event.getWhoClicked();
    if (humanEntity instanceof Player) {
        Player player = (Player) humanEntity;
        PearlNameFaker pearlNameFaker = itemNameFakes.get(player.getUniqueId());
        if (pearlNameFaker == null)
            return;
        for (Map.Entry<Integer, ItemStack> entry : event.getNewItems().entrySet()) {
            if (entry.getKey() == player.getInventory().getHeldItemSlot()) {
                pearlNameFaker.setFakeItem(CraftItemStack.asNMSCopy(player.getItemInHand()), player.getInventory().getHeldItemSlot());
                break;
            }
        }
    }
}
项目:HCFCore    文件:EnderPearlTimer.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onInventoryDrag(InventoryDragEvent event) {
    HumanEntity humanEntity = event.getWhoClicked();
    if (humanEntity instanceof Player) {
        Player player = (Player) humanEntity;
        PearlNameFaker pearlNameFaker = itemNameFakes.get(player.getUniqueId());
        if (pearlNameFaker == null)
            return;
        for (Map.Entry<Integer, ItemStack> entry : event.getNewItems().entrySet()) {
            if (entry.getKey() == player.getInventory().getHeldItemSlot()) {
                pearlNameFaker.setFakeItem(CraftItemStack.asNMSCopy(player.getItemInHand()), player.getInventory().getHeldItemSlot());
                break;
            }
        }
    }
}
项目:MCLibrary    文件:TopHandler.java   
@Override
public void onEvent(InventoryEvent event) {
    if (event instanceof InventoryClickEvent) {
        InventoryClickEvent clickEvent = ((InventoryClickEvent) event);
        if (isTop(event, clickEvent.getRawSlot())) {
            notify(event);
        }
    } else if (event instanceof InventoryDragEvent) {
        InventoryDragEvent dragEvent = ((InventoryDragEvent) event);
        for (int slot : dragEvent.getRawSlots()) {
            if (isTop(event, slot)) {
                notify(event);
                break;
            }
        }
    }
}
项目:MCLibrary    文件:TopInventoryHandler.java   
@Override
public void handle(GUIEvent<InventoryEvent> event) {
    InventoryEvent nativeEvent = event.getEvent();
    if (nativeEvent instanceof InventoryClickEvent) {
        InventoryClickEvent clickEvent = (InventoryClickEvent) nativeEvent;
        if (clickEvent.getRawSlot() < clickEvent.getInventory().getSize())
            receive(event);
    } else if (nativeEvent instanceof InventoryDragEvent) {
        InventoryDragEvent dragEvent = (InventoryDragEvent) nativeEvent;
        for (int slot : dragEvent.getRawSlots()) {
            if (slot < dragEvent.getInventory().getSize()) {
                receive(event);
                break;
            }
        }
    }
}
项目:ExilePearl    文件:PlayerListener.java   
/**
 * Handle inventory dragging properly
 * @param event
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInventoryDrag(InventoryDragEvent event) {

    Map<Integer, ItemStack> items = event.getNewItems();

    for(Integer slot : items.keySet()) {
        ItemStack item = items.get(slot);

        ExilePearl pearl = pearlApi.getPearlFromItemStack(item);
        if(pearl != null) {
            boolean clickedTop = event.getView().convertSlot(slot) == slot;

            InventoryHolder holder = clickedTop ? event.getView().getTopInventory().getHolder() : event.getView().getBottomInventory().getHolder();

            updatePearlHolder(pearl, holder, event);

            if(event.isCancelled()) {
                return;
            }
        }
    }
}
项目:ArmorStandTools    文件:ArmorStandGUI.java   
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
    if(!event.getInventory().equals(i) || !(event.getWhoClicked() instanceof Player)) return;
    Player p = (Player) event.getWhoClicked();
    boolean invModified = false;
    for(int slot : event.getRawSlots()) {
        if(slot < i.getSize()) {
            if(invSlots.contains(slot)) {
                invModified = true;
            } else {
                event.setCancelled(true);
                return;
            }
        }
    }
    if(invModified) {
        if(plugin.checkBlockPermission(p, as.getLocation().getBlock())) {
            updateInventory();
        } else {
            event.setCancelled(true);
            p.sendMessage(ChatColor.RED + Config.wgNoPerm);
        }
    }
}
项目:civcraft    文件:LoreGuiItemListener.java   
@EventHandler(priority = EventPriority.LOW) 
public void OnInventoryDragEvent(InventoryDragEvent event) {
    if (event.isCancelled()) {
        return;
    }

    for (int slot : event.getRawSlots()) {
        if (slot < event.getView().getTopInventory().getSize()) {
            if (guiInventories.containsKey(event.getView().getTopInventory().getName())) {
                event.setCancelled(true);
                return;
            }
        }
    }

}
项目:modules-extra    文件:ListenerContainerItem.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryDrag(InventoryDragEvent event)
{
    if (event.getWhoClicked() instanceof Player)
    {
        if (!this.inventoryChanges.containsKey(event.getWhoClicked().getUniqueId()))
        {
            return;
        }
        Inventory inventory = event.getInventory();
        int amount = 0;
        for (Entry<Integer, ItemStack> entry : event.getNewItems().entrySet())
        {
            if (entry.getKey() < inventory.getSize())
            {
                amount += entry.getValue().getAmount();
            }
        }
        this.prepareForLogging((Player)event.getWhoClicked(), new ItemData(event.getOldCursor()), amount);
    }
}
项目:ZentrelaRPG    文件:TrinketManager.java   
@EventHandler
public void onPlayerClickTrinket2(InventoryDragEvent event) {
    if (event.getRawSlots().contains(45)) {
        event.setCancelled(true);
        if (event.getWhoClicked().getGameMode() != GameMode.ADVENTURE && event.getWhoClicked().getGameMode() != GameMode.SURVIVAL) {
            event.getWhoClicked().getInventory().setItemInOffHand(null);
        }
        if (event.getWhoClicked() instanceof Player)
            ((Player) event.getWhoClicked()).updateInventory();
    }
}
项目:ProjectAres    文件:ItemTransferListener.java   
@EventHandler(ignoreCancelled = true)
public void onPlayerDragInventory(InventoryDragEvent event) {
    // This is when you spread items evenly across slots by dragging
    if(!(event.getWhoClicked() instanceof Player)) {
        return;
    }
    Player player = (Player) event.getWhoClicked();

    ItemStack transferred = event.getOldCursor().clone();
    transferred.setAmount(0);
    Inventory externalInventory = null;

    for(Map.Entry<Integer, ItemStack> entry : event.getNewItems().entrySet()) {
        Inventory inventory = getLocalInventory(event.getView(), entry.getKey());
        if(inventory.getHolder() != player) {
            // Add stacks to the total if they are dragged over an external inventory
            externalInventory = inventory;
            transferred.setAmount(transferred.getAmount() + entry.getValue().getAmount());
        }
    }

    if(externalInventory != null) {
        int initialQuantity = transferred.getAmount();
        PlayerItemTransferEvent transferEvent = new PlayerItemTransferEvent(
            event, ItemTransferEvent.Type.PLACE, player,
            Optional.empty(),
            Optional.of(new InventorySlot<>(externalInventory)),
            transferred, null, initialQuantity,
            event.getOldCursor()
        );

        this.callEvent(transferEvent);

        if(initialQuantity != transferEvent.getQuantity()) {
            // If the quantity changes, we have to cancel the entire drag,
            // because bukkit does not let us modify the dragged stacks.
            event.setCancelled(true);
        }
    }
}
项目:RPGInventory    文件:InventoryListener.java   
@EventHandler(ignoreCancelled = true)
public void onInventoryDrag(InventoryDragEvent event) {
    Player player = (Player) event.getWhoClicked();

    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    for (Integer rawSlotId : event.getRawSlots()) {
        ItemStack cursor = event.getOldCursor();
        Inventory inventory = event.getInventory();

        if (PetManager.isPetItem(cursor)) {
            event.setCancelled(true);
            return;
        }

        if (inventory.getType() == InventoryType.CRAFTING) {
            if (InventoryManager.get(player).isOpened()) {
                return;
            }

            // Shield slot is QUICKBAR and has rawId - 45 o.O
            if (rawSlotId >= 1 && rawSlotId <= 8 || rawSlotId == 45) {
                event.setCancelled(true);
                return;
            }
        } else if (InventoryAPI.isRPGInventory(inventory)) {
            if (rawSlotId < 54) {
                event.setCancelled(true);
                return;
            }
        }
    }
}
项目:RPGInventory    文件:ArmorEquipListener.java   
@EventHandler(ignoreCancelled = true)
public void onDragEquip(InventoryDragEvent event) {
    Player player = (Player) event.getWhoClicked();
    if (!InventoryManager.playerIsLoaded(player) || InventoryAPI.isRPGInventory(event.getInventory())) {
        return;
    }

    if (event.getRawSlots().size() == 1) {
        int slot = (int) event.getRawSlots().toArray()[0];

        event.setCancelled(slot >= 5 && slot <= 8 && event.getInventory().getType() == InventoryType.CRAFTING);
    }
}
项目:HCFCore    文件:KeyListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onInventoryDrag(InventoryDragEvent event) {
    Inventory inventory = event.getInventory();
    Inventory topInventory = event.getView().getTopInventory();
    if (inventory != null && topInventory != null && topInventory.equals(inventory) && topInventory.getTitle().endsWith(" Key Reward")) { // TODO: More reliable
        event.setCancelled(true);
    }
}
项目:HCFCore    文件:KeyListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onInventoryDrag(InventoryDragEvent event) {
    Inventory inventory = event.getInventory();
    Inventory topInventory = event.getView().getTopInventory();
    if (inventory != null && topInventory != null && topInventory.equals(inventory) && topInventory.getTitle().endsWith(" Key Reward")) { // TODO: More reliable
        event.setCancelled(true);
    }
}
项目:ZentrelaCore    文件:MenuManager.java   
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
    UUID uuid = event.getWhoClicked().getUniqueId();
    if (invClickables.containsKey(uuid)) {
        HashMap<String, HashMap<String, Runnable>> invs = invClickables.get(uuid);
        if (event.getInventory().getName() != null && invs.containsKey(event.getInventory().getName())) {
            event.setCancelled(true);
            ((Player) event.getWhoClicked()).updateInventory();
        }
    }
}
项目:BukkitOldCombatMechanics    文件:ModuleDisableOffHand.java   
@EventHandler (priority = EventPriority.HIGHEST)
public void onInventoryDrag(InventoryDragEvent e){
    if(!isEnabled(e.getWhoClicked().getWorld()) || 
            e.getInventory().getType() != InventoryType.CRAFTING ||
            !e.getInventorySlots().contains(40)) return;

    if(shouldWeCancel(e.getOldCursor())){
        e.setResult(Event.Result.DENY);
        e.setCancelled(true);
    }
}
项目:Duels    文件:SpectatorManager.java   
@EventHandler
public void on(InventoryDragEvent event) {
    Player player = (Player) event.getWhoClicked();

    if (!isSpectating(player)) {
        return;
    }

    event.setCancelled(true);
}
项目:SkullGetter    文件:SkullEventer.java   
public static void InventoryDrag(InventoryDragEvent event)
{
    Inventory inventory = event.getInventory();
    if ( inventory.getName().contains("SkullInventory"))
    {
        event.setCancelled(true);
        return;
    }
}
项目:MysteryBags    文件:MysteryBagsListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void inventoryDragEvent(InventoryDragEvent e) {
    if (e.getInventory() == null)
        return;

    if (check(e.getInventory().getType(), e.getOldCursor()))
        e.setCancelled(true);
}
项目:SharpSK    文件:ArmorEquipListener.java   
@EventHandler
public void playerDragInventoryEvent(InventoryDragEvent e) {
    ArmorType newArmorType = ArmorType.matchType(e.getOldCursor());
    if (newArmorType == null)
        return;
    ArmorEquipEvent armorEquipEvent = new ArmorEquipEvent((Player) e.getWhoClicked(), EquipMethod.DRAG,
            newArmorType, e.getOldCursor());
    if (!e.getRawSlots().contains(newArmorType.getSlot()))
        return;
    Bukkit.getServer().getPluginManager().callEvent(armorEquipEvent);
    if (armorEquipEvent.isCancelled()) {
        e.setCancelled(true);
    }
}
项目:MoreFish    文件:FishShopGUI.java   
@EventHandler
public void onDrag(InventoryDragEvent event) {
    if (users.contains(event.getWhoClicked().getUniqueId())) {
        event.getInventory().setItem(31, new ItemStack(Material.AIR));
        final Inventory inv = event.getInventory();
        plugin.getServer().getScheduler().runTaskLater(plugin, () -> updateEmeraldIcon(inv), 1L);
    }
}
项目:SimpleFreeze    文件:InventoryDragListener.java   
@EventHandler
public void onDrag(InventoryDragEvent e) {
    Player p = (Player) e.getWhoClicked();
    if (this.guiManager.containsPlayer(p.getUniqueId()) && p.getOpenInventory().getTopInventory().equals(e.getInventory())) {
        e.setCancelled(true);
    }
}
项目:TimeIsMoney    文件:ATM.java   
@EventHandler
public void onInventoryDrag(InventoryDragEvent e) {
    if (e == null) return;
    if (e.getInventory() == null) return;
    if (e.getInventory().getTitle() == null) return;
    if (e.getInventory().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
        e.setResult(Result.DENY);
    }
}
项目:simple-trading    文件:DefaultTrade.java   
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
    Player player = (Player) event.getWhoClicked();

    TradePlayer tradePlayer = initiator.getPlayer() == player ? initiator : partner.getPlayer() == player ? partner : null;
    if (tradePlayer == null) {
        //This event does not belong to this trade
        return;
    }

    event.setCancelled(true);
}
项目:ArmorStandTools    文件:MainListener.java   
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
    if (event.isCancelled() || !(event.getWhoClicked() instanceof Player)) return;
    final Player p = (Player) event.getWhoClicked();
    if (event.getInventory().getHolder() != p && Utils.containsItems(event.getNewItems().values())) {
        event.setCancelled(true);
        //noinspection deprecation
        p.updateInventory();
    }
}
项目:demigames    文件:KitListener.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onInventoryDrag(InventoryDragEvent event) {
    Profile profile = INST.getProfileRegistry().fromPlayer(INST, (Player) event.getWhoClicked());
    if (event.getWhoClicked().getGameMode() != GameMode.CREATIVE && profile.getKit().isPresent() &&
            profile.getKit().get() instanceof ImmutableKit) {
        event.setCancelled(true);
        ((Player) event.getWhoClicked()).updateInventory();
    }
}
项目:EditArmorStands    文件:ArmorStandGui.java   
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
    if (open && event.getWhoClicked().getUniqueId().equals(player.getUniqueId()) && event.getView() == gui) {
        for (int i = 0; i < inventory.getSize(); i++) {
            if (event.getRawSlots().contains(i)) {
                event.setCancelled(true);
                return;
            }
        }
    }
}
项目:ZombieEscape    文件:MenuManager.java   
@EventHandler
public void onClick(InventoryDragEvent e) {
    Inventory inv = e.getWhoClicked().getOpenInventory().getTopInventory();
    for (Menu menu : menus.values()) {
        if (menu.getInventory().getName().equals(inv.getName())) {
            e.setCancelled(true);
        }
    }
}
项目:civcraft    文件:TradeInventoryListener.java   
@EventHandler(priority = EventPriority.LOW)
public void onInventoryDragEvent(InventoryDragEvent event) {
    if (!(event.getWhoClicked() instanceof Player)) {
        return;
    }
    Player player = (Player)event.getWhoClicked();
    Resident resident = CivGlobal.getResident(player);
    TradeInventoryPair pair = tradeInventories.get(getTradeInventoryKey(resident));
    if (pair == null) {
        return;
    }

    Inventory savedTradeInventory = pair.inv;
    if (savedTradeInventory == null) {
        return;
    }

    if (!savedTradeInventory.getName().equals(event.getInventory().getName())) {
        return;
    }

    for (int slot : event.getRawSlots()) {
        if (!handleSlotChange(slot, pair)) {
            event.setCancelled(true);
            return;
        }
    }
}
项目:well-auction    文件:AuctionShopInventoryListener.java   
/**
 * Cancel inventory drags in Auction Houses.
 * 
 * @param evt
 *            the evt
 */
@EventHandler
public void onInventoryDrag(final InventoryDragEvent evt) {
    if (inventoryManager.isAuctionInventory(evt.getInventory())) {
        for (int slot : evt.getRawSlots()) {
            if (slot < evt.getView().getTopInventory().getSize()) {
                evt.setCancelled(true);
                return;
            }
        }
    }
}
项目:ProSpam    文件:GuiManager.java   
@EventHandler(ignoreCancelled = true)
public void onInventoryDrag(InventoryDragEvent event)
{
    Inventory inventory = event.getInventory();

    if(isInventoryGui(HiddenId.grabId(inventory.getTitle())))
    {
        event.setCancelled(true);
    }

}
项目:rftd    文件:InventoryListener.java   
@EventHandler
public void onInventoryDrag(InventoryDragEvent e) {
    if(controller.isPlaying()
            && e.getOldCursor().getType() == Material.EYE_OF_ENDER) {
        int size = e.getInventory().getSize();
        for(int slot : e.getRawSlots()) {
            if(slot < size) {
                e.setResult(Result.DENY);
                break;
            }
        }
    }
}
项目:McMMOPlus    文件:InventoryListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryDragEvent(InventoryDragEvent event) {
    Inventory inventory = event.getInventory();

    if (!(inventory instanceof BrewerInventory)) {
        return;
    }

    InventoryHolder holder = inventory.getHolder();

    if (!(holder instanceof BrewingStand)) {
        return;
    }

    HumanEntity whoClicked = event.getWhoClicked();

    if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.secondaryAbilityEnabled(whoClicked, SecondaryAbility.CONCOCTIONS)) {
        return;
    }

    if (!event.getInventorySlots().contains(Alchemy.INGREDIENT_SLOT)) {
        return;
    }

    ItemStack cursor = event.getCursor();
    ItemStack ingredient = ((BrewerInventory) inventory).getIngredient();

    if (AlchemyPotionBrewer.isEmpty(ingredient) || ingredient.isSimilar(cursor)) {
        Player player = (Player) whoClicked;

        if (AlchemyPotionBrewer.isValidIngredient(player, cursor)) {
            // Not handled: dragging custom ingredients over ingredient slot (does not trigger any event)
            AlchemyPotionBrewer.scheduleCheck(player, (BrewingStand) holder);
            return;
        }

        event.setCancelled(true);
        AlchemyPotionBrewer.scheduleUpdate(inventory);
    }
}
项目:BetonQuest    文件:QuestItemHandler.java   
@EventHandler
public void onItemDrag(InventoryDragEvent event) {
    if (!(event.getWhoClicked() instanceof Player)) {
        return;
    }
    if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE) {
        return;
    }
    String playerID = PlayerConverter.getID((Player) event.getWhoClicked());
    if (Journal.isJournal(playerID, event.getOldCursor()) || Utils.isQuestItem(event.getOldCursor())) {
        event.setCancelled(true);
    }
}
项目:SavageDeathChest    文件:InventoryEventListener.java   
/**
 * Prevent placing items in death chests if configured
 * @param event
 */
@EventHandler
public void onInventoryDragEvent(InventoryDragEvent event) {

    Inventory inventory = event.getInventory();

    // if inventory is a death chest inventory
    if (inventoryIsDeathChest(inventory)) {

        // if prevent-item-placement is configured false, do nothing and return
        if (!plugin.getConfig().getBoolean("prevent-item-placement")) {
            return;
        }

        // get set of slots dragged over
        Set<Integer> rawSlots = event.getRawSlots();

        // if single chest set max slot to 27
        int maxSlot = 27;

        // if double chest set max slot to 54
        if (inventory.getHolder() instanceof DoubleChest) {
            maxSlot = 54;
        }

        // iterate over dragged slots and if any are above max slot, cancel event
        for (int slot : rawSlots) {
            if (slot < maxSlot) {

                // if player does not have allow-place permission, cancel event
                if (!event.getWhoClicked().hasPermission("deathchest.allow-place")) {
                    event.setCancelled(true);
                }
                break;
            }
        }
    }
}
项目:ce    文件:CEListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void inventoryMenuPrevention(InventoryDragEvent event) {
    if (event.getView().getTopInventory().getTitle().startsWith("CE"))
        event.setCancelled(true);
    else if (useRuneCrafting)
        if (event.getView().getTopInventory().getName().equals(
                ChatColor.LIGHT_PURPLE + "" + ChatColor.MAGIC + "abc" + ChatColor.RESET + ChatColor.DARK_PURPLE + " Runecrafting " + ChatColor.LIGHT_PURPLE + "" + ChatColor.MAGIC + "cba")) {
            CEventHandler.updateRunecraftingInventory(event.getInventory());
            return;
        }
}