- Joined
- Dec 9, 2016
- Messages
- 4,787
- Thread Author
- #1
If, like me, you find it tedious to create a new empty Java class each time you want to create another branch or leaf then this tutorial is for you. Using IntelliJ you are able to manipulate the templates and create new templates to suit your custom needs. I'll show you how to do this and then supply the code you will need in order to create your automatic Branch and Leaf classes.
1) Navigate to File -> Other Settings -> Default Settings.
2) In the left-side panel of the window that has now opened navigate to Editor -> File and Code Templates.
3) Select the green '+' .
4) In this window name the new file whatever you want, preferably something easy to identify when making these classes later on. For this example I will be using 'RuneMate BranchTask' and 'RuneMate LeafTask'.
5) Copy the code below like so into the relevant templates you've created. In the example I've created a template to use for Branch Tasks so I've pasted the Branch Task template.
6) Ensure the file extension is java. There's no need to have it as '.java' as IntelliJ will automatically put it in there for you.
7) Hit 'Apply' and 'Ok'. Now you'll be able to find your template classes when you go to create a new class.
Happy botting!
RESOURCES:
Branch Tasks
Leaf Tasks
TreeBot
1) Navigate to File -> Other Settings -> Default Settings.

2) In the left-side panel of the window that has now opened navigate to Editor -> File and Code Templates.
3) Select the green '+' .
4) In this window name the new file whatever you want, preferably something easy to identify when making these classes later on. For this example I will be using 'RuneMate BranchTask' and 'RuneMate LeafTask'.
5) Copy the code below like so into the relevant templates you've created. In the example I've created a template to use for Branch Tasks so I've pasted the Branch Task template.
6) Ensure the file extension is java. There's no need to have it as '.java' as IntelliJ will automatically put it in there for you.

7) Hit 'Apply' and 'Ok'. Now you'll be able to find your template classes when you go to create a new class.

Happy botting!
RESOURCES:
Branch Tasks
Code:
package ${PACKAGE_NAME};
import com.runemate.game.api.script.framework.tree.BranchTask;
import com.runemate.game.api.script.framework.tree.TreeTask;
/**
* Created by ${USER} on ${DATE}.
*/
public class ${NAME} extends BranchTask {
@Override
public TreeTask failureTask() {
return null;
}
@Override
public TreeTask successTask() {
return null;
}
@Override
public boolean validate() {
return false;
}
}
Leaf Tasks
Code:
package ${PACKAGE_NAME};
import com.runemate.game.api.script.framework.tree.LeafTask;
/**
* Created by ${USER} on ${DATE}.
*/
public class ${NAME} extends LeafTask {
@Override
public void execute() {
}
}
TreeBot
Code:
package ${PACKAGE_NAME};
import com.runemate.game.api.script.framework.tree.TreeBot;
import com.runemate.game.api.script.framework.tree.TreeTask;
/**
* Created by ${USER} on ${DATE}.
*/
public class ${NAME} extends TreeBot {
@Override
public TreeTask createRootTask() {
return new null;
}
}