How to make implementation of event?

I need LaunchProjectileEvent to work for my plugin, and it’s seems not implanted yet. So I’m trying to make this implementation by myself, but I can’t locate code in SpongeCommom. Seems SpongeCommom has a package event.listener but it doesn’t shown on GitHub? Why?

Locate what code? What’s the full package? How are you implementing it? Your post is confuzzling.

at org.spongepowered.common.event.listener.DamageEntityEventListener_GameListener_onDamage13.handle(Unknown Source) ~[?:?]

Why this cannot be found in GitHub?
Or just how to implant LaunchProjectileEvent ?

Could you post the full error? And classes aren’t found in GitHub because some are dynamically generated at runtime (for example, nearly all of the events).

2 Likes

That error is intentionally produced because I’m trying to find where I need to go to make event implanted. So, the real issue is this code doesn’t work:

@Listener
public void onWhatEver(LaunchProjectileEvent event) {
    System.out.println("!");
}

Thanks for Help!

Is that listener code in your main plugin class, or is it in a different class? If its in a different class, have you registered that other class with your plugin ?

What version of minecraft-sponge are you trying to code for?

1 Like
public class GameListener {

    @Listener
    public void onPlayerJoin(ClientConnectionEvent.Join event) {
        System.out.println("1");
    }

    @Listener
    public void onDamage(DamageEntityEvent event) {
        System.out.println("2");
    }

    @Listener
    public void obn(LaunchProjectileEvent event) {
        System.out.println("3");
    }
}

ClientConnectionEvent and DamageEntityEvent are work fine, only LaunchProjectileEvent are not working. So I suspect that problem is LaunchProjectileEvent are not implanted in Sponge.

Sponge version: SpongeVanilla version 1.12-7.0.0-BETA-285

Thank you for help!

Yeah, that would be it - not implimented.

It seems that there are a few times in sponge forums where it has been noted that LaunchProjectileEvent has not been implemented yet.

If you have the skills to do so, making a pull request to impliment it would make a lot of people happy, or look for a PR that was made long ago to impliment it but which failed or has failed to be added for simple reasons, like not formatted correctly or missing a response from the devs to change a line of code and post in it for a status update / snag that and replicate your own PR, fixed up and ready to be go.

Otherwise, youll need to write your own mixin-plugin to add the hook for the event, or do reflection work on the server jars.

It does seem hard to believe that this far into the project, one of the core, often happening processess of the game that has existed years before sponge was concieved does not have its event being thrown - its not like its a really new feature, or a super-system being designed from scratch, and that it has managed to be overlooked for this long, so its likely a matter of there being PRs for it that were made but fell short at the last second, or failed to compile, or failed to get approved, and yet triggers a vague “I’m sure I remember that being done” response from everyone on the dev team gloss-over :slight_smile: