Skip to content

Add complete DB-driven upgrade system#67

Merged
tastybento merged 1 commit intodevelopfrom
feature/db-upgrade-system
Feb 22, 2026
Merged

Add complete DB-driven upgrade system#67
tastybento merged 1 commit intodevelopfrom
feature/db-upgrade-system

Conversation

@tastybento
Copy link
Member

@tastybento tastybento commented Feb 22, 2026

Summary

  • Behavior methods on Price/Reward: adds canPay(), pay() to Price abstract and apply() to Reward abstract, wiring admin-configured upgrades to actual game logic
  • 3 new Price types: MoneyPrice (Vault cost via formula), ItemPrice (inventory items), PermissionPrice (permission node gate) — each with DB counterpart and admin panel
  • 2 new Reward types: LimitsReward (block/entity/entity-group limit increases via Limits addon), CommandReward (console or player command execution) — each with DB counterpart and admin panel
  • DatabaseUpgrade bridge class: connects UpgradeData/UpgradeTier database objects to the player shop (UpgradeAPI), implementing updateUpgradeValue, canUpgrade, doUpgrade, and isShowed without touching legacy code
  • Panel.java fix: DatabaseUpgrade items show their own description without the legacy vault/level summary lines; legacy upgrades unchanged
  • Auto-loading: active DB upgrades are loaded per hooked game mode in onEnable; refreshDatabaseUpgrades() allows hot-reload after admin changes
  • Settings.evaluate(): public helper exposing formula evaluation outside the config package
  • Locale keys: added money, item, permission prices and limits, command rewards

Test plan

  • mvn test — all 70 existing tests pass
  • Start server with BSkyBlock + Level + Limits + Vault
  • Admin runs /bsb admin upgrade → creates upgrade with MoneyPrice + LimitsReward
  • Player runs /bsb upgrade → new upgrade appears with correct cost description
  • Player clicks → money withdrawn, HOPPER limit increased
  • Admin deactivates upgrade → upgrade disappears from player shop
  • Run /upgrades reload → DB upgrades refresh without restart

🤖 Generated with Claude Code

- Add `canPay()`/`pay()` abstracts to Price and implement in IslandLevelPrice, MoneyPrice, ItemPrice, PermissionPrice
- Add `apply()` abstract to Reward and implement in RangeReward, LimitsReward, CommandReward
- Create MoneyPrice/DB (Vault cost), ItemPrice/DB (inventory items), PermissionPrice/DB (permission gate)
- Create LimitsReward/DB (block/entity/entity-group limit increases), CommandReward/DB (console or player commands)
- Add DatabaseUpgrade bridge class wiring UpgradeData/UpgradeTier to the player shop
- Fix Panel.java display logic so DB upgrades show own description without legacy vault/level lines
- Register new price/reward types and auto-load active DB upgrades per hooked game mode in onEnable
- Add Settings.evaluate() public helper to expose formula evaluation outside the config package
- Add refreshDatabaseUpgrades() for use after admin changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tastybento tastybento merged commit 79764d7 into develop Feb 22, 2026
1 check failed
@tastybento
Copy link
Member Author

Latest commit resolves issues #68, #69, #70, and #71:

#71 — DB upgrades not appearing in player panel:

  • EditUpgradePanel: toggling active now calls saveUpgradeData() + refreshDatabaseUpgrades() immediately, so the player shop updates without a restart.
  • UpgradesAddon.onReload(): also calls refreshDatabaseUpgrades().
  • DatabaseUpgrade.isShowed(): returns false when no tiers are configured (prevents 'maxed out' display for unconfigured upgrades).

#69 — Admin panel opens directly in list view:

  • AdminPanel rewritten: no more intermediate Add/Edit/Delete selector. Opening /bsb upgrade now shows all DB-backed upgrades as a list immediately.
  • Left-click to edit, right-click to delete (with confirmation).
  • AbPanel gains onBuildHook() / clearItems() / setupNavigationButton() so returning from EditUpgradePanel always shows a refreshed list.

#68 — Empty admin list on fresh install:

  • The new list view shows a descriptive empty-state item ("No upgrades yet — click 'Add upgrade' to create one") when no upgrades exist.

#70 — 8 UX improvements:

  1. User-typed name is now the display name (not the GameMode_input uniqueId) for upgrades and tiers.
  2. New upgrades default to active=true.
  3. Tier Edit/Delete buttons are hidden when no tiers exist; Add tier shows a hint.
  4. Tier name shown in list panels instead of uniqueId.
  5. 'Add new reward/price' button changed from green stained glass pane to Emerald.
  6. Range reward status icon now shows the formula value instead of generic 'Valid Configuration'.
  7. Range reward formula input validates as a parseable math expression.

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.

1 participant