Use local player cache for pay commands#283
Open
Javavailable wants to merge 3 commits into
Open
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.
📋 Description
This fixes a lag issue we noticed on our live server when players repeatedly used pay commands with unknown player names.
Before this change, the pay flow tried to resolve offline player names synchronously through Minecraft Services when the target was not online. With random or invalid names, this could make a normal command wait on an external request and cause visible server lag.
The pay command now only uses local player data. Online players can still be paid normally, known/cached economy players still work, and unknown offline names fail fast with the existing player-not-found message.
✅ Checklist
Fixes #issue_numberorCloses #issue_numbermainbranch🔍 Changes
CurrencyPlayerManagergetPlayer(UUID, String)overload to avoid unnecessary name lookups when the player name is already known/payto avoid synchronous UUID lookups for unknown offline names🧪 How to Test
/pay <onlinePlayer> <amount>and confirm the payment still works./pay <knownPlayerName> <amount>and confirm known cached players can still be paid./pay <randomUnknownName> <amount>and confirm it immediately returns the existing player-not-found message instead of waiting on an external lookup./<currency> pay <player> <amount>.