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

How can I use it to write Paper plugins? #184

Open
givegrandpaclimb opened this issue Sep 24, 2024 · 3 comments
Open

How can I use it to write Paper plugins? #184

givegrandpaclimb opened this issue Sep 24, 2024 · 3 comments
Labels
type: question Further information is requested

Comments

@givegrandpaclimb
Copy link

Hello developer! Thank you very much for creating such a great plugin! I have a small question, can I directly use this to write paper plugins? Or how can I interact with the plugin? (Because I tried using OnEnable in it but it didn't work...)

@vectrixdevelops
Copy link
Member

Plugins are isolated into their own classloaders, so unfortunately it's not super easy to figure out how to achieve that. @Floweynt has had some success mixing into the Commodore class, as seen here https://github.com/TeamMonumenta/monumenta-mixins/blob/d5c514d466c8f5adc87706f27e872ff46ba6b0a2/src/main/java/com/playmonumenta/papermixins/mixin/bugfix/CommodoreMethodVisitorMixin.java#L14 but it could be made easier for sure.

@vectrixdevelops vectrixdevelops added the type: question Further information is requested label Feb 8, 2025
@Floweynt
Copy link

I have a WIP fork of Mixin that supports instancing, which basically involves getting rid of all static variables and service loader stuff. Another possible solution is to create a parent-isolated classloader for each plugin and load the mixin runtime independently for each plugin, but not sure how difficult that is.

In any case, you must take care to never do cross-classloader class access, which probably means you should separate your project into multiple subprojects, each with the correct classpath so compile time verification works properly.

@LeonidMem
Copy link

LeonidMem commented Feb 12, 2025

I've experimented with this 1.5 years ago (with another core, but I think it doesn't matter), it works fine with 1.20.1 and, probably, with new versions of Paper too if they didn't change code related to plugin loader (but I think they did). Anyway, here it is: https://github.com/LeonidMem/BukkitInFabricM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants