Cleanup: Mark EconomyAPI as Nullable and fix potential NPE

This commit is contained in:
Phoenix616 2023-03-01 17:37:22 +01:00
parent d6673c8afd
commit f547995164
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0

View File

@ -26,7 +26,7 @@ public class ReserveListener extends EconomyAdapter {
private static @Nullable EconomyAPI economyAPI;
public ReserveListener(EconomyAPI api) {
public ReserveListener(@Nullable EconomyAPI api) {
ReserveListener.economyAPI = api;
}
@ -127,7 +127,7 @@ public class ReserveListener extends EconomyAdapter {
@EventHandler
public void onCurrencyHoldCheck(CurrencyHoldEvent event) {
if (event.getAccount() == null || event.wasHandled() || !transactionCanFail() || event.canHold()) {
if (!provided() || event.getAccount() == null || event.wasHandled() || !transactionCanFail() || event.canHold()) {
return;
}