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

    Fields
    Modifier and Type
    Field
    Description
    int
    The current amount of steps the internal loop has stepped.
    final @NotNull org.bukkit.entity.Player
    The Player that owns this timer
    final @NotNull org.bukkit.plugin.Plugin
    The Plugin that owns this timer
    final int
    The amount of steps before the Timer is exited
    final int
    The number of ticks between each step
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlayerTimer(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull org.bukkit.entity.Player player, int steps, int ticks)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
     
    protected abstract void
     
    abstract void
     
    protected abstract void
     
    void
    run()
     
    protected abstract boolean
     
    void
    start(int tickDelay)
     

    Methods inherited from class org.bukkit.scheduler.BukkitRunnable

    cancel, getTaskId, isCancelled, runTask, runTaskAsynchronously, runTaskLater, runTaskLaterAsynchronously, runTaskTimer, runTaskTimerAsynchronously

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • currentStep

      public int currentStep

      The current amount of steps the internal loop has stepped.

      When higher than steps the Timer is exited.

    • steps

      public final int steps
      The amount of steps before the Timer is exited
    • ticks

      public final int ticks
      The number of ticks between each step
    • player

      @NotNull public final @NotNull org.bukkit.entity.Player player
      The Player that owns this timer
    • plugin

      @NotNull public final @NotNull org.bukkit.plugin.Plugin plugin
      The Plugin that 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()