Remove old config-based upgrade system; fix DB upgrade level alignment#75
Merged
tastybento merged 3 commits intodevelopfrom Feb 23, 2026
Merged
Remove old config-based upgrade system; fix DB upgrade level alignment#75tastybento merged 3 commits intodevelopfrom
tastybento merged 3 commits intodevelopfrom
Conversation
- UpgradesAddon: stop registering RangeUpgrade, BlockLimitsUpgrade, EntityLimitsUpgrade, EntityGroupLimitsUpgrade, CommandUpgrade; the player shop now shows only admin-GUI-created upgrades (fixes #68). Move IslandLevelPrice registration outside the isLimitsProvided() guard so it's always available as a price type. - UpgradesData: getUpgradeLevel() now starts at 0 instead of 1 so a fresh island has no purchases recorded yet. - DatabaseUpgrade: findNextTier() checks currentLevel directly (not currentLevel+1). A tier with startLevel=0, endLevel=0 now correctly matches a fresh island (level 0) and disappears after one purchase (level 1). Fixes #71. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…grades on create - DatabaseUpgradeTest (21 tests): covers isShowed() gating, the level-0 → tier-0-0 alignment fix, updateUpgradeValue() max-level detection, canUpgrade() price delegation, and doUpgrade() level increment + pay/apply calls. - UpgradesDataTest (7 tests): regression tests confirming that getUpgradeLevel() returns 0 (not 1) for a fresh island, which is the root cause of all DB upgrades appearing permanently maxed. - AdminPanel.addUpgrade: call refreshDatabaseUpgrades() after creating a new upgrade so it is immediately visible in the player shop. Without this the upgrade was saved to the DB but never added to addon.upgrade, so /is upgrade showed nothing. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…riptions PanelClick was gating on getUpgradeValues(user) == null, a field that DatabaseUpgrade intentionally never sets. Every click on a DB upgrade exited silently before reaching canUpgrade() or doUpgrade(). Fix: - PanelClick: treat (upgradeValues==null && ownDescription==null) as "maxed out" so DB upgrades are allowed through. - DatabaseUpgrade.updateUpgradeValue: always set a non-null ownDescription when a tier is found (fall back to tier name when the tier has no prices/rewards) so PanelClick can distinguish "available free upgrade" from "truly maxed". - Price/Reward: add getPublicDescription(user, db) overloads with a default that delegates to getPublicDescription(user). - MoneyPrice: override to substitute [amount] with the configured formula string instead of showing the raw placeholder. - RangeReward: override to substitute [rangelevel] with the formula. - DatabaseUpgrade.updateUpgradeValue: use the new DB-aware overloads when building the player-facing description. - en-US.yml: update range reward description to include [rangelevel]. - DatabaseUpgradeTest: 4 new tests covering the click-gate fix and description substitution. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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
RangeUpgrade,BlockLimitsUpgrade,EntityLimitsUpgrade,EntityGroupLimitsUpgrade,CommandUpgrade) fromUpgradesAddon.onEnable(). The player shop (/is upgrade) now only shows upgrades created through the admin GUI.UpgradesData.getUpgradeLevel()now starts at0instead of1— a fresh island has no purchases yet.DatabaseUpgrade.findNextTier()now matchescurrentLeveldirectly (notcurrentLevel + 1). A tier withstartLevel=0, endLevel=0(one-shot upgrade) correctly shows for a fresh island (level 0) and disappears after purchase (level 1).IslandLevelPriceis now registered unconditionally (moved out of theisLimitsProvided()guard) so it's always available as a price type in the admin GUI.Test plan
mvn test)/bsb admin upgrade, adds a tier (default 0–0), adds prices/rewards/bsb upgrade— the new upgrade appears in the shopIslandLevelPriceselectable in admin GUI price list regardless of whether Limits is installed🤖 Generated with Claude Code