Support listener interception
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reviewing the EventBus registration and listener invocation paths, then compare them with the referenced SpongeEventBus implementation and its invocation wrapper. Define the interceptor service boundary and verify that Sponge can intercept listener registration or invocation without replacing the EventBus through reflection.
Written by the indexing model from the issue text.
Description
For Sponge we would like to be able to intercept either the listener registration or the invocation of it. For EB6 we are using reflection to replace the EventBus with our own implementation just to wrap the individual listener invocation with our own phase tracker system, this is not ideal.
To support our needs I'm proposing to add a service that can be implemented to provide an interceptor for this scenario. We are fine with either being able to wrap the listener function itself or the invocation of it.
The benefit of being able to wrap the registration itself is that we might be able to extract more information upfront about which mod registered the listener that we can then bake in to the wrapper function itself. This is a bit of moot point as EB doesn't require to provide any context objects like the ModInfo that we can easily rely on.
// Rough example of invocation interception.
public interface EventBusInterceptorProvider {
Consumer<Runnable> createInvocationInterceptor(BusGroup group, EventBus<?> bus);
}
- Dominant language
- Java
- Stars
- 46
- Forks
- 39
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MinecraftForge/EventBus
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
MinecraftForge/EventBus#80 · 2 comments ·
All issues in MinecraftForge/EventBus
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100