AnvilGUI Enchanting an Item

Discussion in 'Plugin Development' started by XeFGolden, Jan 24, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    XeFGolden

    Hi. So basically I created a seperate itemstack "SoulBound". What I am doing is checking if the lore contains "SoulBound I", everything works fine. My problem is the AnvilGUI. I'm trying to combine my enchanted book and this could be applied to any item to create an item with the lore "SoulBound I".


    Code:
     @EventHandler
        public void onClick(InventoryClickEvent e) {
            if (e.getWhoClicked() instanceof Player) {
                if (e.getView().getType() == InventoryType.ANVIL) {
                    AnvilInventory anvilInv = (AnvilInventory) e.getInventory();
                    int slot = e.getRawSlot();
                    //e.getWhoClicked().sendMessage(String.valueOf(slot));
    
                    if (slot == 1) {
                        Bukkit.broadcastMessage("Debug - 1");
                        if (e.getCurrentItem() != null || e.getCurrentItem().getType() != Material.AIR) {
                            Bukkit.broadcastMessage("Debug - 2");
                            if (e.getCurrentItem().getType() == this.soul.getType()) {
                                Bukkit.broadcastMessage("Debug - 3");
                                if (anvilInv.getItem(0).getType() != null || anvilInv.getItem(0).getType() != Material.AIR) {
                                
    
                                    Bukkit.broadcastMessage("Debug - 4");
    
                                }
                            }
    
                        }
     
  2. Offline

    Zombie_Striker

    @XeFGolden
    So? Whats your problem? Does your debug work?
    The type will never be null because it will always be equal to something, and it will never be air because the itemstack would be null.
     
Thread Status:
Not open for further replies.

Share This Page