Migrating from JavaPlugin
Converting an existing Bukkit/Spigot plugin to use Foundation is straightforward but requires careful attention to a few critical changes.Core plugin class changes
Update lifecycle methods
Foundation uses different method names to perform its own initialization:Before:After:
Add shading configuration
Add Foundation shading to your
pom.xml as described in the installation guide.This is critical - without proper shading, your plugin will include unnecessary dependencies.Migrating listeners
Foundation provides automatic listener registration: Before:Add
@AutoRegister annotation and implement SimpleListener (or just Listener) for automatic registration. You can also manually register using registerEvents(new PlayerJoinListener()).Migrating commands
Replace plugin.yml commands with Foundation’s command system: Before (plugin.yml):- No
plugin.ymlneeded - Automatic permission checking
- Built-in player/console validation
- Easy tab completion
- Cleaner code
Migrating configuration
Before:- Type-safe static access
- Auto-updating (adds new keys from defaults)
- Comment preservation
- Validation and error handling
Common API replacements
| Old Code | Foundation Equivalent |
|---|---|
getLogger().info(msg) | Common.log(msg) |
player.sendMessage(msg) | Common.tell(player, msg) |
Bukkit.broadcastMessage(msg) | Common.broadcast(msg) |
Bukkit.getScheduler().runTaskLater(...) | Common.runLater(ticks, runnable) |
Bukkit.getScheduler().runTaskTimer(...) | Common.runTimer(delay, period, runnable) |
new ItemStack(Material.STONE) | CompMaterial.STONE.toItem() |
player.kickPlayer(reason) | PlayerUtil.kick(player, reason) |
Upgrading between Foundation versions
Check the version
First, check which version you’re currently using in yourpom.xml:
Update dependency
Update version number
Change the version to the latest from GitHub releases:
Check for deprecations
Review your IDE warnings for deprecated methods and update them according to the JavaDoc suggestions.
Breaking changes by version
Foundation maintains backward compatibility in most cases, but some major versions include breaking changes:Always check the GitHub releases page for detailed changelogs and migration notes for specific versions.
Version 6.x changes
- Minecraft 1.20+ support: Added support for new features in recent Minecraft versions
- Folia support: Foundation now supports Folia server software
- API refinements: Some legacy methods were deprecated in favor of cleaner alternatives
Version 5.x to 6.x migration
Most plugins should upgrade seamlessly. Key changes:- Updated dependencies: Paper API version updated to latest
- NBT API improvements: Enhanced NBT manipulation methods
- Menu system: Minor improvements to menu APIs
Migration checklist
Use this checklist when migrating to Foundation:- Updated main class to extend
SimplePlugin - Changed
onEnable()toonPluginStart() - Changed
onDisable()toonPluginStop() - Updated
getInstance()method to useSimplePlugin.getInstance() - Removed manual instance field storage
- Added proper shading configuration to
pom.xmlorbuild.gradle - Migrated commands from
plugin.ymltoSimpleCommand - Added
@AutoRegisterto listeners (optional but recommended) - Updated configuration to use
YamlStaticConfig(optional) - Replaced common Bukkit API calls with Foundation equivalents
- Tested plugin on a development server
- Verified jar file size is reasonable (not bloated)
- Checked console for any warnings or errors
Getting help
If you encounter issues during migration:Example Plugin
See a complete Foundation plugin example
GitHub Issues
Report bugs or ask questions
Video Tutorial
Watch the installation and setup guide
DeepWiki
Ask AI assistant about Foundation
Common migration issues
Plugin won’t load after migration
Cause: Not extendingSimplePlugin or using onEnable()/onDisable()
Solution: Ensure you extend SimplePlugin and use onPluginStart()/onPluginStop()
Jar file size increased dramatically
Cause: Improper shading configuration including all of Foundation’s optional dependencies Solution: Review your shade plugin configuration to only include Foundation:NoClassDefFoundError for Foundation classes
Cause: Foundation not properly shaded into your jar Solution: Verify your shade plugin is configured correctly and running during the package phaseCommands not working
Cause: Still defined inplugin.yml or not registered properly
Solution: Remove from plugin.yml and register using registerCommand() in onPluginStart()
Listeners not firing
Cause: Not implementingSimpleListener or missing @AutoRegister
Solution: Add @AutoRegister annotation or manually register using registerEvents()