Skip to content

Post Respawn Event - #8770

Open
MrScopes wants to merge 16 commits into
SkriptLang:dev/featurefrom
MrScopes:postrespawn
Open

Post Respawn Event#8770
MrScopes wants to merge 16 commits into
SkriptLang:dev/featurefrom
MrScopes:postrespawn

Conversation

@MrScopes

Copy link
Copy Markdown
Contributor

Problem

Currently, there is no support for https://jd.papermc.io/paper/26.2/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.html
To make changes to the user's player state, you have to use

on respawn:
 wait ...
 ...

this can be inconstent. PlayerPostRespawnEvent is fired after the respawn event.
take this from PlayerRespawnEvent

Called when a player respawns.
If changing player state, see PlayerPostRespawnEvent because the player is "reset" between this event and that event and some changes won't persist.

Solution

after [player] respawn[ing]

Testing Completed

on respawn:
    broadcast "&aon respawn:"
    broadcast "&b%player% &c%respawn location%"
    if respawn location is a bed:
        broadcast "&dbed"

after respawn:
    broadcast "&aafter respawn:"
    broadcast "&b%player% &c%respawn location%"
    if respawn location is a bed:
        broadcast "&dbed"

# the example I gave for the docs
after respawn:
    if respawn location is a bed:
        broadcast "%player% respawned at their bed at %respawn location%"
    else if respawn location is a respawn anchor:
        broadcast "%player% respawned at their anchor at %respawn location%"
    else:
        broadcast "%player% respawned at %respawn location%"
javaw_a5VPpw4Dkg javaw_Muukgt5G8G image

Supporting Information

I also modernized the respawn location expression and condition by moving it to the player module, and I updated some of the code in the classes.


Completes: #8769
Related: none
AI assistance: CoPilot

@MrScopes
MrScopes requested a review from a team as a code owner July 12, 2026 21:19
@MrScopes
MrScopes requested review from Efnilite and Pesekjak and removed request for a team July 12, 2026 21:19
@MrScopes MrScopes changed the title Postrespawn Post Respawn Event Jul 12, 2026

@AnOwlBe AnOwlBe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

few things

Comment thread src/main/java/ch/njol/skript/events/SimpleEvents.java Outdated
Comment thread src/main/java/ch/njol/skript/events/SimpleEvents.java Outdated

@AnOwlBe AnOwlBe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

supplier!

@AnOwlBe AnOwlBe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you have my read only approval 🔥

Comment thread src/main/java/org/skriptlang/skript/bukkit/entity/player/PlayerModule.java Outdated
@skriptlang-automation skriptlang-automation Bot added the needs reviews A PR that needs additional reviews label Jul 14, 2026
MrScopes and others added 3 commits July 18, 2026 20:36
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>

@AnOwlBe AnOwlBe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

meep

}

@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't required

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no it isn't its just something that could be changed - hence why its a comment review not a requested changes review

@Absolutionism Absolutionism left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Almost there

MrScopes and others added 6 commits July 25, 2026 23:26
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
set respawn location to {example::spawn}
""")
@Since("2.2-dev35")
public class ExprRespawnLocation extends SimpleExpression<Location> implements EventRestrictedSyntax {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should probably become a EventValueExpression and the respawn location an eventvalue. Not required for this PR but would be nice.

@skriptlang-automation skriptlang-automation Bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Jul 30, 2026
@APickledWalrus APickledWalrus linked an issue Aug 3, 2026 that may be closed by this pull request
1 task

@APickledWalrus APickledWalrus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few minor suggestions

public static void register(SyntaxRegistry syntaxRegistry) {
syntaxRegistry.register(SyntaxRegistry.CONDITION, SyntaxInfo.builder(CondRespawnLocation.class)
.supplier(CondRespawnLocation::new)
.addPattern("[the] respawn location (was|is)[1:(n'| no)t] [a] (:bed|respawn anchor)")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
.addPattern("[the] respawn location (was|is)[1:(n'| no)t] [a] (:bed|respawn anchor)")
.addPattern("[the] respawn location (was|is|1:was not|1:wasn't|1:is not|1:isn't) [a] (:bed|respawn anchor)")

I think the longer pattern is worth the much better readability.

ExprQuitMessage::register
ExprQuitMessage::register,
ExprRespawnLocation::register,
CondRespawnLocation::register

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be placed at the beginning of the list (alphabetical order)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Post Respawn Event

5 participants