Conversation
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
|
@copilot |
- Only initialize SpawnerMenuFormUI if FloodgateHook is successfully loaded - Add null checks for spawnerMenuFormUI with fallback to standard GUI - Prevent NoClassDefFoundError when Floodgate/Cumulus classes are unavailable - Makes the implementation scalable for future FormUI components Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Implemented conditional FormUI initialization as requested in commit 7e6bbc5: Key Changes:
How it works:
This ensures no crashes while maintaining full Bedrock support when available. |
Problem
The codebase had scattered
isBedrockPlayer()checks that repeatedly accessed FloodgateApi directly, causing:NoClassDefFoundErrorwhen Floodgate/Cumulus classes are unavailableThis meant Bedrock players could sometimes see the wrong UI (standard GUI instead of FormUI), breaking the cross-platform experience.
Solution
Created a centralized
FloodgateHookintegration following the same pattern as existing integrations (AuraSkills, MythicMobs, etc.):1. FloodgateHook Class (
hooks/bedrock/FloodgateHook.java)isBedrockPlayer(Player)andisBedrockPlayer(UUID)methods2. IntegrationManager Integration
hasFloodgateflag andfloodgateHookinstance (public, following existing patterns)checkIntegrationPlugins()alongside other integrations3. Conditional FormUI Initialization
4. Updated All Bedrock Detection Points
5. Complete Menu Opening Coverage
All locations that open spawner menus now properly check for Bedrock players and use the appropriate UI:
Example
Before:
After:
Benefits
Testing
Tested scenarios:
Files Changed
hooks/bedrock/FloodgateHook.java- Centralized Bedrock detectionFixes #81
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.