mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
46 lines
975 B
Java
46 lines
975 B
Java
package com.gmail.nossr50.skills.archery;
|
|
|
|
import java.util.UUID;
|
|
|
|
import org.bukkit.entity.LivingEntity;
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
|
|
public class TrackedEntity extends BukkitRunnable {
|
|
private LivingEntity livingEntity;
|
|
private UUID id;
|
|
private int arrowCount;
|
|
|
|
protected TrackedEntity(LivingEntity livingEntity) {
|
|
this.livingEntity = livingEntity;
|
|
this.id = livingEntity.getUniqueId();
|
|
|
|
this.runTaskTimer(mcMMO.p, 12000, 12000);
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
if (!livingEntity.isValid()) {
|
|
Archery.removeFromTracker(this);
|
|
this.cancel();
|
|
}
|
|
}
|
|
|
|
protected LivingEntity getLivingEntity() {
|
|
return livingEntity;
|
|
}
|
|
|
|
protected UUID getID() {
|
|
return id;
|
|
}
|
|
|
|
protected int getArrowCount() {
|
|
return arrowCount;
|
|
}
|
|
|
|
protected void incrementArrowCount() {
|
|
arrowCount++;
|
|
}
|
|
}
|