Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Support applicable API during config stage

Open Machine-Maker opened this issue 2 years ago • 7 comments

There are at least 2 events I know of that fire during the configuration stage before the ServerGamePacketListenerImpl has been created: PlayerClientOptionsChangeEvent and PlayerSpawnLocationEvent. In addition, there are the listeners for custom payloads that also run. This PR adds support for the functionality that is supported during the configuration phase, namely kicking players, sending custom resource packs, and sending custom payloads.

- [x] kick API
- [x] sending resource pack API
- [x] ~~custom channel stuff~~will handle at a later time

Machine-Maker avatar Oct 12 '23 02:10 Machine-Maker

I think we should have an API to keep the player in config for a while as well while e.g. the resource pack is loading. Especially because of this issue right here https://github.com/PaperMC/Velocity/issues/1164.

davidmayr avatar Dec 22 '23 13:12 davidmayr

That is outside the scope of this PR. This is just intending to support already-existing API that is valid for use during the configuration phase. Don't interpret this as saying such API shouldn't exist however.

Machine-Maker avatar Dec 23 '23 01:12 Machine-Maker

Anyone have any idea how long until this PR is merged? Isn't it as simple as just clicking the button now?

cometcake575 avatar Feb 24 '24 23:02 cometcake575

@cometcake575 this PR is still in draft, it even has a todo list in the description with at least one item that needs looking at. then the code needs to be reviewed by the team, tested and then it can be integrated. integrating is more complicated than just pressing the button because of how our patching works. tldr: be patient

MiniDigger avatar Feb 25 '24 09:02 MiniDigger

Is there any progress?

Twarug avatar Jul 03 '24 21:07 Twarug

I did say elsewhere about making Player more attached to the Network, but, we could maybe go for a more overarching thing of just offering a wrapper for the connection itself which lets you stem off into a configuring client, which lets you see methods only available in that phase, as well as a more general one that lets you get the player? not really sure how that would look, but, we also need to approach this for earlier stage stuff too, anyways, i.e. login plugin messaging API, as well as all of the task stuff needed for supporting the configuration protocol and its operations here

electronicboy avatar Jul 17 '24 03:07 electronicboy

The Player should be supported in PlayerSpawnLocationEvent which is in a location after vanilla creates ServerPlayer but before the game connection is created. So either way, the Player interface has to have some support for stuff before the game packet listener is created.

Player is exposed in multiple places before where vanilla creates it, The login event, the resource pack events, the kick event and probably some more I'm missing.

Machine-Maker avatar Jul 17 '24 03:07 Machine-Maker