@Sujamma
It doesn't work because theoretically, it never changes the value of gate again, so it is stored as an old object which is closed, what you can do is use this
new ConditionalSleep(5000, 600) {
@Override
public boolean condition() {
return getObjects().closest(o -> o.getName().equals("Gate")
&& o.getPosition().equals(gate.getPosition()) && !o.hasAction("Open")) != null;
}
}.sleep();
The way this works, is that it keeps checking every 600ms if the condition is true, here we are trying to find new object which has the same position as the gate which we interacted but is opened