<commit_before>package tc.oc.tracker.event;

import javax.annotation.Nonnull;

import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityEvent;

import tc.oc.tracker.Damage;
import tc.oc.tracker.Lifetime;

import com.google.common.base.Preconditions;

/**
 * Called when an entity undergoes some type of damage.
 */
public class EntityDamageEvent extends EntityEvent implements Cancellable {
    private final @Nonnull Lifetime lifetime;
    private final @Nonnull Damage damage;
    private int hearts;
    private boolean cancelled = false;

    public EntityDamageEvent(@Nonnull Entity entity, @Nonnull Lifetime lifetime, @Nonnull Damage damage) {
        super(entity);

        Preconditions.checkNotNull(lifetime, "lifetime");
        Preconditions.checkNotNull(damage, "damage");

        this.lifetime = lifetime;
        this.damage = damage;
        this.hearts = damage.getHearts();
    }

    public @Nonnull Lifetime getLifetime() {
        return this.lifetime;
    }

    public @Nonnull Damage getDamage() {
        return this.damage;
    }

    public int getHearts() {
        return this.hearts;
    }

    public void setHearts(int hearts) {
        Preconditions.checkArgument(hearts >= 0, "hearts must be greater than or equal to zero");

        this.hearts = hearts;
    }

    public boolean isCancelled() {
        return this.cancelled;
    }

    public void setCancelled(boolean cancel) {<commit_msg>Add more information to EntityDamageEvent.<commit_after>package tc.oc.tracker.event;

import javax.annotation.Nonnull;

import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityEvent;
import org.joda.time.Instant;

import tc.oc.tracker.DamageInfo;
import tc.oc.tracker.Lifetime;

import com.google.common.base.Preconditions;

/**
 * Called when an entity undergoes some type of damage.
 */
public class EntityDamageEvent extends EntityEvent implements Cancellable {
    private final @Nonnull Lifetime lifetime;
    private int hearts;
    private final @Nonnull Location location;
    private final @Nonnull Instant time;
    private final @Nonnull DamageInfo info;
    private boolean cancelled = false;

    public EntityDamageEvent(@Nonnull Entity entity, @Nonnull Lifetime lifetime, int hearts, @Nonnull Location location, @Nonnull Instant time, @Nonnull DamageInfo info) {
        super(entity);

        Preconditions.checkNotNull(lifetime, "lifetime");
        Preconditions.checkArgument(hearts >= 0, "hearts must be greater than or equal to zero");
        Preconditions.checkNotNull(location, "location");
        Preconditions.checkNotNull(time, "time");
        Preconditions.checkNotNull(info, "damage info");

        this.lifetime = lifetime;
        this.hearts = hearts;
        this.location = location.clone();
        this.time = time;
        this.info = info;
    }

    public int getHearts() {
        return this.hearts;
    }

    public void setHearts(int hearts) {
        Preconditions.checkArgument(hearts >= 0, "hearts must be greater than or equal to zero");

        this.hearts = hearts;
    }

    public @Nonnull Location getLocation() {
        return this.location;
    }

    public @Nonnull Instant getTime() {
        return this.time;
    }

    public @Nonnull Lifetime getLifetime() {
        return this.lifetime;
    }

    public @Nonnull DamageInfo getInfo() {
        return this.info;
    }

    public boolean isCancelled() {
        return this.cancelled;
    }

    public void setCancelled(boolean cancel) {
{'fraction_non_alphanumeric': 0.09098294069861901, 'fraction_numerical': 0.0008123476848090983, 'mean_word_length': 3.1834654586636466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5560195', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1043, 'n_words': 288}