Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Detect if a mixin patch was applied (any) #589

Open
Speiger opened this issue Jul 13, 2022 · 3 comments
Open

[Question] Detect if a mixin patch was applied (any) #589

Speiger opened this issue Jul 13, 2022 · 3 comments
Labels

Comments

@Speiger
Copy link

Speiger commented Jul 13, 2022

o/ this is more of a question, maybe a feature request if it makes sense but if not thats fine too.

Basically I have a problem where a mixin might be loaded and I need to alter my code if it is loaded.
But I can not make a global modcheck since the code i am applying fixes a bug and how i fix the bug is dependent on if said mixin is loaded.

And sadly if my tooling gets it wrong this will result in a crash.

So is there a way if a mixin was applied to a specific class? Maybe some metadata who patched the class? (that would make the task easier)

@Mumfrey
Copy link
Member

Mumfrey commented Jul 14, 2022

It depends on when you need to detect the presence of the mixin, before the classload or after. If it's after classload you can use Mixins::getMixinsForClass, if before then it gets a bit more complicated.

@Speiger
Copy link
Author

Speiger commented Jul 14, 2022

Nah i just need to detect a class when a command is ran and that is done after the class has been loaded for sure (the world has to exist)

But thank you :)

@Speiger
Copy link
Author

Speiger commented Jul 25, 2022

@Mumfrey ok i checked it out, and the example you have given me is actually inverse of what i asked for xD
But Reflection should allow me to trace the cache and find it out myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants