Comments (3)
Relaying from discord:
There exists a valid usecase for reception of subclass listeners in NeoForge itself: EntityTeleportEvent
It can be fired as itself, with no additional context, or as a subclass providing additional context. Listeners often opt to receive the supertype instead of a subclass to receive all teleports.
This can be remedied by having an arbitrary context object attached to the teleport event, but is more gracefully solved through subclassing the event.
That said a means to prevent a class from being listened to (so that consumers do not accidentally listen to a parent event where this is not the intention) should be invented.
To that end, only two solutions are viable:
- Make abstract classes unlistenable
- Add an
@Unlistenable
annotation to mark unlistenable classes.
The second approach is most flexible. Other approaches are not viable as the unlistenable property must be attached to the class, and introducing a static class-keyed data structure is inadvisable.
from bus.
Yes, @Unlistenable
seems to be the solution.
from bus.
See #21.
from bus.
Related Issues (9)
- `EventBusErrorMessage` should print the listener name HOT 1
- `Event`s should be resettable to a state where they can be posted again HOT 1
- Remove `GenericEvent`
- Remove typetools and instead require a `Class<T>` object for lambda listeners HOT 1
- Remove `HasResult` and event result
- Make `Event` non-cancelable and introduce a `CanceleableEvent` subclass
- Make event priority use an int value instead of a list of enum values
- `@SubscribeEvent.receiveCanceled` is not respected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bus.