public static string parseEffect(string[] args, Compiler.Context context, string text, int rec = 0) { if (args.Length < 7) { string output; if (args[0] != "clear") { if (context.isEntity(args[1])) { output = "effect give " + context.GetEntitySelector(args[1]) + " " + Compiler.smartEmpty(args[2]) + " " + Compiler.smartEmpty(args[3]) + " " + Compiler.smartEmpty(args[4]) + " " + Compiler.smartEmpty(args[5]); } else { output = "effect give @s " + Compiler.smartEmpty(args[1]) + " " + Compiler.smartEmpty(args[2]) + " " + Compiler.smartEmpty(args[3]) + " " + Compiler.smartEmpty(args[4]); } } else { if (context.isEntity(args[1])) { output = "effect clear " + context.GetEntitySelector(args[1]) + " " + Compiler.smartEmpty(args[2]); } else { output = "effect clear @s " + Compiler.smartEmpty(args[1]); } } return(output + '\n'); } else { return(Compiler.functionEval(text, null, "=", rec + 1)); } }
public static string parseGamemode(string[] args, Compiler.Context context, string text, int rec = 0) { if (args.Length == 2 && context.isEntity(args[0])) { int tmpI; string output; if (int.TryParse(args[1], out tmpI)) { output = "gamemode " + difficulties[tmpI] + " " + context.GetEntitySelector(args[0]); } else { output = "gamemode " + Compiler.smartEmpty(args[1]) + " " + context.GetEntitySelector(args[0]); } return(output + '\n'); } else if (args.Length == 2 && context.isEntity(args[1])) { int tmpI; string output; if (int.TryParse(args[0], out tmpI)) { output = "gamemode " + difficulties[tmpI] + " " + context.GetEntitySelector(args[1]); } else { output = "gamemode " + Compiler.smartEmpty(args[0]) + " " + context.GetEntitySelector(args[1]); } return(output + '\n'); } else if (args.Length == 1) { int tmpI; string output; if (int.TryParse(args[0], out tmpI)) { output = "gamemode " + difficulties[tmpI] + " @s"; } else { output = "gamemode " + Compiler.smartEmpty(args[0]) + " @s"; } return(output + '\n'); } else { return(Compiler.functionEval(text, null, "=", rec + 1)); } }
public static string parseTP(string[] args, Compiler.Context context, string text, int rec = 0) { if (args.Length == 1 || (args.Length == 2 && context.isEntity(args[0]))) { string output = "tp"; if (args.Length == 1) { output += "@s " + args[0]; } else { for (int i = 0; i < args.Length; i++) { output += " " + args[i]; } } return(output + '\n'); } else { return(Compiler.functionEval(text, null, "=", rec + 1)); } }
public static string parseStopsound(string[] args, Compiler.Context context, string text, int rec = 0) { if (args.Length > 0) { string output = "stopsound "; if (context.isEntity(args[0])) { output += context.GetEntitySelector(args[0]); } else { output += "@s " + args[0]; } for (int i = 1; i < args.Length; i++) { output += " " + Compiler.smartEmpty(args[i]); } return(output + '\n'); } else { return(Compiler.functionEval(text, null, "=", rec + 1)); } }
public static string parseClear(string[] args, Compiler.Context context, string text, int rec = 0) { if (args.Length >= 0 && args.Length < 3) { string output = "clear "; if (args.Length == 0) { output += "@s"; } else if (context.isEntity(args[0])) { output += context.GetEntitySelector(args[0]); } else { output += "@s " + args[0]; } for (int i = 1; i < Math.Min(2, args.Length); i++) { output += " " + Compiler.smartEmpty(args[i]); } return(output + '\n'); } else { return(Compiler.functionEval(text, null, "=", rec + 1)); } }