Add NullEconHandler to avoid verbose null checks

This commit is contained in:
Hannes Greule
2020-08-23 00:13:00 +02:00
committed by Alexander Söderberg
parent a5dea9e7f6
commit 551d1d9f1a
19 changed files with 146 additions and 91 deletions

View File

@ -107,14 +107,14 @@ public class BukkitModule extends AbstractModule {
install(new FactoryModuleBuilder().build(ChunkCoordinatorBuilderFactory.class));
}
@Provides @Singleton @Nullable EconHandler provideEconHandler() {
@Provides @Singleton @Nonnull EconHandler provideEconHandler() {
if (Bukkit.getPluginManager().isPluginEnabled("Vault")) {
try {
return new BukkitEconHandler();
} catch (final Exception ignored) {
}
}
return null;
return EconHandler.nullEconHandler();
}
}