It's seems like you're a bit confused on the structure of 'if', 'else if', and 'else', otherwise you wouldn't have put the same check twice.
Only one of those is allowed to execute. If the first statement returns true, the body of that if-statement is ran, and the else/else-ifs are ignored. If the second one returns true after the first returned false, then you run only the body of that one.
Examples:
if(true) {
//Runs only this
} else if(true) { //This is not even evaluated because the first thing returned true.
// Does not run
} else {
//Does not run
}
||||||||||||||||||||||||||||||
if(false) {
} else if(true) {
//This runs
} else {
}
|||||||||||||||||||||||||||||
if(false) {
} else if(false) {
} else {
//This runs
}
^ This is why it's useless to make the dialogues.isPendingOption() check twice in a row. You're just going to check it immediately after if it initially returns false (and it will almost definitely also return false), or you're not going to check it at all if the first statement returns true.
If I'm being honest though, I don't know how your code compiles at all because of its 3 consecutive open brackets and lack of closed brackets.