Paper
Paper copied to clipboard
Add PreDragonRespawnEvent and DragonRespawnEvent
Took me all day to understand the EnderDragonBattle system but here we are.
This patch adds two new events around the EnderDragon battle.
The first event (PreDragonRespawnEvent) fires when a player places down the 4 required Ender Crystals around the gateway frame to start the cycle/animation to respawn the Ender Dragon, exposing the DragonBattle and the 4 placed Ender Crystals, cancelling this event simply stops the process of starting the spawn cycle.
The second event (DragonRespawnEvent) fires after the whole animation cycle have completed and the server is about to add the Ender Dragon into the world and mark the dragon as not killed (To stop more respawns and remove the exit end portals inside the gateway) exposing the DragonBattle, cancelling this event will stop the Ender Dragon being added and will reset the spawn cycle back to idle while also adding the end portals back to the exit frame as if the whole spawn cycle never happened because you'll end up stuck in the end forever otherwise.
~~I wasn't too sure what to do about the imports if I should avoid importing and using full names in the code and wasn't too sure if I was meant to merge the other Paper patch comment with mine.~~ I'm open and excited for any feedback.
Is the respawn event even needed? Like, it already calls creature spawn event. I feel like you can just use that. The pre respawn event is fine.
See my fix for the creature spawn event: #5717
EDIT: Also, I think these perfectly fit into the existing EnderDragon events patches, since they specifically are Ender Dragon events.
Is the respawn event even needed? Like, it already calls creature spawn event. I feel like you can just use that. The pre respawn event is fine.
See my fix for the creature spawn event: #5717
EDIT: Also, I think these perfectly fit into the existing EnderDragon events patches, since they specifically are Ender Dragon events.
I never thought about cancelling the CreatureSpawnEvent and the portal not going back to generated was a bug
portal not going back to generated was a bug
the portal probably should only go back to generated if its a respawn, otherwise, it was already unlit and should stay that way. Up to plugins/servers to make sure players don't get stranded in the end.
Rebased, I think I did it right and removed imports as well.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing as it looks like this has gone inactive. If you are interested in continuing this PR feel free to leave a comment. Else, if someone still finds use in this API feel free to open another PR and pick up what was already done here. 😄