Skip to content

Remove old config-based upgrade system; fix DB upgrade level alignment#75

Merged
tastybento merged 3 commits intodevelopfrom
feature/remove-old-upgrade-system
Feb 23, 2026
Merged

Remove old config-based upgrade system; fix DB upgrade level alignment#75
tastybento merged 3 commits intodevelopfrom
feature/remove-old-upgrade-system

Conversation

@tastybento
Copy link
Member

Summary

  • Fixes Problems with db-upgrade-system branch #68: Remove all config-based upgrade registrations (RangeUpgrade, BlockLimitsUpgrade, EntityLimitsUpgrade, EntityGroupLimitsUpgrade, CommandUpgrade) from UpgradesAddon.onEnable(). The player shop (/is upgrade) now only shows upgrades created through the admin GUI.
  • Fixes Upgrade is not made #71: Two-part fix for DB upgrades never appearing in the player shop:
    1. UpgradesData.getUpgradeLevel() now starts at 0 instead of 1 — a fresh island has no purchases yet.
    2. DatabaseUpgrade.findNextTier() now matches currentLevel directly (not currentLevel + 1). A tier with startLevel=0, endLevel=0 (one-shot upgrade) correctly shows for a fresh island (level 0) and disappears after purchase (level 1).
  • IslandLevelPrice is now registered unconditionally (moved out of the isLimitsProvided() guard) so it's always available as a price type in the admin GUI.

Test plan

  • All 70 existing tests pass (mvn test)
  • Admin creates an upgrade via /bsb admin upgrade, adds a tier (default 0–0), adds prices/rewards
  • Player opens /bsb upgrade — the new upgrade appears in the shop
  • Player purchases — tier is consumed, upgrade disappears (max level reached)
  • Old config-based upgrades no longer appear in the player shop
  • IslandLevelPrice selectable in admin GUI price list regardless of whether Limits is installed

🤖 Generated with Claude Code

tastybento and others added 3 commits February 22, 2026 20:47
- 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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
@tastybento tastybento merged commit a22b7cc into develop Feb 23, 2026
1 check failed
@tastybento tastybento deleted the feature/remove-old-upgrade-system branch February 23, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade is not made Problems with db-upgrade-system branch

1 participant