I have this code (in a minecraft mod I'm creating):
SubCommand command = null;
switch (argsRaw[0]) {
//help menu
case "help": {
command = new help();
break;
//basic calculations
} case "airtime": case "duration": {
command = new airtime();
break;
} case "distance": {
command = new distance();
break;
} case "height": {
command = new height();
break;
//utility
} case "face": case "rotate": {
command = new face();
break;
} case "optimizesensitivity": case "optimizesens": case "optimisesensitivity": case "optimisesens": {
command = new optimizesensitivity();
break;
} case "setsensitivity": case "setsens": {
command = new setsensitivity();
break;
//advanced calculations
} case "taps": case "tapsetup": case "bruteforcetaps": {
command = new taps();
break;
//command doesn't exist
} default: {
Main.sendChatMessage("\"" + argsRaw[0] + "\" is not a valid command. Use /mm help for a list of commands.");
return;
}
}
//execute
command.run(args);
Is there any way i can make it so its similar to this:
String commandName = argsRaw[0];
command = new "commandName"();