Fix AuthMe login window: pause time tracking pre-auth and recalc on a…#10
Open
Becerritoo wants to merge 1 commit into
Open
Fix AuthMe login window: pause time tracking pre-auth and recalc on a…#10Becerritoo wants to merge 1 commit into
Becerritoo wants to merge 1 commit into
Conversation
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
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.
Summary
This PR fixes a timing/permission window where
PlayerTimeLimitcould incorrectly fall back todefaultbefore players authenticate with AuthMe (join -> /login).It also removes an unsafe async permission check path and makes limit recalculation/auth synchronization deterministic.
Problem
On AuthMe servers, players are online before being authenticated.
During that pre-auth window:
time_limitcould be set todefaultAdditionally,
PlayerUpdateLimitTaskwas running asynchronously while callingplayer.hasPermission(...), which is not a safe pattern for Bukkit player state access.Changes
1) Main-thread limit recalculation
PlayerUpdateLimitTaskfrom:runTaskTimerAsynchronously(...)runTaskTimer(...)2) Auth-aware readiness guard
isReadyForTimeTracking(Player)inPlayerDataManager.truetrueonly when:3) Pause pre-auth mutations
PlayerTimeTask.execute()now skips players not ready for tracking.PlayerUpdateLimitTask.execute()now skips limit recalculation for players not ready.manageJoin(...)no longer forcesupdateTimeLimit(...)before auth readiness.4) Immediate recalc on auth events
AuthMeSupportfr.xephi.authme.events.LoginEventfr.xephi.authme.events.RestoreSessionEventfr.xephi.authme.events.RegisterEvent5) Plugin metadata
AuthMetosoftdependinplugin.ymlFiles changed
src/main/java/ptl/ajneb97/PlayerTimeLimit.javasrc/main/java/ptl/ajneb97/managers/PlayerDataManager.javasrc/main/java/ptl/ajneb97/tasks/PlayerTimeTask.javasrc/main/java/ptl/ajneb97/tasks/PlayerUpdateLimitTask.javasrc/main/java/ptl/ajneb97/integrations/AuthMeSupport.java(new)src/main/resources/plugin.ymlCompatibility
Expected behavior after merge
defaultlimit overwrite during pre-login/auth window/loginor session restore