Skip to content

fix: respect actionbar/bossbar config settings in BossBarListener#538

Merged
tastybento merged 1 commit into
developfrom
fix/actionbar-setting-ignored-537
Jul 18, 2026
Merged

fix: respect actionbar/bossbar config settings in BossBarListener#538
tastybento merged 1 commit into
developfrom
fix/actionbar-setting-ignored-537

Conversation

@tastybento

Copy link
Copy Markdown
Member

Fixes #537

Problem

Setting actionbar: false in config.yml did not stop the action bar from showing.

Root cause

Both the ONEBLOCK_BOSSBAR and ONEBLOCK_ACTIONBAR flags declare BossBarListener as their flag listener, and BentoBox's FlagsManager.registerFlag registers that listener into Bukkit. So with actionbar: false and bossbar: true, the listener was still registered via the boss bar flag. tryToShowActionBar only checked the island flag — and island.isAllowed() returns the flag's default (true) even when the flag was never registered — so the action bar kept showing.

The same problem existed in mirror form for the boss bar (bossbar: false + actionbar: true).

Fix

  • Guard tryToShowActionBar and tryToShowBossBar with their respective config settings.
  • Remove the explicit registerListener(bossBar) call in onEnable: it duplicated the FlagsManager registration, so when both settings were enabled the handlers fired twice per event. (Its && condition was also why nothing else broke when one setting was disabled — the flag path registered the listener anyway.)

Tests

New BossBarListenerTest covering config-disabled, flag-denied, and enabled paths for both bars (5 tests). Full suite passes: 518 tests, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_012eC7vj7ghNGSNGpxqQazxm

The BossBarListener is registered into Bukkit by BentoBox's FlagsManager
whenever the ONEBLOCK_BOSSBAR or ONEBLOCK_ACTIONBAR flag is registered.
With actionbar: false and bossbar: true in config.yml, the listener was
still active via the boss bar flag, and tryToShowActionBar only checked
the island flag - which defaults to allowed even when unregistered - so
the action bar showed despite being disabled.

Guard both tryToShowActionBar and tryToShowBossBar with their config
settings, and remove the explicit registerListener(bossBar) call in
onEnable which duplicated the FlagsManager registration and caused the
handlers to fire twice per event when both settings were enabled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012eC7vj7ghNGSNGpxqQazxm
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit 3d2bd69 into develop Jul 18, 2026
3 checks passed
@tastybento
tastybento deleted the fix/actionbar-setting-ignored-537 branch July 18, 2026 04:25
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.

i disabled action bar but in showing

1 participant