-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Auth event called twice #3911
Merged
ImMorpheus
merged 4 commits into
SpongePowered:api-11
from
AlexandreArcil:fix/auth-event-called-twice
Nov 14, 2023
Merged
Auth event called twice #3911
ImMorpheus
merged 4 commits into
SpongePowered:api-11
from
AlexandreArcil:fix/auth-event-called-twice
Nov 14, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aromaa
added
type: bug
Something isn't working
system: event
version: 1.20
API: 11
labels
Nov 2, 2023
ImMorpheus
requested changes
Nov 11, 2023
...a/org/spongepowered/common/mixin/core/server/network/ServerLoginPacketListenerImplMixin.java
Outdated
Show resolved
Hide resolved
...a/org/spongepowered/common/mixin/core/server/network/ServerLoginPacketListenerImplMixin.java
Outdated
Show resolved
Hide resolved
...a/org/spongepowered/common/mixin/core/server/network/ServerLoginPacketListenerImplMixin.java
Outdated
Show resolved
Hide resolved
Ok I changed the injection point to what you wanted ! |
Thanks! Can you rebase on api-11 ? |
Done! |
I don't think that's it, the PR has ~30 commits. Please see https://docs.spongepowered.org/stable/en/contributing/howtogit.html |
AlexandreArcil
force-pushed
the
fix/auth-event-called-twice
branch
from
November 14, 2023 18:14
3f0b2ef
to
bb49179
Compare
AlexandreArcil
force-pushed
the
fix/auth-event-called-twice
branch
from
November 14, 2023 18:17
bb49179
to
189210f
Compare
Ok I did some force push and now everything is correct, no ? |
Yep, thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version
Minecraft: 1.20.2
SpongeAPI: 11.0.0-SNAPSHOT
Sponge: 1.20.2-11.0.0-SNAPSHOT
SpongeVanilla: 1.20.2-11.0.0-RC0
The bug
During the login of a player, the event
ServerSideConnectionEvent.Auth
was called twice.Reported by #3907.
Description
When a player logs in, the event
ServerSideConnectionEvent.Auth
is called for the first time byServerLoginPacketListenerImplMixin
and then byServerLoginPacketListenerImpl_1Mixin
if the server is on online mode, but and not called if it is on offline mode.The reason for this is due to how the mixin
ServerLoginPacketListenerImpl#impl$fireAuthEventOffline
was injected: at the assignment of the field state with the value KEY. In API-10 (1.19.4), this was done in singleplayer or if the server is in offline mode, but on API-11 (1.20.2), this is done if the server is on online mode. Later in the login process, the mixinServerLoginPacketListenerImpl_1Mixin
will trigger the event if the player was authenticated on an online server.The fix
As the name suggests,
fireAuthEventOffline
should only call the event when the server is in offline mode.The fix changes the injection point to the method
startClientVerification
because it's called when the server is in offline mode. It then checks whether if the game profile given as argument is an "offline profile". This is done by comparing it with the result of a call to the methodcreateOfflineProfile
because the profile argument comes from that method (ie:this.startClientVerification(createOfflineProfile(this.requestedUsername))
).startClientVerification
is also called in other cases: when it is on a singleplayer, but we were in the context of a server, and when the player is authenticated to the server, but the check skips the event trigger.