Repository navigation
Refresh minion panels in place instead of reopening them - #1
Open
Crispi2k24 wants to merge 1 commit into
Open
Crispi2k24 wants to merge 1 commit into
Crispi2k24 wants to merge 1 commit into
Conversation
… hide the requirement lines on a maxed upgrade icon
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.
What changed
MinionPanelandMinionUpgradePanelrebuild their pane and callChestGui#update()instead of closing the inventory and opening a freshly built GUI.ChestLinkService#togglereturns the updated minion so the panel can repaint after a chest is unlinked, mirroring whatMinionRotationService#rotatealready does.The upgrade icon reads the minion back through
MinionAccessGuardafter every click instead of trusting the value returned byMinionUpgradeService#purchase.Required minion levelandCostmoved out of the per-kind icon lore intoupgradeAvailableLore, andupgradeMaximumLoretakes their place once an upgrade reaches its highest tier.Why
Three symptoms with one origin - the panels had no way to redraw themselves, so they either reopened the whole GUI or did nothing at all:
player.closeInventory()followed byopen(...), which flashes on the client.togglereturnedvoid, so{MINION_CHEST}kept the old status.The upgrade case has a second half worth calling out.
MinionUpgradePurchaseEventfires before payment and is cancellable, which is the documented way for another plugin to take the purchase over - pay with its own currency and apply the tier throughMinionManagementService#setUpgradeTier. When that happenspurchasereturns an emptyOptionaleven though the minion really did change, so a refresh driven by its return value never runs. Reading the minion back from the registry after the click keeps the panel right no matter who applied the change.At maximum tier the icon showed
Required minion level: -andCost: -. Those two lines carry no information, andunavailableValueexisted only to fill them, so it is gone.Testing / notes
./gradlew buildpasses. Verified on a Purpur 26.2 server: buying an upgrade, reaching maximum tier, rotating a minion, swapping its tool, collecting storage and unlinking a chest all update the open panel in place, with no reopening.One migration note: servers that already have a
panel.ymlkeep their existingupgradeElementslore, so the three trailing lines they have today will show up alongside the newupgradeAvailableLoreuntil those lines are deleted fromupgradeElements.unavailableValueis dropped automatically as an orphan.