public boolean addDirection(final Direction dir,final boolean face){
  RPAction action;
  Direction odir;
  int idx;
  odir=dir.oppositeDirection();
  if (directions.remove(odir)) {
    action=new RPAction();
    action.put("type","move");
    action.put("dir",-odir.get());
    send(action);
  }
  idx=directions.indexOf(dir);
  if (idx != -1) {
    if (idx == (directions.size() - 1)) {
      logger.debug("Ignoring same direction: " + dir);
      return false;
    }
    directions.remove(idx);
  }
  directions.add(dir);
  if (face) {
    action=new FaceRPAction(dir);
  }
 else {
    action=new MoveRPAction(dir);
  }
  send(action);
  return true;
}

public boolean addDirection ( final Direction dir , final boolean face ) { RPAction action ; Direction odir ; int idx ; odir = dir . oppositeDirection ( ) ; if ( directions . remove ( odir ) ) { action = new RPAction ( ) ; action . put ( "type" , "move" ) ; action . put ( "dir" , - odir . get ( ) ) ; send ( action ) ; } idx = directions . indexOf ( dir ) ; if ( idx != - 1 ) { if ( idx == ( directions . size ( ) - 1 ) ) { logger . debug ( "Ignoring same direction: " + dir ) ; return false ; } directions . remove ( idx ) ; } directions . add ( dir ) ; if ( face ) { action = new FaceRPAction ( dir ) ; } else { action = new MoveRPAction ( dir ) ; } send ( action ) ; return true ; }
add an active player movement direction .
