Fix query function in expression masks.

Fixes WORLDEDIT-3344.
Dieser Commit ist enthalten in:
wizjany 2016-06-28 23:59:06 -04:00
Ursprung 6e36b5236c
Commit e0c8776f0f

Datei anzeigen

@ -23,6 +23,7 @@ import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -62,6 +63,9 @@ public class ExpressionMask extends AbstractMask {
@Override @Override
public boolean test(Vector vector) { public boolean test(Vector vector) {
try { try {
if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) {
((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector);
}
return expression.evaluate(vector.getX(), vector.getY(), vector.getZ()) > 0; return expression.evaluate(vector.getX(), vector.getY(), vector.getZ()) > 0;
} catch (EvaluationException e) { } catch (EvaluationException e) {
return false; return false;