mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-12-27 11:27:47 +01:00
Support for the new features in Craftconomy3 API.
This commit is contained in:
parent
f02d0c7942
commit
ea1c41233f
2
pom.xml
2
pom.xml
@ -238,7 +238,7 @@
|
||||
<dependency>
|
||||
<groupId>com.greatmancode</groupId>
|
||||
<artifactId>craftconomy3</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.1.3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.crystalyx.bukkit.simplyperms</groupId>
|
||||
|
@ -33,6 +33,7 @@ import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.greatmancode.craftconomy3.BukkitLoader;
|
||||
import com.greatmancode.craftconomy3.Cause;
|
||||
import com.greatmancode.craftconomy3.Common;
|
||||
import com.greatmancode.craftconomy3.account.Account;
|
||||
import com.greatmancode.craftconomy3.database.tables.AccountTable;
|
||||
@ -288,7 +289,7 @@ public class Economy_Craftconomy3 implements Economy {
|
||||
|
||||
@Override
|
||||
public boolean has(String playerName, String worldName, double amount) {
|
||||
return getBalance(playerName, worldName) >= amount;
|
||||
return Common.getInstance().getAccountManager().getAccount(playerName).hasEnough(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -300,7 +301,7 @@ public class Economy_Craftconomy3 implements Economy {
|
||||
double balance;
|
||||
Account account = Common.getInstance().getAccountManager().getAccount(playerName);
|
||||
if (account.hasEnough(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName())) {
|
||||
balance = account.withdraw(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
|
||||
balance = account.withdraw(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName(), Cause.VAULT, null);
|
||||
return new EconomyResponse(amount, balance, ResponseType.SUCCESS, "");
|
||||
} else {
|
||||
return new EconomyResponse(0, getBalance(playerName, worldName), ResponseType.FAILURE, "Insufficient funds");
|
||||
@ -315,7 +316,7 @@ public class Economy_Craftconomy3 implements Economy {
|
||||
|
||||
Account account = Common.getInstance().getAccountManager().getAccount(playerName);
|
||||
|
||||
double balance = account.deposit(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName());
|
||||
double balance = account.deposit(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName(), Cause.VAULT, null);
|
||||
return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user