Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. package net.minecraft.squad.utils;
  2.  
  3. /**
  4. * @author Serj
  5. * Copyright all for Serj and Mojang
  6. * Crate Date 03.03.2018
  7. * Do not touch the code
  8. */
  9. public class Counter
  10. {
  11. private long lastMS;
  12.  
  13. public long getCurrentMS()
  14. {
  15. return System.nanoTime() / 1000000L;
  16. }
  17.  
  18. public long getLastMS()
  19. {
  20. return this.lastMS;
  21. }
  22.  
  23. public long getValue()
  24. {
  25. return getCurrentMS() - this.lastMS;
  26. }
  27. public boolean hasReached(final double milliseconds)
  28. {
  29. return this.getCurrentMS() - this.lastMS >= milliseconds;
  30. }
  31. public boolean hasReached(final int milliseconds)
  32. {
  33. return this.getCurrentMS() - this.lastMS >= milliseconds;
  34. }
  35. public boolean hasReached(final long milliseconds)
  36. {
  37. return this.getCurrentMS() - this.lastMS >= milliseconds;
  38. }
  39.  
  40. public boolean hasReached(final float milliseconds)
  41. {
  42. return this.getCurrentMS() - this.lastMS >= milliseconds;
  43. }
  44.  
  45. public boolean hasReached(final Float milliseconds)
  46. {
  47. return this.getCurrentMS() - this.lastMS >= milliseconds;
  48. }
  49.  
  50. public void reset()
  51. {
  52. this.lastMS = this.getCurrentMS();
  53. }
  54.  
  55. public void setLastMS(final long currentMS)
  56. {
  57. this.lastMS = currentMS;
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement