When you level up you stop skilling, how can I detect this and restart?
Right now I'm using message detection using onMessage but It doesn't seem to work.
boolean doBreak = false;
@Override
public void onMessage(Message m){
if(m.getType() == MessageType.GAME && m.getMessage().contains("You are now level") && !doBreak){
doBreak = true;
}
}
@Override
public int onLoop() throws InterruptedException {
// code to start making pizza
while(getInventory().contains("Anchovies") && getInventory().contains("Plain pizza")){
sleep(random(250, 500));
if(doBreak){
doBreak = false;
sleep(random(100, 200));
break;
}
}
}
Full code: https://hastebin.com/defifurane.java