Skip to content

Instantly share code, notes, and snippets.

@troy-lamerton
Created August 10, 2018 20:56
Show Gist options
  • Save troy-lamerton/f2bbbd79c56eba2d4e5e14412be751b2 to your computer and use it in GitHub Desktop.
Save troy-lamerton/f2bbbd79c56eba2d4e5e14412be751b2 to your computer and use it in GitHub Desktop.
@Override
public int loop() {
if (this.stoppingCompleter) {
this.releaseQuestCompleter(0);
this.stoppingCompleter = false;
Log.severe("The quest completer stopped itself because it cannot continue");
Time.sleep(1000);
return 0;
}
if (Game.getState() != Game.STATE_IN_GAME) {
return 100;
}
if (this.questCompleters.size() > 0) {
QuestCompleter qc = questCompleters.get(0);
if (!qc.getIsActive()) {
this.startQuest(questCompleters.get(0));
return 1000;
}
if (qc.validate()) {
return qc.execute();
} else {
this.releaseQuestCompleter(qc);
return 1000;
}
}
if (this.questCompleters.size() == 0) {
Time.sleep(1000);
if (this.startQuestUI != null) {
this.startQuestUI.setVisible(true);
}
}
return 2000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment