Skip to content

Commit 2afe536

Browse files
committed
fix(premium): cache updating workflow was broken
1 parent 4484da3 commit 2afe536

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

authme-core/src/main/java/fr/xephi/authme/service/PremiumService.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ public void performCleanup() {
268268

269269
/**
270270
* Finalizes a pending premium verification: saves the confirmed Mojang UUID to the database,
271-
* updates the player cache, notifies the proxy, and sends a success message to the player.
271+
* notifies the proxy, and sends a success message to the player.
272+
* Does NOT update the player cache — the player is not yet logged in at this point;
273+
* the subsequent forceLogin() call will add them to the cache once authentication completes.
272274
* Must be called from an async context.
273275
*
274276
* @param player the player whose premium status is being confirmed
@@ -284,13 +286,20 @@ public void finalizePendingPremium(Player player, UUID confirmedUuid) {
284286
logger.warning("Could not finalize pending premium for " + playerName + ": no auth record found");
285287
return;
286288
}
287-
storePremiumUuid(auth, confirmedUuid, player, playerName);
289+
storePremiumUuid(auth, confirmedUuid, player, playerName, false);
288290
}
289291

290292
private void storePremiumUuid(PlayerAuth auth, UUID uuid, CommandSender feedbackTarget, String playerName) {
293+
storePremiumUuid(auth, uuid, feedbackTarget, playerName, true);
294+
}
295+
296+
private void storePremiumUuid(PlayerAuth auth, UUID uuid, CommandSender feedbackTarget, String playerName,
297+
boolean updateCache) {
291298
auth.setPremiumUuid(uuid);
292299
if (dataSource.updatePremiumUuid(auth)) {
293-
playerCache.updatePlayer(auth);
300+
if (updateCache) {
301+
playerCache.updatePlayer(auth);
302+
}
294303
bungeeSender.sendPremiumSet(playerName);
295304
messages.send(feedbackTarget, MessageKey.PREMIUM_ENABLE_SUCCESS);
296305
} else {

0 commit comments

Comments
 (0)