Advertisement
Guest User

untitled

a guest
Jul 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. package com.carson;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6. String com = runCommand("send(\"hi\")");
  7. System.out.println(com);
  8. }
  9.  
  10.  
  11. // void run(T, List<String> commands){
  12. // for(String command : commands){
  13. // String retur = runCommand(T,command);
  14. // } }
  15.  
  16.  
  17. static String runCommand(String command){
  18. if(command.startsWith("{if_args_count:")){
  19. command.replace("{if_args_count:","",1);
  20. int count = Integer.parseInt(command.charAt(0));
  21. command.replace(count + "}", "",1);
  22. if(args.length == count){
  23. return runCommand(str);
  24. }
  25. return "null";
  26. }else if(command.startsWith("{args[")){
  27. command.replace("{args[","",1);
  28. int pos = //use regex
  29. command.replace(pos + "==\"","",1);
  30. String toMatch = "";
  31. while(command.charAt(0) != "\""){
  32. if(command.charAt(0) == '\\'){
  33. //remove two chars from command
  34. toMatch+= "\"";
  35. }else{
  36. toMath+=command.charAt(0);
  37. //remove one char from command
  38. }
  39. //remove {} from the end and beginning of the command
  40. return runCommand(command);
  41. }else if(command.startsWith("send(")){
  42. command.replace("send(","",1);
  43. command.substring(0,command.length-1);
  44. System.out.println(toMessage(command));
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement