2012-01-25 16:32:34 +01:00
|
|
|
package com.Acrobot.ChestShop.Economy;
|
|
|
|
|
2012-06-25 17:16:24 +02:00
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
|
|
|
2012-01-25 16:32:34 +01:00
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
2012-11-25 23:34:21 +01:00
|
|
|
public class Vault extends EconomyManager {
|
|
|
|
private static net.milkbowl.vault.economy.Economy vaultPlugin;
|
2012-01-25 16:32:34 +01:00
|
|
|
|
|
|
|
public boolean hasAccount(String player) {
|
2012-11-25 23:34:21 +01:00
|
|
|
return vaultPlugin.hasAccount(player);
|
2012-01-25 16:32:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void add(String player, double amount) {
|
2012-11-25 23:34:21 +01:00
|
|
|
vaultPlugin.depositPlayer(player, amount);
|
2012-01-25 16:32:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void subtract(String player, double amount) {
|
2012-11-25 23:34:21 +01:00
|
|
|
vaultPlugin.withdrawPlayer(player, amount);
|
2012-01-25 16:32:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasEnough(String player, double amount) {
|
2012-11-25 23:34:21 +01:00
|
|
|
return vaultPlugin.has(player, amount);
|
2012-01-25 16:32:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public double balance(String player) {
|
2012-11-25 23:34:21 +01:00
|
|
|
return vaultPlugin.getBalance(player);
|
2012-01-25 16:32:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public String format(double amount) {
|
2012-11-25 23:34:21 +01:00
|
|
|
return vaultPlugin.format(amount);
|
2012-01-25 16:32:34 +01:00
|
|
|
}
|
2012-06-25 17:16:24 +02:00
|
|
|
|
|
|
|
public static String getPluginName() {
|
2012-11-25 23:34:21 +01:00
|
|
|
if (vaultPlugin == null) {
|
2012-06-25 17:16:24 +02:00
|
|
|
return "";
|
|
|
|
} else {
|
2012-11-25 23:34:21 +01:00
|
|
|
return vaultPlugin.getName();
|
2012-06-25 17:16:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Vault getVault() {
|
|
|
|
RegisteredServiceProvider<net.milkbowl.vault.economy.Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
|
|
|
|
|
|
|
if (rsp == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2012-11-25 23:34:21 +01:00
|
|
|
vaultPlugin = rsp.getProvider();
|
2012-06-25 17:16:24 +02:00
|
|
|
|
2012-11-25 23:34:21 +01:00
|
|
|
if (vaultPlugin == null) {
|
2012-06-25 17:16:24 +02:00
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
return new Vault();
|
|
|
|
}
|
|
|
|
}
|
2012-01-25 16:32:34 +01:00
|
|
|
}
|