Bug description
EzShops crashes on startup with a NullPointerException when Vault is installed but no economy provider (e.g. EssentialsX, CMI) has registered a Vault Economy service.
java.lang.NullPointerException: economy
at com.skyblockexp.ezshops.bootstrap.PlayerShopComponent.<init>(PlayerShopComponent.java:58)
at com.skyblockexp.ezshops.bootstrap.EzShopsBootstrap.start(EzShopsBootstrap.java:99)
Root cause
EzShopsBootstrap.setupEconomy() has a fallback that returns true when getPlugin("Vault") != null, even when getRegistration(Economy.class) == null:
if (getRegistration(Economy.class) == null && getPlugin("Vault") == null) return false;
// ...
economy = registration.getProvider(); // registration is null -> NPE later
return true;
The economy field stays null, and PlayerShopComponent's constructor throws on Objects.requireNonNull(economy).
Expected behaviour
Like the existing missing-Vault case, the plugin should log a clear message ("no Vault economy provider registered") and disable itself cleanly, instead of crashing with an unhandled NPE.
Fix
Branch fix/bootstrap-economy-npe on fork OrzMC/EzShops:
setupEconomy() checks getRegistration(Economy.class) first and returns false (clean disable) when no provider is registered, with a helpful log line.
- Adds regression tests covering both "provider registered" and "Vault present but no provider" (MockBukkit).
- While touching
PlayerShopComponent, the non-fatal DB-fallback logs (Jaloquent / MySQL) are downgraded from SEVERE to WARNING so a missing remote DB no longer logs at error level.
Bug description
EzShops crashes on startup with a
NullPointerExceptionwhen Vault is installed but no economy provider (e.g. EssentialsX, CMI) has registered a VaultEconomyservice.Root cause
EzShopsBootstrap.setupEconomy()has a fallback that returnstruewhengetPlugin("Vault") != null, even whengetRegistration(Economy.class) == null:The
economyfield staysnull, andPlayerShopComponent's constructor throws onObjects.requireNonNull(economy).Expected behaviour
Like the existing missing-Vault case, the plugin should log a clear message ("no Vault economy provider registered") and disable itself cleanly, instead of crashing with an unhandled NPE.
Fix
Branch
fix/bootstrap-economy-npeon forkOrzMC/EzShops:setupEconomy()checksgetRegistration(Economy.class)first and returnsfalse(clean disable) when no provider is registered, with a helpful log line.PlayerShopComponent, the non-fatal DB-fallback logs (Jaloquent / MySQL) are downgraded fromSEVEREtoWARNINGso a missing remote DB no longer logs at error level.