GlowstoneMC/Bukkit2Sponge

Easier Event System

Opened this issue · 4 comments

phase commented

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.

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?

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

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

phase commented

@jamierocks They're doing the same thing that Bukkit2Sponge is doing (LapisBlue/Pore@687e7e2).