Skip to content

Fix: mode cycling icon shown when all island settings flags are hidden from non-op users#2864

Merged
tastybento merged 2 commits intodevelopfrom
copilot/fix-island-settings-comparator
Mar 14, 2026
Merged

Fix: mode cycling icon shown when all island settings flags are hidden from non-op users#2864
tastybento merged 2 commits intodevelopfrom
copilot/fix-island-settings-comparator

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

When all flags for a settings tab are hidden from non-operator players, the mode cycling icon (BASIC/ADVANCED/EXPERT tier selector) was still rendered, allowing players to cycle into a mode with no visible content — making the icon appear to vanish and leaving the UI in an unrecoverable state across sessions (since the selected mode is persisted per-user).

Changes

  • SettingsTab.getTabIcons() — Mode cycling icon is now conditional on hasVisibleFlags(). If all flags of this tab's type are hidden from the user, the icon is suppressed entirely.

  • SettingsTab.getPanelItems() — The mode auto-advance loop now also skips modes where all flags are invisible to the user (not just modes with zero flags), using the new isVisibleToUser(Flag) helper:

    while ((flags.isEmpty() || flags.stream().allMatch(f -> !isVisibleToUser(f)))
            && i++ < Flag.Mode.values().length) { ... }
  • TabbedPanel.openPanel()tab.getPanelItems() is now called before setupHeader(), so getTabIcons() observes the currentMode already advanced by the auto-cycle logic rather than the stale pre-cycle value.

  • SettingsTabTest — Replaced the single testGetTabIcons with three targeted cases: no flags (empty icons), visible flags (mode icon present at slot 7), and all flags hidden (mode icon absent).

Original prompt

This section details on the original issue you should resolve

<issue_title>Island settings are viewable even when all options are hidden of first open</issue_title>
<issue_description>### Expected behavior

The comparator shouldn't disappear, whatsoever.
https://gyazo.com/a863ac3c9fc2f1e227a56c0558edda3b

Observed/Actual behavior

When you use /ob settings and then change the settings tier, the comparator disappears completely.
And since the UI saves what tier you're on, if you exit on expert (while comparator is gone) , and you reopen it, you'll never see the comparator unless you exit on anything other than expert.

However, opped accounts (/op) saves the comparator icon no matter what.

Steps/models to reproduce

Do /ob settings
Click the icon that changes the settings tier (basic, expert) ect.

BentoBox version

image

Plugin list

image

Other

https://gyazo.com/a863ac3c9fc2f1e227a56c0558edda3b</issue_description>

Comments on the Issue (you are @copilot in this section)

@BONNe Technically it can happen if all island settings are disabled from chanigng.

The bug is that it displayed it at the start.</comment_new>


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

When all island settings options are hidden from non-operator players, the
mode cycling icon (IRON_INGOT/GOLD_INGOT/NETHER_BRICK) was incorrectly shown
in the settings panel. This caused confusion because clicking it would cycle
to a mode with no visible content, making the icon appear to 'disappear'.

Changes:
- SettingsTab.getTabIcons(): Only show the mode cycling icon when hasVisibleFlags()
  returns true (i.e., at least one non-hidden flag exists for this tab type).
- SettingsTab.getPanelItems(): The while loop that auto-advances past empty modes
  now also skips modes where all flags are hidden from the non-op user.
- TabbedPanel.openPanel(): Call tab.getPanelItems() before setupHeader() so that
  the tab's internal currentMode state is updated before getTabIcons() reads it.
- SettingsTabTest: Updated tests to cover the new mode icon visibility behavior.

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix island settings comparator disappearing issue Fix: mode cycling icon shown when all island settings flags are hidden from non-op users Mar 14, 2026
Copilot AI requested a review from tastybento March 14, 2026 21:34
@tastybento tastybento marked this pull request as ready for review March 14, 2026 21:36
@sonarqubecloud
Copy link
Copy Markdown

@tastybento tastybento merged commit 05a57ca into develop Mar 14, 2026
3 checks passed
@tastybento tastybento deleted the copilot/fix-island-settings-comparator branch March 14, 2026 21:50
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.

Island settings are viewable even when all options are hidden of first open

2 participants