events handling is disabled now when potentially triggered from the scarpet script preventing from recursive callbacks.

This commit is contained in:
gnembon committed 2021-09-06 02:37:08 -03:00
1 parent 8325783bf4
commit 229d0b037b
5 files changed
+104 -32

No files matched your search

@@ -72,7 +72,7 @@ public class CarpetExpression
Value playerValue = new EntityValue(e).bindTo("p");
context.with("p", (cc, tt) -> playerValue);
}
return this.expr.eval(context).getBoolean();
return CarpetServer.scriptServer.events.handleEvents.getWhileDisabled(()-> this.expr.eval(context).getBoolean());
}
catch (ExpressionException e)
{
@@ -109,7 +109,7 @@ public class CarpetExpression
Value playerValue = new EntityValue(e).bindTo("p");
context.with("p", (cc, tt) -> playerValue);
}
return this.expr.eval(context);
return CarpetServer.scriptServer.events.handleEvents.getWhileDisabled(()-> this.expr.eval(context));
}
catch (ExpressionException e)
{