Package net.shadewind.racetrack

Examples of net.shadewind.racetrack.Command


   *
   * @param playerId  The ID of the player that left.
   */
  public void playerLeft(int playerId)
  {
    sendCommand(new Command("playerLeft").append(playerId));
  }
View Full Code Here


    try {
      while (!socket.isInputShutdown()) {
        String line = in.readLine();
        if (line == null)
          break;
        Command command = Command.parseCommand(line);
        if (command == null)
          throw new CommException("Malformed command: " + line);
        processCommand(command);
      }
    } catch (Exception e) {
View Full Code Here

  private void processHello(Command command) throws RacetrackException
  {
    name = command.argument(0);
    logger.info("Client authenticated as \"" + name + "\", id = " + id);
    sendCommand(new Command("welcome").append(id));
   
    game = server.getGame();
    if (!game.join(this)) {
      sendCommand(new Command("busy"));
      disconnect();
    }
  }
View Full Code Here

    out = new PrintWriter(socket.getOutputStream());
    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    thread = new Thread(new ReaderRunnable(), "ClientThread");
    thread.start();

    sendCommand(new Command("hello").append(name));
  }
View Full Code Here

      throw new IllegalStateException("Client is not game master.");
   
    if (!availableMaps.containsKey(map))
      throw new IllegalArgumentException("The specified map ID " + map + " is not available.");
   
    sendCommand(new Command("start").append(map).append(enableCollisions));
  }
View Full Code Here

   *
   * @param acc  The acceleration. Will be clamped to [-1,1] in both axes by the server.
   */
  public void drive(Vector2i acc)
  {
    Command command = new Command("drive");
    command.append(acc.x());
    command.append(acc.y());
    sendCommand(command);
  }
View Full Code Here

  {
    try {
      while (!socket.isClosed()) {
        String line = in.readLine();
        logger.info(line);
        Command command = Command.parseCommand(line);
        if (command == null)
          throw new CommException("Malformed command.");
        processCommand(command);
      }
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of net.shadewind.racetrack.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.