title: Java Thread.sleep(delay) not working
body: <p>Hi I'm trying to execute task every <code>X</code> seconds and I have problem with it:</p>
  
  <pre><code>Thread joinThread = new Thread(() -&gt; {
      for (int i = 0; i &lt; amount; i++) {
          Player player = new Player(user, RandomUtils.randomString(10), host, p, event.getSession());
          player.join();
      }
  
      try {
          Thread.sleep(delay);
      } catch (InterruptedException ignored) {
          ignored.printStackTrace();
      }
  });
  
  joinThread.start();
  </code></pre>
  
  <p>It looks like <code>Thread.sleep(delay)</code> is ignored because my thread is executing itself every ms instead of delay</p>
  
  <p>Here's my <code>join</code> method:</p>
  
  <pre><code>public void join(){
      GameProfile profile = session.getFlag("profile");
      Client c = new Client(host, port, new MinecraftProtocol(name), new TcpSessionFactory(proxy));
      c.getSession().addListener(new SessionAdapter() {
          @Override
          public void packetReceived(PacketReceivedEvent event) {
              if (event.getPacket() instanceof ServerJoinGamePacket) {
                  user.setBotAmount(u.getBotAmount()+1);
                  user.addBot(event.getSession());
                  System.out.println("Player bot joined");
              }
          }
  
          @Override
          public void disconnected(final DisconnectedEvent event) {
              if(event.getCause() != null) event.getCause().printStackTrace();
              user.setBotAmount(u.getBotAmount() -1);
          }
      });
      c.getSession().connect();
  }
  </code></pre>
  
  <p>If remove <code>player.join();</code>, it's working like a charm.<br>
  Any advice? I don't see what I'm doing wrong.</p>