Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.carson;
- public class Main {
- public static void main(String[] args) {
- String com = runCommand("send(\"hi\")");
- System.out.println(com);
- }
- // void run(T, List<String> commands){
- // for(String command : commands){
- // String retur = runCommand(T,command);
- // } }
- static String runCommand(String command){
- if(command.startsWith("{if_args_count:")){
- command.replace("{if_args_count:","",1);
- int count = Integer.parseInt(command.charAt(0));
- command.replace(count + "}", "",1);
- if(args.length == count){
- return runCommand(str);
- }
- return "null";
- }else if(command.startsWith("{args[")){
- command.replace("{args[","",1);
- int pos = //use regex
- command.replace(pos + "==\"","",1);
- String toMatch = "";
- while(command.charAt(0) != "\""){
- if(command.charAt(0) == '\\'){
- //remove two chars from command
- toMatch+= "\"";
- }else{
- toMath+=command.charAt(0);
- //remove one char from command
- }
- //remove {} from the end and beginning of the command
- return runCommand(command);
- }else if(command.startsWith("send(")){
- command.replace("send(","",1);
- command.substring(0,command.length-1);
- System.out.println(toMessage(command));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement