From cd9cd478b5e1f75b0ace97f80bd1a5ffc4b5d8b1 Mon Sep 17 00:00:00 2001 From: Jkobs <66284145+Minzilein2003@users.noreply.github.com> Date: Sun, 13 Mar 2022 21:58:50 +0100 Subject: [PATCH] AddMoney --- pom.xml | 2 +- .../net/t2code/lib/Spigot/Lib/vault/Vault.java | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index b5563fb..06d0158 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code T2CodeLib - 11.1 + 11.2 jar T2CodeLib diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java b/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java index ec2e9a9..d78e45c 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/vault/Vault.java @@ -22,12 +22,20 @@ public class Vault { } p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix); } else { - if (Main.eco.getBalance(p) < price) { - return false; - } else { - Main.eco.withdrawPlayer(p, price); - return true; + return Main.eco.withdrawPlayer(p,price).transactionSuccess(); + } + return false; + } + + public static boolean addMoney(String prefix, Player p, Double price) { + if (Main.eco == null) { + if (Bukkit.getPluginManager().getPlugin("Vault") == null) { + send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " + + "§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix); } + p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix); + } else { + return Main.eco.depositPlayer(p,price).transactionSuccess(); } return false; }