Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Add PreDragonRespawnEvent and DragonRespawnEvent

Open HexedHero opened this issue 4 years ago • 5 comments

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.

HexedHero avatar Feb 27 '21 20:02 HexedHero

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.

Machine-Maker avatar May 24 '21 04:05 Machine-Maker

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

HexedHero avatar May 24 '21 04:05 HexedHero

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.

Machine-Maker avatar May 24 '21 04:05 Machine-Maker

Rebased, I think I did it right and removed imports as well.

HexedHero avatar May 21 '22 20:05 HexedHero

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.

stale[bot] avatar Jul 30 '22 14:07 stale[bot]

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. 😄

Owen1212055 avatar Nov 25 '22 17:11 Owen1212055