Closed NotSinan closed 1 year ago
This is because of the Quest branch checking if Quest is finished before executing the FinishedQuestLeaf inside the Quest branch:
return FreeQuest.WITCHS_POTION.hasRequirements() && !FreeQuest.WITCHS_POTION.isFinished();
To resolve this, we can apply a check inside the isValid method of the Quest branch, which checks for requirements and finished status, then call ScriptManager.getScriptManager().stop();
and return false if requirements are not met or quest is finished, then afterwards return true to execute Quest branch if the quest can be performed.
For example:
@Override public boolean isValid() { if(FreeQuest.WITCHS_POTION.hasRequirements()) { Logger.log("Do not have requirements to start Witchs Potion, stopping script...!"); ScriptManager.getScriptManager().stop(); return false; }
if(FreeQuest.WITCHS_POTION.isFinished()) {
Logger.log("Finished Witchs Potion, stopping script...!");
ScriptManager.getScriptManager().stop();
return false;
}
return true;
}
For example:
@OverRide public boolean isValid() { if(FreeQuest.WITCHS_POTION.hasRequirements()) { Logger.log("Do not have requirements to start Witchs Potion, stopping script...!"); ScriptManager.getScriptManager().stop(); return false; }
if(FreeQuest.WITCHS_POTION.isFinished()) { Logger.log("Finished Witchs Potion, stopping script...!"); ScriptManager.getScriptManager().stop(); return false; } return true; }
I think this is perfect
Added class CheckRequirements and method checkRequirements(Quest quest) that implements this method and revised all Quest branches to implement this in next commit.
When quest complete, script is still running.