razormc

Untitled

Jan 11th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.61 KB | None | 0 0
  1. public void processCommand(String string){
  2.         String comName = (parser.getCommand(string)== null)?"":parser.getCommand(string).getName();
  3.        
  4.         if(parser.getCommand(string) == null) {
  5.             System.out.println("Taky prikaz nepoznam");
  6.         }
  7.         else if (comName.equals("PRESKUMAJ") || (comName.equals("VEZMI")) ||
  8.                 (comName.equals("POLOZ")) || (comName.equals("POUZI"))){
  9.              
  10.                 parser.getCommand(string).execute(this, string.substring(((comName.length()+1)>string.length()) ? string.length() : comName.length()+1, string.length()));
  11.                 History.getInstance().add(string);
  12.         }
  13.        
  14.        
  15.         else if (comName.equals("ULOZ")){
  16.             parser.getCommand(string).execute(this, string.substring(((comName.length()+1)>string.length()) ? string.length() : comName.length()+1, string.length()));
  17.         }
  18.        
  19.         else if (comName.equals("NACITAJ")){
  20.             init();
  21.             gameState = GameState.PLAYING;
  22.             parser.getCommand(string).execute(this, string.substring(((comName.length()+1)>string.length()) ? string.length() : comName.length()+1, string.length()));
  23.             List<String> tempHistory = new ArrayList<String>();
  24.             for(String command : History.historyCommands) {
  25.                 innerProcessCommand(command);
  26.                 tempHistory.add(command);
  27.             }
  28.             History.historyCommands = tempHistory;
  29.         }    
  30.        
  31.         else {
  32.         parser.getCommand(string).execute(this, string);
  33.         History.getInstance().add(string);
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment