Skip to content

Update build.yml action and enhance hook loading - #269

Open
1robie wants to merge 8 commits into
Maxlego08:developfrom
1robie:develop
Open

1robie wants to merge 8 commits into
Maxlego08:developfrom
1robie:develop

Conversation

@1robie

@1robie 1robie commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements to error handling, robustness, and test coverage, especially around plugin integration and class loading. The changes ensure that failures in hooks or dependencies (such as missing plugins or broken APIs) are gracefully contained and reported, preventing them from affecting the rest of the system. Additionally, new tests have been added to verify these behaviors. There are also updates to build configurations and workflow files.

Error handling and robustness improvements:

  • Enhanced ClassRegistry to properly report and contain exceptions or errors thrown during class instantiation, logging the real cause and preventing a single bad hook from aborting the scan. [1] [2]
  • Improved VersionFilter to catch and log version parsing errors and failures when loading classes, ensuring that issues with third-party plugins do not interrupt the registration process. [1] [2]
  • Updated PacketUtils and related classes to check for API availability before performing actions, and to safely handle enabling/disabling when the API is missing or unavailable. [1] [2] [3] [4] [5] [6] [7]

Test coverage:

  • Added comprehensive unit tests for ClassRegistry to verify that constructor errors are reported and contained as expected.
  • Added tests for PacketUtils to ensure correct behavior when the API is missing, including readiness checks and error reporting.

Build and workflow updates:

  • Updated GitHub Actions workflow to use a specific version of the shared build workflow, improved artifact handling, and refined concurrency settings.
  • Added test dependencies to Common and Hooks/PacketEvents modules to support new tests. [1] [2]

Minor code cleanup:

  • Removed an unused import from ZInventoryManager.java.

Contain third-party failures during the annotation scan and at shutdown.

- VersionFilter: catch Throwable instead of Exception, so a NoClassDefFoundError
  from a broken hook no longer aborts the whole scan, and always log the failure
  instead of only under debug
- VersionFilter: guard version parsing of third-party plugins
- ClassRegistry: stop swallowing constructor failures, report 'constructor threw'
  separately from a genuinely missing constructor
- ZPlugin: add safeDisable and run every onDisable step through it, so a manager
  left half-built by a failed enable cannot skip config saving or service cleanup
- Tests: ClassRegistryTest and PacketUtilsTest cover the contained failures
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