-
Notifications
You must be signed in to change notification settings - Fork 566
feat(proxy): Added Login/Logout event tracking in the bungeecord/velocity modules #3096
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
Open
GoodTimes14
wants to merge
5
commits into
AuthMe:master
Choose a base branch
from
GoodTimes14:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
edcfb50
feat: Added proxy side login/logout/auto-login events
GoodTimes14 106d6df
chore: Removed unused import and unused string -> uuid cache map
GoodTimes14 1060344
fix: Corrected class name casing for `AuthMeVelocityAutoLoginEvent`
GoodTimes14 64fd212
refactor: Removed actually useless auto-login event classes
GoodTimes14 5c24c06
docs: Added Javadoc comments to login/logout events
GoodTimes14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
34 changes: 34 additions & 0 deletions
34
authme-bungee/src/main/java/fr/xephi/authme/bungee/events/AuthMeBungeeLoginEvent.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package fr.xephi.authme.bungee.events; | ||
|
|
||
| import net.md_5.bungee.api.connection.ProxiedPlayer; | ||
| import net.md_5.bungee.api.plugin.Event; | ||
|
|
||
| public class AuthMeBungeeLoginEvent extends Event { | ||
|
|
||
| private final ProxiedPlayer player; | ||
|
|
||
| private final boolean premium; | ||
|
|
||
| public AuthMeBungeeLoginEvent(ProxiedPlayer player, boolean premium) { | ||
| this.player = player; | ||
| this.premium = premium; | ||
| } | ||
|
|
||
| /** | ||
| * Return whether this player required Premium verification for login | ||
| * | ||
| * @return if the player required premium verification | ||
| */ | ||
| public boolean isPremium() { | ||
| return premium; | ||
| } | ||
|
|
||
| /** | ||
| * Return the player concerned by this event. | ||
| * | ||
| * @return The player who logged in correctly in the backend | ||
| */ | ||
| public ProxiedPlayer getPlayer() { | ||
| return player; | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
authme-bungee/src/main/java/fr/xephi/authme/bungee/events/AuthMeBungeeLogoutEvent.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package fr.xephi.authme.bungee.events; | ||
|
|
||
| import net.md_5.bungee.api.connection.ProxiedPlayer; | ||
| import net.md_5.bungee.api.plugin.Event; | ||
|
|
||
| public class AuthMeBungeeLogoutEvent extends Event { | ||
|
|
||
| private final ProxiedPlayer player; | ||
|
|
||
| public AuthMeBungeeLogoutEvent(ProxiedPlayer player) { | ||
| this.player = player; | ||
| } | ||
|
|
||
| /** | ||
| * Return the player concerned by this event. | ||
| * | ||
| * @return The player who logged out correctly in the backend | ||
| */ | ||
| public ProxiedPlayer getPlayer() { | ||
| return player; | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
34 changes: 34 additions & 0 deletions
34
authme-velocity/src/main/java/fr/xephi/authme/velocity/events/AuthMeVelocityLoginEvent.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package fr.xephi.authme.velocity.events; | ||
|
|
||
| import com.velocitypowered.api.proxy.Player; | ||
|
|
||
| public class AuthMeVelocityLoginEvent { | ||
|
|
||
|
|
||
| private final Player player; | ||
| private final boolean premium; | ||
|
|
||
| public AuthMeVelocityLoginEvent(Player player, boolean premium) { | ||
| this.player = player; | ||
| this.premium = premium; | ||
| } | ||
|
|
||
| /** | ||
| * Return the player concerned by this event. | ||
| * | ||
| * @return The player who logged in correctly in the backend | ||
| */ | ||
| public Player getPlayer() { | ||
| return player; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Return whether this player required Premium verification for login | ||
| * | ||
| * @return if the player required premium verification | ||
| */ | ||
| public boolean isPremium() { | ||
| return premium; | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
authme-velocity/src/main/java/fr/xephi/authme/velocity/events/AuthMeVelocityLogoutEvent.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package fr.xephi.authme.velocity.events; | ||
|
|
||
| import com.velocitypowered.api.proxy.Player; | ||
|
|
||
| public class AuthMeVelocityLogoutEvent { | ||
|
|
||
| private final Player player; | ||
|
|
||
| public AuthMeVelocityLogoutEvent(Player player) { | ||
| this.player = player; | ||
| } | ||
|
|
||
| /** | ||
| * Return the player concerned by this event. | ||
| * | ||
| * @return The player who logged out correctly in the backend | ||
| */ | ||
| public Player getPlayer() { | ||
| return player; | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isPremium() is always false for premium players (non-normalized name passed to premium lookup).
The new code computes boolean premium = requiresPremiumVerification(parsedMessage.playerName()) using the raw player name (e.g. "Alice"), but requiresPremiumVerification checks premiumUsernames / pendingPremiumUsernames, which store lowercase-normalized names (populated via normalizeName(...) at lines 287/306). So for any mixed/upper-case username, the lookup misses and AuthMeBungeeLoginEvent.isPremium() reports false even for genuinely premium players. The normalized playerName variable was just computed three lines above and should be used here (line 249) exactly as the Velocity side does (requiresPremiumVerification(normalizeName(...))).
Btw, the new test uses a non-premium player, so it doesn't catch this.