Initialize DiamondBank-OG hook and guard against null economy hook #3

Merged
NotAlexNoyle merged 1 commits from codex/fix-economy-integration-to-use-diamondbank-og into main 2026-03-04 07:28:09 -05:00
NotAlexNoyle commented 2026-03-04 07:27:34 -05:00 (Migrated from github.com)

Motivation

  • The /bounty set command crashed because getEcoHook() returned null and code attempted to call takeEco(...) on it, causing an NPE. The plugin must always use DiamondBank-OG for economy operations rather than relying on an uninitialized hook.

Description

  • Assign the created DiamondBankOGHook instance to the plugin field this.ecoHook inside registerDefaultEcoHooks() so command handlers use DiamondBank-OG for economy operations by default (PlayerBountiesOG#registerDefaultEcoHooks).
  • Add a defensive guard in getEcoHook() that throws an explicit IllegalStateException when the economy hook is not initialized to fail fast with a clear message (PlayerBountiesOG#getEcoHook).
  • Changes are in src/main/java/com/tcoded/playerbountiesplus/PlayerBountiesOG.java and do not modify other command logic.

Testing

  • Attempted to run ./gradlew build in this environment; the build failed here with What went wrong: 25.0.1, so full Gradle validation could not be completed.

Codex Task

### Motivation - The `/bounty set` command crashed because `getEcoHook()` returned `null` and code attempted to call `takeEco(...)` on it, causing an NPE. The plugin must always use DiamondBank-OG for economy operations rather than relying on an uninitialized hook. ### Description - Assign the created `DiamondBankOGHook` instance to the plugin field `this.ecoHook` inside `registerDefaultEcoHooks()` so command handlers use DiamondBank-OG for economy operations by default (`PlayerBountiesOG#registerDefaultEcoHooks`). - Add a defensive guard in `getEcoHook()` that throws an explicit `IllegalStateException` when the economy hook is not initialized to fail fast with a clear message (`PlayerBountiesOG#getEcoHook`). - Changes are in `src/main/java/com/tcoded/playerbountiesplus/PlayerBountiesOG.java` and do not modify other command logic. ### Testing - Attempted to run `./gradlew build` in this environment; the build failed here with `What went wrong: 25.0.1`, so full Gradle validation could not be completed. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69a824341d18832f85558dd9d1d94892)
Sign in to join this conversation.