Line tracing for jump collision

Do I understand you correct that the reason your own character took damage is because the enemy can cause you damage? And that sometimes the enemy managed to inflict damage on your character before your character did on the enemy?

Is what you want: Your character can only inflict damage from jumping onto the enemy. The enemy can only inflict damage when character runs in form the side? Let me know if is the intended behavior and I will send some example code!