Package arc.util

Class Ratekeeper

java.lang.Object
arc.util.Ratekeeper

public class Ratekeeper extends Object
Keeps track of X actions in Y units of time.
  • Field Details

    • occurences

      public int occurences
    • lastTime

      public long lastTime
  • Constructor Details

    • Ratekeeper

      public Ratekeeper()
  • Method Details

    • allow

      public boolean allow(long spacing, int cap)
      Parameters:
      spacing - the spacing between action chunks in milliseconds
      cap - the maximum amount of actions per chunk
      Returns:
      whether an action is allowed.