- Joined
- Jul 31, 2018
- Messages
- 33
- Thread Author
- #1
I don't get it. This should work, right?
I'm getting "null Failure Task" exception, why?
Does not look like null to me. Everything seems to be referenced correctly.
By all examples this should work. This is literally all the code.
I'm getting "null Failure Task" exception, why?
Does not look like null to me. Everything seems to be referenced correctly.
By all examples this should work. This is literally all the code.
Code:
public class Main extends TreeBot {
@Override
public TreeTask createRootTask() {
return new InventoryEmpty();
}
}
Code:
public class InventoryEmpty extends BranchTask {
private PrintStuff printStuff = new PrintStuff();
@Override
public TreeTask successTask() {
return printStuff;
}
@Override
public TreeTask failureTask() {
return printStuff;
}
@Override
public boolean validate() {
return Inventory.isEmpty();
}
}
Code:
public class PrintStuff extends LeafTask {
@Override
public void execute() {
System.out.println("Print stuff");
}
}