Bukkit2Sponge icon indicating copy to clipboard operation
Bukkit2Sponge copied to clipboard

Easier Event System

Open phase opened this issue 10 years ago • 4 comments

Instead of implementing every Event in Sponge and transfering it to Bukkit (or vice versa), is there any way you could call the event based on the Bukkit event?

public class EventTranslator implements Listener {
    @EventHandler
    public void genericEvent(Event e){
        Sponge.Magic.call(e);
    }
}

Obvisouly that doesn't work, but there's probably some way to add a switch for each Event. Plus I don't know if a normal Event will be called.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

phase avatar Apr 21 '15 15:04 phase

Maybe there's a way to translate events like this, but I can't see a way to do it in general unfortunately, since the Bukkit and Sponge events are so different best I can do I believe is implementing each one individually.. but maybe something better is possible?

deathcap avatar Apr 21 '15 15:04 deathcap

Also, Bukkit afaik won't call the event superclass handlers (including Event, but there was a PR to Glowstone proposing changing this), but SpongeAPI will

deathcap avatar Apr 21 '15 15:04 deathcap

@minecrell did dome cool stuff in https://github.com/LapisBlue/Pore that might help, related to events.

jamierocks avatar Apr 23 '15 16:04 jamierocks

@jamierocks They're doing the same thing that Bukkit2Sponge is doing (https://github.com/LapisBlue/Pore/commit/687e7e2d083089779e005150e164c1006b7425f8).

phase avatar Apr 23 '15 18:04 phase