title: timer in java: counter stuck at 1
body: <p>Basically I make a timer turn for networking game, so if the timer hit 0 the turn will be given to another player. If the player making a move and the timer still not hit 0, the count will reset from 10. I don't know my mistakes at my timer.</p>
  
  <pre><code>timer.scheduleAtFixedRate(new TimerTask() {
    @Override
    public void run() {
      counter++;
      if(counter % second == 0){
        System.out.println("Times Up");
        TimeOut();
      }
      if(command.startsWith("BOX1")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX2")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX3")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX4")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX5")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX6")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX7")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX8")) {
        counter=0;
        counter++;
      }
      if(command.startsWith("BOX9")) {
        counter=0;
        counter++;
      }
      else{
        System.out.println("Time left:" + (second - (counter %second)) );
      }
    }
  }, 3000, 3000);
  </code></pre>
  
  <p>So when my Server receive BOX1(Client make movement) the timer should be go 0 and increment again , but my counter stuck at 1</p>
  
  <p><a href="https://i.stack.imgur.com/rk4ki.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rk4ki.jpg" alt="enter image description here"></a></p>