I did this for him and it’s working.
@Listener
public void onClick(InteractBlockEvent.Secondary event){
Player player = event.getCause().first(Player.class).get();
BlockRay optHit = BlockRay.from(player).filter(BlockRay.allFilter()).build();
BlockState state = null;
while(optHit.hasNext() && state == null){
BlockRayHit ray = optHit.next();
Vector3d lookPos = ray.getBlockPosition().toDouble();
BlockState blockState = player.getWorld().getBlock(lookPos.toInt());
state = !blockState.getType().equals(BlockTypes.AIR)?blockState:null;
}
System.out.println(state.getType());
}