Interface ITimers


  • public interface ITimers
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Removes all timers.
      void forceStart​(int id, int ticks, boolean repeat)
      Adds a timer to the NPC or player with the given attributes.
      boolean has​(int id)  
      int maxTicks​(int id)  
      boolean repeats​(int id)  
      void reset​(int id)
      Resets the ticks elapsed in the timer with the given id to 0.
      void setMaxTicks​(int id, int maxTicks)
      Sets the maximum amount of ticks the timer with the given id can run for before it stops.
      void setRepeats​(int id, boolean repeat)
      Sets whether the timer with the given id repeats or not.
      void setTicks​(int id, int ticks)
      Sets the amount of ticks elapsed in the timer with the given id to a different value.
      int size()  
      void start​(int id, int ticks, boolean repeat)
      Adds a timer to the NPC or player with the given attributes.
      boolean stop​(int id)
      Stops the timer with the given id
      int ticks​(int id)  
      int[] timerIds()  
    • Method Detail

      • timerIds

        int[] timerIds()
      • start

        void start​(int id,
                   int ticks,
                   boolean repeat)
        Adds a timer to the NPC or player with the given attributes. If this function is used and there is already a timer with the given ID, an exception will be thrown.
        Parameters:
        id - The id of the timer.
        ticks - The amount of ticks before the timer ends.
        repeat - Whether this timer repeats when it reaches its maximum amount of ticks.
      • forceStart

        void forceStart​(int id,
                        int ticks,
                        boolean repeat)
        Adds a timer to the NPC or player with the given attributes. No exception will be thrown if there is already a timer with the given ID when using this function.
        Parameters:
        id - The id of the timer.
        ticks - The amount of ticks before the timer ends.
        repeat - Whether this timer repeats when it reaches its maximum amount of ticks.
      • has

        boolean has​(int id)
        Returns:
        True if the set of timers contains a timer with the given id, false otherwise.
      • stop

        boolean stop​(int id)
        Stops the timer with the given id
        Returns:
        True if there was a timer with the given id.
      • reset

        void reset​(int id)
        Resets the ticks elapsed in the timer with the given id to 0.
      • clear

        void clear()
        Removes all timers.
      • ticks

        int ticks​(int id)
        Returns:
        The amount of ticks elapsed in the timer.
      • setTicks

        void setTicks​(int id,
                      int ticks)
        Sets the amount of ticks elapsed in the timer with the given id to a different value.
        Parameters:
        ticks - The new ticks elapsed by the timer.
      • maxTicks

        int maxTicks​(int id)
        Returns:
        The maximum amount of ticks the timer with the given id runs for before it stops.
      • setMaxTicks

        void setMaxTicks​(int id,
                         int maxTicks)
        Sets the maximum amount of ticks the timer with the given id can run for before it stops.
      • repeats

        boolean repeats​(int id)
        Returns:
        True if the timer with the given id repeats, false otherwise.
      • setRepeats

        void setRepeats​(int id,
                        boolean repeat)
        Sets whether the timer with the given id repeats or not.
      • size

        int size()
        Returns:
        The amount of timers in the set of timers.