Skip to content

fix: reduce BentoBox monster-class coupling from 24 to 20 (S1200)#2826

Merged
tastybento merged 1 commit intodevelopfrom
worktree-linear-percolating-cherny
Mar 4, 2026
Merged

fix: reduce BentoBox monster-class coupling from 24 to 20 (S1200)#2826
tastybento merged 1 commit intodevelopfrom
worktree-linear-percolating-cherny

Conversation

@tastybento
Copy link
Member

Summary

  • Extracts BentoBoxListenerRegistrar (listeners package) to own all Bukkit event-listener registration and the IslandDeletionManager lifecycle.
  • Extracts BentoBoxHookRegistrar (hooks package) to own all hook instantiation (early / world / late phases) and Multiverse class-detection logic.
  • Moves new BentoBoxCommand() into CommandsManager.registerDefaultCommands(), the natural home for "which commands does BentoBox register".

These three changes remove four package-level dependencies from BentoBox.java (org.bukkit.plugin, listeners.teleports, hooks.placeholders, commands), dropping the Sonar S1200 efferent-coupling count from 24 → 20.

No behavioural changes; the new classes land in packages already imported by BentoBox, so no new dependencies are introduced.

Test plan

  • ./gradlew compileJava — clean build, no errors
  • ./gradlew test — full test suite passes

🤖 Generated with Claude Code

Extract two focused helper classes to satisfy SRP and bring BentoBox's
efferent coupling within the Sonar-authorised limit of 20 packages:

- BentoBoxListenerRegistrar: owns all event-listener registration and
  the IslandDeletionManager lifecycle, removing the listeners.teleports
  package and the PluginManager import from BentoBox.
- BentoBoxHookRegistrar: owns all hook instantiation (early, world, and
  late phases) plus the hasClass() Multiverse detection, removing the
  hooks.placeholders package from BentoBox.
- CommandsManager.registerDefaultCommands(): moves `new BentoBoxCommand()`
  out of BentoBox, removing the commands package import.

No behavioural changes; full test suite passes.

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

sonarqubecloud bot commented Mar 4, 2026

@tastybento tastybento merged commit 80d6ec1 into develop Mar 4, 2026
3 checks passed
@tastybento tastybento deleted the worktree-linear-percolating-cherny branch March 4, 2026 05:55
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