Advertisement
Guest User

Untitled

a guest
Nov 15th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. public class ClickIncreaser
  2. {
  3.   private boolean hasClickedThisTick = false;
  4.   private final List<Long> clicks = Lists.newArrayList();
  5.  
  6.   @SubscribeEvent
  7.   public void onMouse(MouseEvent event)
  8.   {
  9.     if (event.button != 0) {
  10.       return;
  11.     }
  12.  
  13.     if (event.buttonstate && this.hasClickedThisTick)
  14.     {
  15.       event.setCanceled(true);
  16.       return;
  17.     }
  18.  
  19.     if (event.buttonstate)
  20.     {
  21.       this.hasClickedThisTick = true;
  22.       clicks.add(Long.valueOf(System.currentTimeMillis()));
  23.     }
  24.   }
  25.  
  26.   @SubscribeEvent
  27.   public void onClientTick(TickEvent.ClientTickEvent event)
  28.   {
  29.     this.hasClickedThisTick = false;
  30.   }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement