Package commands

Examples of commands.Command


    }
  }

  public void run() {
    while (ts3.getSocket()!= null &&ts3.getSocket().isConnected() && ts3.getOut() != null && !stop) {
      Command c = ts3.getCommandList().peek();
      if (c != null && !c.isSent()) {
        String msg = c.toString();
        TS3Query.log.info("> " + msg);
        ts3.getOut().println(msg);
        lastCommand = System.currentTimeMillis();
        c.setSent();
      }
      try {
        Thread.sleep(floodRate);
      } catch (InterruptedException e) {
        e.printStackTrace();
View Full Code Here


    while (ts3.getSocket()!= null && ts3.getSocket().isConnected() && ts3.getIn() != null && !stop) {
      try {
        if (ts3.getIn().ready()) {
          final String line = ts3.getIn().readLine();
          if (!line.isEmpty()) {
            Command c = ts3.getCommandList().peek();
            if (line.startsWith("notify")) {
              TS3Query.log.info("< [event] " + line);
              new Thread(new Runnable() {

                public void run() {
                  String arr[] = line.split(" ", 2);
                  ts3.getEventManager().fireEvent(arr[0],
                      arr[1]);

                }
              }).start();

            } else if (c != null && c.isSent()) {
              TS3Query.log
                  .info("[" + c.getName() + "] < " + line);
              if (line.startsWith("error")) {
                c.feedError(line.substring("error ".length()));
                if (c.getError().getId() != 0) {
                  TS3Query.log.severe("[ERROR] "
                      + c.getError());
                }
                c.setAnswered();
                ts3.getCommandList().remove(c);
              } else if (!line.isEmpty()) {
                c.feed(line);
              }
            } else {
              TS3Query.log.info("< " + line);
            }
          }
View Full Code Here

      long currentTime1 = Calendar.getInstance().getTimeInMillis() - initialTime;
     
      while(!commands.isEmpty()) {
        //This is the "defilage"
        synchronized(this) {
          Command command = commands.remove();
          command.doCommand();
        }
      }
     
     
      // The towers attack !!
View Full Code Here

TOP

Related Classes of commands.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.