Skip to content

Release 1.0.0#53

Merged
tastybento merged 91 commits intomasterfrom
develop
Apr 12, 2026
Merged

Release 1.0.0#53
tastybento merged 91 commits intomasterfrom
develop

Conversation

@tastybento
Copy link
Copy Markdown
Member

No description provided.

Poslovitch and others added 30 commits May 23, 2020 11:33
Removed ( and ) from config, do not work
fix #1
Adding final to save pos state and so repairing the parenthesis
Adding some more check to stop error
Stopping limits addon to reset when player join
listener for limits reset -> Check for presence of limits addon
Modification in api: New isShowed function
tastybento and others added 19 commits February 22, 2026 06:56
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* [ADD] Admin command
[ADD] Abstract for panel
[ADD] Base for admin panel

* [ADD] database for upgrade data & tier

[ADD] UpgradesDataManager to manage database

* [UP] Rename class Upgrade to UpgradeAPI

* Local variable addon was shadowing field addon line 551.

Removed need for a local variable by using a map to boolean.

* Code smell: Multiline blocks should be enclosed in curly braces

I think the log line should be shown unconditionally, but it was
indented in a way that made it look like it shouldn't be. I added curly
braces.

* Reordered the modifiers to comply with the Java Language Specification.

* Optimized Optional usage for cleaner code.

Initially this was to avoid the local variable 'vault' being used
because it was shadowing the vault field.

* Used isEmpty() to check whether the collection is empty or not.

* Optimized JoinPermCheckListener

Merged a number of collapsible if statements to increase the code's
readability. Made fields final.

* Defined a constant instead of duplicating the literal "[block]" 3 times.

Duplicated string literals make the process of refactoring error-prone,
since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but
only need to be updated in a single place.

* isConsole is a Boolean, not a boolean so needs to be checked differently

It may throw NullPointerException if the value is null.

* [UP] Remove unwanted "

* [UP] Defined constant for local keywords

* [ADD] Create methods for upgradeData & tier

[ADD] Code Doc in upgradesDataManeger
[ADD] Default values to upgrade data/tier

* [UP] Remove data duplicata

* [ADD] UpgradesDataManager to addon & clean unused validate

* [ADD] Chat input class with oneLine input

* [ADD] Edit Upgrade Panel

[WIP] Edit Tier Panel

* [ADD] base for edit upgrade panel

* [ADD] Button names for tier edits

* [ADD] Edit tier panel

[WIP] Edit price

* [UP] Dependencies versions
[ADD] prices interface

* [ADD] Reward interface

---------

Co-authored-by: guillaume-lebegue <guillaume.lebegue@epitech.eu>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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>
… (#72)

* Fix compatibility with Limits 1.28.0 API changes

- Update pom.xml to use Limits 1.28.0-SNAPSHOT
- BlockLimitsUpgrade: pass block.getKey() (NamespacedKey) to IslandBlockCount instead of Material
- LimitsReward: same NamespacedKey fix for BLOCK case in apply()
- JoinPermCheckListener, LimitsPermCheckListener: fix EntityGroup import from
  world.bentobox.limits.Settings.EntityGroup → world.bentobox.limits.EntityGroup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Resolve admin GUI issues #68-71

- #71: Call saveUpgradeData() + refreshDatabaseUpgrades() when active is
  toggled in EditUpgradePanel; also refresh on onReload() so DB upgrades
  appear in the player shop without a server restart.

- #69/#68: Rewrite AdminPanel as a direct list view — no intermediate
  Add/Edit/Delete selector screen. Upgrades are listed immediately with
  left-click to edit and right-click to delete (with confirmation). An
  'Add upgrade' button is always visible. An empty-state item guides
  admins on a fresh install. AbPanel gains onBuildHook() so returning
  from EditUpgradePanel always shows a refreshed list.

- #70 (8 UX improvements):
  1. User-typed name is now the display name (not the prefixed uniqueId)
     for both upgrades and tiers.
  2. New upgrades default to active=true.
  4. Tier Edit/Delete buttons are hidden when no tiers exist; Add tier
     shows a hint that at least one tier is required.
  5. Tier display name used in list panels instead of uniqueId.
  6. 'Add new reward/price' button changed from green glass pane to
     Emerald for better visibility.
  7. Range reward GUI shows formula value on the status icon instead of
     the generic 'Valid Configuration' label.
  8. Range reward formula input now validates as a parseable math
     expression; invalid input is rejected.

DatabaseUpgrade.isShowed() now also returns false when no tiers are
configured, preventing the upgrade from appearing as 'maxed out'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
AbPanel gains two static utilities:
- wrapText(String, int): word-wraps a string at the given column width
- wrapLore(List<String>): wraps every entry in a lore list at
  LORE_MAX_WIDTH (35 chars) and returns a flat list of lines

Applied in:
- AdminList: wraps getAdminDescription() output for price/reward items
- EditUpgradePanel: wraps the upgrade description lore
- EditTierPanel: wraps the tier description lore

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
#75)

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

- 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>

* Add DatabaseUpgrade/UpgradesData tests; fix missing refreshDatabaseUpgrades 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>

* Fix DB upgrade click doing nothing; fix [amount]/[rangelevel] in descriptions

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>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
On first enable for a game mode with no configured upgrades, six
example upgrades are seeded automatically so admins can immediately
see how the system works and have a starting point to edit:

  1. Border Expansion I  – MoneyPrice($500) → RangeReward(+5), 5×
  2. Border Expansion II – IslandLevel(100) + Money($2000) → Range(+10), 3×
  3. Hopper Limit        – Money($1000) → LimitsReward(BLOCK/HOPPER/+2), 5×
  4. Cow Limit           – Money($500)  → LimitsReward(ENTITY/COW/+2), 5×
  5. Diamond Border      – ItemPrice(10 DIAMOND) → RangeReward(+3), 3×
  6. Donor Perk          – PermissionPrice → CommandReward, 1×

Also adds getPublicDescription(User, PriceDB/RewardDB) overloads to
IslandLevelPrice, ItemPrice, PermissionPrice, and LimitsReward so
that placeholders ([level], [amount], [item], [permission], [type],
[target]) are substituted with real values in the player shop.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements two new passive/ongoing upgrade reward types:
- SpawnerReward: spawns extra entities on SpawnerSpawnEvent, proportional to a configurable formula
- CropGrowthReward: applies extra applyBoneMeal() on BlockGrowEvent for agricultural crops

Both use a fractional bonus approach (e.g. 0.5 = 50% chance of one extra per trigger)
and are compatible with any stacker plugin. Two example upgrades (Spawner Boost,
Crop Growth Boost) are now seeded on first install (8 total).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements two new passive/ongoing upgrade reward types:
- SpawnerReward: spawns extra entities on SpawnerSpawnEvent, proportional to a configurable formula
- CropGrowthReward: applies extra applyBoneMeal() on BlockGrowEvent for agricultural crops

Both use a fractional bonus approach (e.g. 0.5 = 50% chance of one extra per trigger)
and are compatible with any stacker plugin. Two example upgrades (Spawner Boost,
Crop Growth Boost) are now seeded on first install (8 total).

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
YesNoPanel was never shown (missing .getBuild().build() call) so
right-clicking did nothing. The filter predicate was also inverted
(== instead of !=), which would have deleted all other items instead
of the selected one on confirmation.

Fixes onDeletePrice and onDeleteReward in EditTierPanel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…owth-upgrades

Add spawner boost and crop growth boost reward types
Replaces the programmatic PanelBuilder with a YAML-driven TemplatedPanel,
allowing admins to customise the upgrade GUI layout without touching code.

- Add src/main/resources/panels/upgrades_panel.yml: default 6-row layout
  with 3×7 upgrade slots (21 per page) and PREVIOUS/NEXT pagination buttons
- Rewrite Panel.java: uses TemplatedPanelBuilder with UPGRADE, NEXT, and
  PREVIOUS type builders; adds a page field for pagination
- UpgradesAddon.onEnable: saveResource("panels/upgrades_panel.yml", false)
  copies the template on first run without overwriting admin edits
- en-US.yml: add previous/next/upgrade locale keys under upgradepanel
- Update UpgradesAddonTest: include panels/upgrades_panel.yml in test JAR
- Update PanelTest: set up BentoBox singleton and temp data folder with
  panel template so TemplatedPanelBuilder can build the inventory

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts:
#	src/main/java/world/bentobox/upgrades/UpgradesAddon.java
#	src/main/java/world/bentobox/upgrades/UpgradesManager.java
#	src/main/java/world/bentobox/upgrades/api/UpgradeAPI.java
#	src/main/java/world/bentobox/upgrades/command/PlayerUpgradeCommand.java
#	src/main/java/world/bentobox/upgrades/listeners/LimitsPermCheckListener.java
#	src/main/java/world/bentobox/upgrades/ui/Panel.java
#	src/main/java/world/bentobox/upgrades/ui/PanelClick.java
#	src/main/java/world/bentobox/upgrades/upgrades/BlockLimitsUpgrade.java
#	src/main/java/world/bentobox/upgrades/upgrades/CommandUpgrade.java
#	src/main/java/world/bentobox/upgrades/upgrades/EntityLimitsUpgrade.java
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

“Release 0.3.0” expands the Upgrades addon with additional runtime behavior (listeners/rewards/prices), UI interactions, and a significantly larger automated test suite to validate key upgrade flows and regressions.

Changes:

  • Added/updated upgrade UI behavior (panel click handling, chat-based admin input) and supporting resources/templates.
  • Implemented/updated upgrade pricing/reward evaluation and listeners that apply DB-backed upgrade effects in-game.
  • Added new JUnit/MockBukkit tests covering upgrade core logic, panel rendering, command-upgrade permission gating, and upgrade-level storage invariants.

Reviewed changes

Copilot reviewed 105 out of 106 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/main/java/world/bentobox/upgrades/ui/PanelClick.java Handles click behavior for upgrade items in the UI panel.
src/main/java/world/bentobox/upgrades/dataobjects/UpgradesData.java Stores per-island upgrade levels and provides level lookup/mutation.
src/main/java/world/bentobox/upgrades/dataobjects/prices/MoneyPrice.java Evaluates and charges money-based prices for upgrades.
src/main/java/world/bentobox/upgrades/dataobjects/rewards/RangeReward.java Applies range-related upgrade rewards based on configured equations.
src/main/java/world/bentobox/upgrades/dataobjects/rewards/LimitsReward.java Applies Limits-addon offsets as an upgrade reward.
src/main/java/world/bentobox/upgrades/ui/utils/ChatInput.java Provides chat-driven input collection/validation used by admin panels.
src/main/java/world/bentobox/upgrades/ui/admin/AdminPanel.java Admin UI for managing upgrades (create/edit/delete).
src/main/java/world/bentobox/upgrades/upgrades/CommandUpgrade.java Upgrade type that gates command behavior via permissions/levels.
src/main/java/world/bentobox/upgrades/listeners/SpawnerUpgradeListener.java Applies spawner-related bonus effects based on purchased DB upgrades.
src/main/java/world/bentobox/upgrades/listeners/CropGrowthListener.java Applies crop-growth bonus effects based on purchased DB upgrades.
src/main/resources/locales/ja.yml Adds/updates Japanese locale strings for UI and errors.
src/main/resources/panels/upgrades_panel.yml Adds the templated panel definition for the upgrades shop UI.
src/test/java/world/bentobox/upgrades/WhiteBox.java Adds a small reflection helper to set private static fields for tests.
src/test/java/world/bentobox/upgrades/upgrades/CommandUpgradeTest.java Tests command-upgrade permission parsing and visibility behavior.
src/test/java/world/bentobox/upgrades/ui/PanelTest.java Tests panel construction and showing behavior using MockBukkit.
src/test/java/world/bentobox/upgrades/dataobjects/UpgradesDataTest.java Regression tests for upgrade-level defaulting and round-trips.
src/test/java/world/bentobox/upgrades/api/UpgradeTest.java Tests core UpgradeAPI behaviors (canUpgrade/doUpgrade/values/description).
Comments suppressed due to low confidence (1)

src/main/java/world/bentobox/upgrades/dataobjects/UpgradesData.java:47

  • upgradesLevels is never initialized in the no-arg constructor, so when an instance is created via deserialization/DB load with a missing or null upgradesLevels field, both getUpgradeLevel() and setUpgradeLevel() will throw NPE. Initialize upgradesLevels in UpgradesData() (or null-guard/lazy-init it in the accessor methods).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/world/bentobox/upgrades/ui/PanelClick.java Outdated
Comment thread src/main/java/world/bentobox/upgrades/dataobjects/prices/MoneyPrice.java Outdated
Comment thread src/main/java/world/bentobox/upgrades/dataobjects/rewards/RangeReward.java Outdated
Comment thread src/main/java/world/bentobox/upgrades/ui/utils/ChatInput.java
Comment thread src/main/java/world/bentobox/upgrades/ui/utils/ChatInput.java
Comment thread src/main/java/world/bentobox/upgrades/upgrades/CommandUpgrade.java Outdated
Comment thread src/main/java/world/bentobox/upgrades/listeners/SpawnerUpgradeListener.java Outdated
Comment thread src/main/java/world/bentobox/upgrades/listeners/CropGrowthListener.java Outdated
Comment thread src/main/resources/locales/ja.yml Outdated
@tastybento
Copy link
Copy Markdown
Member Author

@copilot apply changes based on the comments in this thread to a new branch that will be a PR into develop.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

@tastybento I've opened a new pull request, #81, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits April 11, 2026 17:01
…bugs, loop optimizations (#81)

* Initial plan

* Fix review comments: NPE guards, [level] formula variable, ChatInput, debug log, loop optimizations, ja.yml

Agent-Logs-Url: https://github.com/BentoBoxWorld/Upgrades/sessions/a43eb321-a212-416e-994c-4fa6af167be8

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>

* Fix ChatInput: use flag to prevent double consumer invocation on valid input

Agent-Logs-Url: https://github.com/BentoBoxWorld/Upgrades/sessions/a43eb321-a212-416e-994c-4fa6af167be8

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
- Eliminate 11 S2637 @nonnull warnings in UpgradesManager by extracting
  a getGameModeName() helper and returning early when the game mode is
  absent, so the name passed to Settings is always non-null.
- Extract LEVEL_VAR / ISLAND_LEVEL_VAR / NUMBER_PLAYER_VAR constants on
  Price and Reward base classes and replace the duplicated "[level]"
  literals across price and reward implementations (clears S1192).
- Collapse CropGrowthListener.computeBonus and
  SpawnerUpgradeListener.computeBonus into a shared BonusCalculator
  helper, removing the copy-pasted nested-loop block and dropping both
  S3776 cognitive-complexity hits below the threshold.
- Rewrite PanelClick.onClick as a single guarded flow and suppress the
  S3516 blocker with a comment explaining the ClickHandler contract.
- Add PricesTest and RewardsTest covering all concrete price and reward
  classes plus their DB objects to lift new-code coverage above 30%.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
7.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@tastybento tastybento changed the title Release 0.3.0 Release 1.0.0 Apr 12, 2026
@tastybento tastybento merged commit c80f34d into master Apr 12, 2026
4 of 5 checks passed
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.

8 participants