Class PlayerTimer
java.lang.Object
org.bukkit.scheduler.BukkitRunnable
net.mathias2246.buildmc.util.PlayerTimer
- All Implemented Interfaces:
Runnable
@Internal
public abstract class PlayerTimer
extends org.bukkit.scheduler.BukkitRunnable
Base class for running certain actions periodically on a player.
Usage is discouraged because there are better alternatives.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThe current amount of steps the internal loop has stepped.final @NotNull org.bukkit.entity.PlayerThePlayerthat owns this timerfinal @NotNull org.bukkit.plugin.PluginThePluginthat owns this timerfinal intThe amount of steps before the Timer is exitedfinal intThe number of ticks between each step -
Constructor Summary
ConstructorsConstructorDescriptionPlayerTimer(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.entity.Player player, int steps, int ticks) -
Method Summary
Methods inherited from class org.bukkit.scheduler.BukkitRunnable
cancel, getTaskId, isCancelled, runTask, runTaskAsynchronously, runTaskLater, runTaskLaterAsynchronously, runTaskTimer, runTaskTimerAsynchronously
-
Field Details
-
currentStep
public int currentStepThe current amount of steps the internal loop has stepped.
When higher than
stepsthe Timer is exited. -
steps
public final int stepsThe amount of steps before the Timer is exited -
ticks
public final int ticksThe number of ticks between each step -
player
@NotNull public final @NotNull org.bukkit.entity.Player playerThePlayerthat owns this timer -
plugin
@NotNull public final @NotNull org.bukkit.plugin.Plugin pluginThePluginthat owns this timer
-
-
Constructor Details
-
PlayerTimer
public PlayerTimer(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull org.bukkit.entity.Player player, int steps, int ticks)
-
-
Method Details
-
start
public void start(int tickDelay) -
onExit
public abstract void onExit() -
init
protected abstract void init() -
shouldCancel
protected abstract boolean shouldCancel() -
onCancel
protected abstract void onCancel() -
onStep
protected abstract void onStep() -
run
public void run()
-