GithubHelp home page GithubHelp logo

Comments (3)

Shadows-of-Fire avatar Shadows-of-Fire commented on August 17, 2024

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:

  1. Make abstract classes unlistenable
  2. 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.

Technici4n avatar Technici4n commented on August 17, 2024

Yes, @Unlistenable seems to be the solution.

from bus.

Technici4n avatar Technici4n commented on August 17, 2024

See #21.

from bus.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.