Skip to content

Commit

Permalink
fix bindings not found in classes
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Jul 6, 2024
1 parent 9005864 commit cb3191d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ public void invokeStaticMissingMethod(Class<?> sender, String methodName, Object
}
}

@Inject(method = "invokeStaticMissingProperty", at = @At("HEAD"), cancellable = true)
public void invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter, CallbackInfoReturnable<Object> cir) {
if (!isGetter) return;
Object o = GroovyScript.getSandbox().getBindings().get(propertyName);
if (o != null) cir.setReturnValue(o);
}

/**
* @author brachy
* @reason class scripts being unable to use bindings and this method calling closures improperly
Expand Down

0 comments on commit cb3191d

Please sign in to comment.