Check out example codes for "bukkit hit without damaged". It will help you in understanding the concepts better.

Code Example 1

package de.thelexoplexx.TnTTagMain;
 
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
 
public class HitPlayer implements Listener {
   
    @EventHandler
    public void onPlayerDamage(EntityDamageByEntityEvent e){
        if(e.getEntity() instanceof Player){
            if(e.getDamager() instanceof Player) {
                e.setDamage(0.00);
            }
        }
    }
}

Learn ReactJs, React Native from akashmittal.com