Skip to content

Use AsyncPlayerSpawnLocationEvent for SpawnMatchModule on modern#1622

Open
calcastor wants to merge 1 commit intoPGMDev:devfrom
calcastor:asyncpsle
Open

Use AsyncPlayerSpawnLocationEvent for SpawnMatchModule on modern#1622
calcastor wants to merge 1 commit intoPGMDev:devfrom
calcastor:asyncpsle

Conversation

@calcastor
Copy link
Contributor

@calcastor calcastor commented Feb 14, 2026

Adds a shim of AsyncPlayerSpawnLocationEvent to handle Paper's AsyncPlayerSpawnLocationEvent on modern and PlayerSpawnLocationEvent on legacy. This avoids early creation of the player object on modern by use of the deprecated PlayerSpawnLocationEvent.

Prior to Spigot support, PGM used to use PlayerInitialSpawnEvent for SportPaper; perhaps we should use this again given that we have limited our supported platforms to SportPaper and modern Paper?

@calcastor calcastor marked this pull request as draft February 14, 2026 18:20
@calcastor
Copy link
Contributor Author

Draft until I actually test on SportPaper

@calcastor calcastor force-pushed the asyncpsle branch 2 times, most recently from 8cea5df to 5126b9c Compare February 15, 2026 12:26
@calcastor calcastor marked this pull request as ready for review February 15, 2026 12:26
@calcastor
Copy link
Contributor Author

This also works on SportPaper provided we only make the PGM event asynchronous on modern which isn't very surprising. I've renamed the event accordingly.

Comment on lines +130 to +132
var pgmEvent = new PlayerSpawnLocationEvent(event.getSpawnLocation());
handleCall(pgmEvent, event);
event.setSpawnLocation(pgmEvent.getSpawnLocation());
Copy link
Member

Choose a reason for hiding this comment

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

it is likely unsafe to query pgm async for a spawn location, it probably needs to run in the main thread, at which point, why are we even trying to replace the old event that did just that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PlayerSpawnLocationEvent is deprecated by Paper, hence.

If we don't care about that right now then I'll just suppress the deprecation warning for this specific event and call it a day. This seems like it could matter more in the future though.

Copy link
Member

Choose a reason for hiding this comment

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

i'm aware of the deprecation, but it still is the event that fits us best, they've not added a 1:1 replacement as far as i know while the deprecated one works as intended

@calcastor calcastor force-pushed the asyncpsle branch 3 times, most recently from adf7703 to 7d9297a Compare February 28, 2026 23:54
Signed-off-by: BT (calcastor/mame) <43831917+calcastor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants