Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix anchor respawn acting as a bed respawn when using the end portal #5540

Merged

Conversation

HexedHero
Copy link
Contributor

@HexedHero HexedHero commented Apr 23, 2021

Following #5465
The PlayerRespawnEvent uses flag2 for deciding if the respawn was from an anchor or not but flag2 is only used for removing a charge from the Anchor which the End Portal & Credits respawn does not, so when you enter the End Portal with an Anchor respawn set, it will fire the event with bed:true and anchor:false which is incorrect, this patch fixes this issue.

I tested with:

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void a(PlayerRespawnEvent event) {
        Bukkit.getLogger().warning("RESPAWN " + event.isBedSpawn() + " " + event.isAnchorSpawn());
    }

I tested this with normal /kill deaths and using the End portal with & without bed and anchor respawns. It all lines up correctly.

Test results:

[23:34:26] [Async Chat Thread - #0/INFO]: <HexedHero> Normal death
[23:34:29] [Server thread/WARN]: RESPAWN false false
[23:35:15] [Async Chat Thread - #0/INFO]: <HexedHero> Bed - No Anchor
[23:35:19] [Server thread/WARN]: RESPAWN true false
[23:35:35] [Async Chat Thread - #0/INFO]: <HexedHero> Anchor - No Bed
[23:35:40] [Server thread/WARN]: RESPAWN false true
[23:37:05] [Async Chat Thread - #1/INFO]: <HexedHero> End Portal/Credits - No Bed - No Anchor
[23:37:07] [Server thread/WARN]: RESPAWN false false
[23:36:49] [Async Chat Thread - #1/INFO]: <HexedHero> End Portal/Credits - Bed - No Anchor
[23:36:47] [Server thread/WARN]: RESPAWN true false
[23:37:42] [Async Chat Thread - #1/INFO]: <HexedHero> End Portal/Credits - Anchor - No Bed
[23:37:46] [Server thread/WARN]: RESPAWN false true

@HexedHero HexedHero requested review from a team as code owners April 23, 2021 22:30
@kennytv kennytv added upstream: bukkit Issues exists in Bukkit and/or CraftBukkit. status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. labels Apr 25, 2021
@kennytv kennytv force-pushed the fix-playerrespawnevent-isanchorspawn branch from c884adf to 5bf40bc Compare April 25, 2021 08:32
Copy link
Member

@kennytv kennytv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@kennytv kennytv merged commit 809466f into PaperMC:master Apr 25, 2021
ExcessiveAmountsOfZombies pushed a commit to ExcessiveAmountsOfZombies/Paper that referenced this pull request May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. upstream: bukkit Issues exists in Bukkit and/or CraftBukkit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants