Buggy code:
if ( ( heldItem != null ) && ( ( event . getSlotType ( ) ) == ( SlotType . ARMOR ) ) ) { if ( Wand . isSpell ( heldItem ) ) { event . setCancelled ( true ) ; } if ( ( Wand . isWand ( clickedItem ) ) || ( Wand . isWand ( heldItem ) ) ) { onArmorUpdated ( mage ) ; } } boolean isHotbar = ( ( event . getAction ( ) ) == ( InventoryAction . HOTBAR_SWAP ) ) || ( ( event . getAction ( ) ) == ( InventoryAction . HOTBAR_MOVE_AND_READD ) ) ; if ( isHotbar && ( ( event . getSlotType ( ) ) == ( SlotType . ARMOR ) ) ) { int slot = event . getHotbarButton ( ) ; ItemStack item = mage . getPlayer ( ) . getInventory ( ) . getItem ( slot ) ; if ( ( item != null ) && ( Wand . isSpell ( item ) ) ) { event . setCancelled ( true ) ; return ; } onArmorUpdated ( mage ) ; } if ( ( ( event . getAction ( ) ) == ( InventoryAction . MOVE_TO_OTHER_INVENTORY ) ) && ( clickedItem != null ) ) { Material itemType = clickedItem . getType ( ) ; if ( wearableMaterials . contains ( itemType ) ) { onArmorUpdated ( mage ) ; } } Wand activeWand = mage . getActiveWand ( ) ; boolean clickedWand = Wand . isWand ( clickedItem ) ; if ( ( activeWand != null ) && ( activeWand . isInventoryOpen ( ) ) ) { if ( ( Wand . isSpell ( clickedItem ) ) && ( ( clickedItem . getAmount ( ) ) != 1 ) ) { clickedItem . setAmount ( 1 ) ; } if ( clickedWand ) { event . setCancelled ( true ) ; activeWand . cycleHotbar ( 1 ) ; return ; } if ( isHotbar && ( Wand . isWand ( player . getInventory ( ) . getItem ( event . getHotbarButton ( ) ) ) ) ) { event . setCancelled ( true ) ; return ; } if ( ( ( event . getAction ( ) ) == ( InventoryAction . MOVE_TO_OTHER_INVENTORY ) ) && ( clickedItem != null ) ) { Material itemType = clickedItem . getType ( ) ; if ( wearableMaterials . contains ( itemType ) ) { event . setCancelled ( true ) ; return ; } } if ( Wand . isWand ( event . getCursor ( ) ) ) { activeWand . closeInventory ( ) ; event . setCursor ( null ) ; event . setCancelled ( true ) ; return ; } } else if ( activeWand != null ) { Integer activeSlot = activeWand . getPlayerInventorySlot ( ) ; if ( ( ( activeSlot != null ) && ( ( event . getSlot ( ) ) == activeSlot ) ) || ( ( ( event . getAction ( ) ) == ( InventoryAction . HOTBAR_SWAP ) ) && ( ( event . getHotbarButton ( ) ) == activeSlot ) ) ) { activeWand . deactivate ( ) ; activeWand = null ; } } if ( isDrop ) { if ( clickedWand ) { Wand wand = new Wand ( this , clickedItem ) ; if ( wand . isUndroppable ( ) ) { event . setCancelled ( true ) ; if ( activeWand != null ) { if ( ( activeWand . getHotbarCount ( ) ) > 1 ) { activeWand . cycleHotbar ( 1 ) ; } else { activeWand . closeInventory ( ) ; } } return ; } } if ( ( activeWand != null ) && ( activeWand . isInventoryOpen ( ) ) ) { ItemStack droppedItem = clickedItem ; if ( ! ( Wand . isSpell ( droppedItem ) ) ) { mage . giveItem ( droppedItem ) ; event . setCurrentItem ( null ) ; event . setCancelled ( true ) ; return ; } Integer slot = event . getSlot ( ) ; int heldSlot = player . getInventory ( ) . getHeldItemSlot ( ) ; Inventory hotbar = activeWand . getHotbar ( ) ; <START_BUG> if ( ( ( ( hotbar != null ) && ( slot >= 0 ) ) && ( slot <= ( hotbar . getSize ( ) ) ) ) && ( slot != heldSlot ) ) { <END_BUG> if ( slot > heldSlot ) slot -- ; if ( slot < ( hotbar . getSize ( ) ) ) { droppedItem = hotbar . getItem ( slot ) ; } else { slot = null ; } } else { slot = null ; } if ( ! ( spellDroppingEnabled ) ) { player . closeInventory ( ) ; String spellName = Wand . getSpell ( droppedItem ) ; if ( spellName != null ) { Spell spell = mage . getSpell ( spellName ) ; if ( spell != null ) { activeWand . cast ( spell ) ; if ( ( hotbar != null ) && ( slot != null ) ) { droppedItem = hotbar . getItem ( slot ) ; } } } event . setCancelled ( true ) ; if ( ( hotbar != null ) && ( slot != null ) ) { player . getInventory ( ) . setItem ( event . getSlot ( ) , droppedItem ) ; player . updateInventory ( ) ; } return ; } ItemStack newDrop = removeItemFromWand ( activeWand , droppedItem ) ; if ( newDrop != null ) { Location location = player . getLocation ( ) ; Item item = location . getWorld ( ) . dropItem ( location , newDrop ) ; item . setVelocity ( location . getDirection ( ) . normalize ( ) ) ; } else { event . setCancelled ( true ) ; } } return ; }

Fix:
if ( ( ( ( ( hotbar != null ) && ( slot >= 0 ) ) && ( slot <= ( hotbar . getSize ( ) ) ) ) && ( slot != heldSlot ) ) && ( ( activeWand . getMode ( ) ) == ( WandMode . INVENTORY ) ) ) {