All versions
Plugin crash on startup (
Null pointer exceptions when
2.0.1
Release
CombatGunSSS 2.0.16 months ago 23
Compatibility
Minecraft: Java Edition
1.21.x
Platforms
Paper
Purpur
Changes
[2.0.1] - 2026-04-14
Fixed
Plugin crash on startup (onEnable exception โ plugin disabled)
- Root cause: Any uncaught exception inside
onEnable()caused Bukkit to calldisablePlugin()immediately, leaving the plugin in a broken state where commands responded with "plugin is disabled" instead of a useful error message. - Fix: Refactored
onEnable()into isolated private methods (initManagers(),registerListeners(),startServices(),registerCommands()). Each step is now wrapped in a top-level try-catch. A detailed stack trace is printed to console before the plugin gracefully self-disables โ making the actual root cause visible instead of a cryptic command error.
StatsManager (SQLite) failure no longer kills the plugin
statsManager.init()is now wrapped in its own try-catch. If SQLite initialisation fails (missing driver, file permission error, corrupted DB), the plugin logs a warning, setsstatsManager = null, and continues loading. All stats-dependent features (/gun stats,/gun leaderboard, PAPI%combatgun_kills%etc.) degrade gracefully with a user-friendly error message.
HookManager failure no longer kills the plugin
hookManager.initAll()is wrapped in a try-catch. If any soft-depend integration throws an unexpected exception, the hook manager is set tonulland the plugin runs without integrations rather than crashing entirely.
Null pointer exceptions when hookManager or statsManager are null
GunListener.isAllowed()โ WorldGuard check now guards withhm != nullbefore callingcanShoot().GunListener.applyRecoil()โ AntiCheat exempt call guarded withhm2 != null.GunCommand.handleBuy()โ Vault access guarded; returns a friendly error if hook manager is unavailable.GunCommand.handleStats()/handleLeaderboard()โ Guarded withstatsManager != nullcheck; returns a friendly error if stats are disabled.EntityDeathListenerโ Stats recording guarded withstatsManager != null.
Material.GREY_DYE compile error
ThrowableManagerused the pre-1.13 material nameGREY_DYEwhich no longer exists. Corrected toGRAY_DYE(American English naming introduced in the 1.13 flattening).
Changed
onEnable()restructured intoinitManagers(),registerListeners(),startServices(),registerCommands(),scheduleCleanup(),printStartupBanner()for clarity and fault isolation.onDisable()wraps each cleanup call in its own try-catch so a failure in one manager never prevents the others from shutting down cleanly.- Startup banner now correctly reads version from
plugin.ymlat runtime viagetDescription().getVersion()โ no hardcoded version strings in Java code.
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:BSt2YZOI:Kp457GFF"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:BSt2YZOI:Kp457GFF"
}

