Skip to content

Commit 3ea2f9e

Browse files
committed
use server Vault account for Vault transactions
1 parent 02bd731 commit 3ea2f9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/pro/cloudnode/smp/bankaccounts/integrations/VaultIntegration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public boolean has(final @NotNull String player, final @NotNull String world, fi
235235
if (account.isEmpty()) return new EconomyResponse(amount, 0, EconomyResponse.ResponseType.FAILURE, "Account not found");
236236
if (!account.get().hasFunds(BigDecimal.valueOf(amount)))
237237
return new EconomyResponse(amount, Optional.ofNullable(account.get().balance).map(BigDecimal::doubleValue).orElse(Double.MAX_VALUE), EconomyResponse.ResponseType.FAILURE, "Insufficient funds");
238-
final @NotNull Account serverAccount = Account.getServerAccount().orElse(new Account.ClosedAccount());
238+
final @NotNull Account serverAccount = Account.getServerVaultAccount().orElse(new Account.ClosedAccount());
239239
// transfer funds to the server account since Vault just wants them "gone"
240240
account.get().transfer(serverAccount, BigDecimal.valueOf(amount), BankAccounts.getInstance().config().integrationsVaultDescription(), null);
241241
// remove funds from the server account without a transaction
@@ -287,7 +287,7 @@ public boolean has(final @NotNull String player, final @NotNull String world, fi
287287
public @NotNull EconomyResponse depositPlayer(final @NotNull OfflinePlayer player, final double amount) {
288288
final @NotNull Optional<@NotNull Account> account = Account.getVaultAccount(player);
289289
if (account.isEmpty()) return new EconomyResponse(amount, 0, EconomyResponse.ResponseType.FAILURE, "Account not found");
290-
final @NotNull Account serverAccount = Account.getServerAccount().orElse(new Account.ClosedAccount());
290+
final @NotNull Account serverAccount = Account.getServerVaultAccount().orElse(new Account.ClosedAccount());
291291
// add money to the server account and then transfer it to the player
292292
serverAccount.updateBalance(BigDecimal.valueOf(amount));
293293
serverAccount.transfer(account.get(), BigDecimal.valueOf(amount), BankAccounts.getInstance().config().integrationsVaultDescription(), null);

0 commit comments

Comments
 (0)