Finding Events

Is there some type of list of events for Sponge, because it is very difficult to locate the events I need (using the javadocs). It took me forever to find that the player join event in Sponge is ClientConnectionEvent.Join

(And I’m currently very frustrated trying to find the Sponge equivalent of PlayerToggleFlightEvent)

Unfortunately it seems there’s no event at the moment for changing flight. You can open an issue for it on GitHub

Unless I’m mistaken, the Data API crew is working on a so-called “DataEvent” that fires when a data holder’s data is updated. This would handle flight toggling, and a great many other things. Would have to ask @gabizou about it though…

Javadocs has been the best resource I’ve found so far for finding all the events. Specifically the Event Interface page (You may have to do a bit of digging, but they are all there).

As far as your second question, I don’t believe there is a sponge equivalent of the PlayerToggleFlightEvent. However, you may be able to achieve a similar check by listening to the ChangeDataHolderEvent.ValueChange, filtering for players, and specifically checking to see if the DataTransactionResult contains a BaseValue representing FlyingData If it does then the player has toggled flight.

Not sure though, haven’t tried it myself.

I don’t think ChangeDataHolderEvent is what I’m looking for, I tried all it’s variations and that event never fired.
It seems at the current stage of Sponge that the closest I can get to what I want is checking each move event.

That means it’s not implemented yet, not that it’s not the right one to go with.
And rather than the first word of the class name being the hint, class names are named more intelligently, and you use packages to find what you’re looking for.

I wouldn’t necessarily say more intelligently…

But anyway, using the packages is normally how I deal with it as well,

In IntelliJ
org.<ctrl+space>spo<tab><tab>e<tab>block.<click block Change Event or navigate with keyboard>

to give org.spongepowered.api.event.block.ChangeBlockEvent

1 Like

I guess I will try doing it that way. Thanks for the input.

The other thing I do, is search as opposed to manual lookup, goto github.com/spongepowered/spongeapi/ search “Join Event” look through search results.

@Zerthick actually showed me to this page. And I find that the most helpful for me to find events. (Even if the page is very unorganized)

If your browser supports them I’d also recommend using the frames view, https://jd.spongepowered.org/4.0.3/?org/spongepowered/api/event/Event.html The side bar is invaluable.

Edit: This link is getting popular

4 https://jd.spongepowered.org/4.0.3/?org/spongepowered/api/event/Event.html
5 https://jd.spongepowered.org/5.1.0/?org/spongepowered/api/event/Event.html
6 ??? https://jd.spongepowered.org/6.0.0-SNAPSHOT/org/spongepowered/api/event/Event.html
7 https://jd.spongepowered.org/7.0.0/?org/spongepowered/api/event/Event.html