When placing a block, the getItemInHand() method in BlockPlaceEvent event (not in the Player object) always return the item in the main hand, even if the block placed from the off-hand
Code:
@EventHandler public void onBlockPlace(BlockPlaceEvent e) { System.out.println("onBlockPlace() called"); System.out.println("onBlockPlace() item: " + e.getItemInHand().getType()); }
Result (Sand in off-hand, apple in main hand):
[23:11:41 INFO]: onBlockPlace() called
[23:11:41 INFO]: onBlockPlace() item: APPLE
Result 2 (Sand in off-hand, nothing in main hand):
[23:12:05 INFO]: onBlockPlace() called
[23:12:05 INFO]: onBlockPlace() item: AIR