Or you could also create a separate class instead of using nested classes. I would look into a task based system if you want to be more organized. There's several tutorials on the site about how to do this.
Basically each 'task' has its own class and then in your main class you just add a new instance of each task to the task manager, which loops through each task and executes it if it should be active, which is determined by a method inside each task class, usually isActive() which would return a boolean depending on the condition you place within said method.
Then you can have a task / separate class for banking per say, and another for combat, etc.
in Main.java:
@[member='Override']
public void onStart() {
Settings settings = new Settings(this);
settings.setCallback(b -> {
addTask(new SwapTask(this));
addTask(new TradeTask(this));
});
}
in TradeTask.java for example:
package com.loudpacks.script;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.utility.ConditionalSleep;
import com.loudpacks.api.Task;
import com.loudpacks.gui.Settings;
public class TradeTask extends Task {
private final Area RUINS = new Area(2386, 4829, 2415, 4855);
private final Area INNER_RUINS = new Area(2404, 4837, 2395, 4845);
private final Area PORTAL_AREA = new Area(2402, 4833, 2397, 4836);
public TradeTask(MethodProvider api){
super(api);
}
@[member=Override]
public boolean isActive() {
return RUINS.contains(api.myPlayer());
}
@[member=Override]
public void onStart() {
}
@[member=Override]
public void onLoop() {
// code to execute when active
}
@[member=Override]
public void onEnd() {
}
}