tr.com.infumia.task.BukkitInternalTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of task-bukkit Show documentation
Show all versions of task-bukkit Show documentation
A simple builder-like task organizer library for Bukkit.
The newest version!
package tr.com.infumia.task;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
import lombok.Getter;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
@Getter
final class BukkitInternalTask extends BukkitRunnable implements InternalTask {
@NotNull
private final Predicate backingTask;
@NotNull
private final AtomicBoolean cancelled = new AtomicBoolean(false);
@NotNull
private final AtomicInteger counter = new AtomicInteger(0);
BukkitInternalTask(@NotNull final Predicate backingTask) {
this.backingTask = backingTask;
}
@Override
public int id() {
return this.getTaskId();
}
}