#Configuration Phase API
1 messages · Page 1 of 1 (latest)
Can you elaborate on what has been introduced thus far, and what is planned to be introduced? Your comment makes it sounds like we're simultaneously wanting to start on this API ("in order to get the ball rolling") but also have already pushed it ("with the configuration api being introduced in 1.21.7")
Configuration Phase API
err what? 😅 First time I'm hearing of this
This is kind of the case. We have at least started "initial" api but there is still some work that is needed.
I'll write something up
(As it seems there is less knowledge of the config phase than I thought.)
I think like ten people know what it is and not all of them are in this discord.
Ah the new thing that replaces the PlayerLoginEvent?
Also if it's not actually ready, with only some initial stuff, can you address why PlayerLoginEvent gets the nag already?
I would assume it's for future proofing
so devs dont get a shock therapy once that api drops
even if this api get reworked that event can't exists in it's current shape
Yay, another Owen API
im excited for it, makes lots of things more seamless and allows changing certain things easier, for example skipping a lobby step
as long as it has the ability to put a player in config phase and take them out without kicking them ill be happy
By a look in #paper-dev, I think more javadoc in the PlayerConnectionValidateLoginEvent on hwo to get the player profile would be neat.
And the ability to set/get permissions for the connection.
Also in the PlayerConfigurationConnection, if that is an Audience internally anyway why not expose that directly?
declaration: package: io.papermc.paper.connection, interface: PlayerConfigurationConnection
I am mostly hesitent because 99% of methods do not work
aah
then shouldn't adventure's audience be split or some custom interface be used instead of audience?
They arent willing really
Isn't Audience default noop on like all methods
yea, but it is just shit to have methods / api that does nothing
Currently my only thing im working is migrate how check permissions for the full event, luckperms can work but if need make a generic way need find how replace the old Player#hasPermission
Working on this with luckperms. This will take some time
My point is, the expectation by audience is that stuff may noop. Clear javadocs on the audience getter would be fine IMO.
like everything is clearly abstracted in this pr, but audience is just a random bundle of everything in between
its mostly the large amount of method completion spam
Working in what way?
getting a permissible from a uuid for example
From the luckperms api you mean? Its not like try to fetch user and later check or you mean the generic way in paper for check permissions..
Sorry to ask
No from the bukkit api
Ahhh okay 
Maybe can has another comments when touch my custom whitelist plugin because pretty sure i touch the events for result...
yeah dont use that
Truly wonderful isn't it
Probably not the sort of feedback you're after, but having the current event marked as deprecated but its replacement event(s) marked as experimental is awkward - either way I need to SuppressWarnings to keep linting happy.
This is a mistake, sorry!
Ahhhh, oops - ty 🙂
When sending links to a PlayerConnection during config phase, what is the intended way of getting ServerLinks instance? Is there a way to get it currently?
Bukkit.getServerLinks().copy()
ah, thank you!
My suggestion is to put this logic in the player join event instead, for now.
Am I correctly reading that the replacements for playerlogin have no way to perm check? How should a plugin that has a perm node to bypass player limit handle it?
Correct at this moment. In general I’m working with luckperms to hopefully have some way to get permissions from a player that is offline/not loaded yet.
I'm assuming blocking operations in AsyncPlayerConnectionConfigureEvent are fine to do? Like waiting for player to load all resource-packs before letting them join the server.
(This is how it was done in test plugin too: https://github.com/PaperMC/Paper/blob/e5cc6bf3f20d63492a8ec44dd31a10f1db335d0d/test-plugin/src/main/java/io/papermc/testplugin/TestPlugin.java#L82)
Just make sure you properly time out/close if connection is closed
Yeah makes sense to also check for that, thank you.
I really like the new API so far, though I'll probably use it only for resource-pack stuff. At least for now 😛
Is that correct that PlayerConnectionValidateLoginEvent don't provide a way to check player's UUID? What should I use to check whether player is banned or not? 🤔
Been there... See #paper-dev message 😁
Thanks!
I assume that's because event is called twice, and PlayerConnection is PlayerLoginConnection only on the second call?
Its login connection in first call, config connection on second
Thanks for clarification 👍 Might be good to include that in javadocs with links to corresponding classes.
Also I'm not sure if PlayerConnectionValidateLoginEvent is the right name for this method. According to javadocs it also disallows the player from joining. There's allow(), so wouldn't disallow(Component) make more sense?
Similar to how it used to be in (now deprecated) PlayerLoginEvent
kickMessage is more what disallow is. But yeah, that could possibly be renamed.
Yes, that's the method I meant. Forgot to put it in my message lol
PlayerLoginEvent#kickMessage(Component) only modified the kick message IIRC.
Well, if the kick message is present, they wont be allowed in.
I don't know if that's intended, but calling PlayerConnectionValidateLoginEvent#kickMessage(Component) for the first event call (so with PlayerLoginConnection) still lets the player to log-in. Doing so in the second call however, (so withPlayerConfigurationConnection), which happens after all resource-packs are loaded, works correctly and disconnects the player with provided message.
If that's intended then it should probably be included in javadocs as well.
For the first condition do you have ant plugins that are listening to player login event
Ah, might be it. I do have LuckPerms installed and I saw a warning regarding that.
Yeah that causes issues with this api due to legacy comparability
**compat
Although. that event should take precedent. I’ll take a look
Is it supposed to unload the resource pack after a transfer during configuration phase? Loading the pack and calling a transfer on AsyncPlayerConnectionConfigureEvent seems to produce this but it doesn't happen when transfer is called after player joins the world
but this does not imply that only luckperms is supported right?
no, the idea is to work with them, as someone who has a strong idea for an environment agnostic permission system, for designing an appropriate api in general
will that add onto the existing permission api or replace it from the ground up? or is that still up in the air?
I mean, stuff like hasPermission is not really going anywhere
we shall see
the idea is to design an api for plugins that provide a permission implementation, what would such a plugin need to work at a stage where a Player is not available, and less so for consumers, plugins asking for permission results
If there is a way to modify the registry of the client, it should be possible to do so with PaperAPI
what even is this api? waht is config-phase
The client has some different phases of communication it can be in.
Status, where it's just asking a server for motd and such.
Login, where it's negotiating auth and being allowed to join the server.
Configuration, where registries are sent (like what enchantments are present, and in theory in the future maybe stuff like custom blocks?)
Play, where you're actually playing in the server.
-# Do we count handshake as one? I don't know and probably don't need to know.
Do we count handshake as one? I don't know and probably don't need to know.
I guess we should. Shaking hands is a polite gesture
(for tcp it is required)
thx for telling me
The 1.21.5/6/7 Update
It's been a hot minute since the last post, but here we are! As always, backups are absolutely mandatory. After upgrading your world to 1.21.7, you cannot downgrade back to a lower version! We can also give you a pinky promise that it won't take this long to exit the...
This was really helpful to me at least
trying to use the new configuration phase api to send a RP
running into an issue where my "fallback" solution which runs when Player#hasResourcePack returns false
tried debugging it and it seems to send the rp in config phase but it returns false in PlayerJoinEvent here?
i can likely remove my fallback since it mainly applied for the old fucky logic i had to do for config phase rp but
or is this new api still not sending the pack "in config phase" only queueing it up for it?
and thuys sending it when the player has joined?
seems it might still just be sending a packet and not using the queue task stuff?
might make sense with why it seems to only ever send post-config phase for me maybe?
first image is in PaperPlayerConfigurationConnection second is ServerConfigurationPacketListenerImpl
You need to wait for the resource pack to actually download... See the reply, this should work...
yeah that works thanks
yeah i try something like
User user = LuckPermsUtils.getLuckPermsAPI().getUserManager().loadUser(uuid).getNow(null);
boolean hasPerm = (user != null && user.getCachedData().getPermissionData().checkPermission("ignore-max-players").asBoolean());
but just ends with null user but maybe this is another thing
more of a luckperms question, loadUser will always load the user from storage, that's an asynchronous operation, that's why it returns a future, getNow(null) will return null because the future is not completed, luckperms preemptively loads users in the async pre login event so you can simply call getUser(uuid)
ohh make sense...
okay with that change now works.. its not "generic" because now depends on LuckPerms but for what need currently works thanks.
Is there any sane way to check permissions during the AsyncPlayerConnectionConfigureEvent?
Oh lol my bad 
Keep forgetting about the search feature
You basically just have to ask LuckPerms for the permission information directly
That's a bit of a late reply but... how do I know when connection got closed? I can't figure this out. When resource-packs are marked as "required", and player clicks "Disconnect" instead of accepting them, no resource-pack status will be sent and player will just disconnect. Can I somehow check if PlayerConfigurationConnection returned from AsyncPlayerConnectionConfigureEvent is still "valid", as if player is still being held in the config phase?
you can listen to the PlayerConnectionCloseEvent
Why does need to be changed?
Ah?
Not using Player#hasPermission
That event not has a player then cannot use that
Was there any reason why AsyncPlayerConnectionConfigureEvent's threads, which are mostly meant to be blocked most of the time, use platform threads instead of virtual threads?
there were talks recently about moving the events that use that thread pool to VTs, but there are greater prios rn
Well that event has his own dedicated platform thread pool just for this single event, so I could open a pr to move it to VTs
there are two events that use that pool
the async spawn location one too i believe
async pre login could also probably be moved to VTs tbf
It is called on the thread processing the login logic so it doesn't make sense to block that thread just to put async pre login in a VT as the sync login event does
And async chat event does lots of processing for messages per receiver, so not a good load for VT. But async spawn location and async config do indeed seem like good candidates for VTs