Update economyoperation methods.

This commit is contained in:
drtshock
2013-03-19 22:46:46 -05:00
parent 7c63422853
commit ac44d0c5dd
3 changed files with 5 additions and 26 deletions
@@ -30,33 +30,13 @@ public class EconomyOperations {
* @return transaction success * @return transaction success
*/ */
public static boolean payToOpen(Player player) { public static boolean payToOpen(Player player) {
if(bukkitConfig.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !Main.useVault) if(!bukkitConfig.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !Main.useVault)
return true; return true;
double cost = bukkitConfig.getDouble("economy.cost-to-open"); double cost = bukkitConfig.getDouble("economy.cost-to-open");
EconomyResponse resp = Main.econ.withdrawPlayer(player.getName(), cost); EconomyResponse resp = Main.econ.withdrawPlayer(player.getName(), cost);
if(resp.transactionSuccess()) { if(resp.transactionSuccess()) {
player.sendMessage(Lang.TITLE.toString() + Lang.COST_TO_OPEN.toString()); player.sendMessage(Lang.TITLE.toString() + Lang.COST_TO_OPEN.toString().replaceAll("%price", "" + cost));
return true;
}
return false;
}
/**
* Have a player pay to make a vault.
* Returns true if successful. Otherwise false.
* @param player
* @return transaction success
*/
public static boolean payToMake(Player player) {
if(!bukkitConfig.getBoolean("economy.enabled") || player.hasPermission("playervaults.free") || !Main.useVault)
return true;
double cost = bukkitConfig.getDouble("economy.cost-to-create");
EconomyResponse resp = Main.econ.withdrawPlayer(player.getName(), cost);
if(resp.transactionSuccess()) {
player.sendMessage(Lang.TITLE.toString() + Lang.COST_TO_CREATE.toString());
return true; return true;
} }
@@ -76,7 +56,7 @@ public class EconomyOperations {
double cost = bukkitConfig.getDouble("economy.refund-on-delete"); double cost = bukkitConfig.getDouble("economy.refund-on-delete");
EconomyResponse resp = Main.econ.depositPlayer(player.getName(), cost); EconomyResponse resp = Main.econ.depositPlayer(player.getName(), cost);
if(resp.transactionSuccess()) { if(resp.transactionSuccess()) {
player.sendMessage(Lang.TITLE.toString() + Lang.REFUND_AMOUNT.toString()); player.sendMessage(Lang.TITLE.toString() + Lang.REFUND_AMOUNT.toString().replaceAll("%price", "" + cost));
return true; return true;
} }
@@ -16,7 +16,6 @@ public enum Lang {
NO_PERMS("no-permissions"), NO_PERMS("no-permissions"),
INSUFFICIENT_FUNDS("insufficient-funds"), INSUFFICIENT_FUNDS("insufficient-funds"),
REFUND_AMOUNT("refund-amount"), REFUND_AMOUNT("refund-amount"),
COST_TO_CREATE("cost-to-create"),
COST_TO_OPEN("cost-to-open"); COST_TO_OPEN("cost-to-open");
private String path = ""; private String path = "";
+1 -1
View File
@@ -6,7 +6,7 @@
# Will not download an update, that is your job :) # Will not download an update, that is your job :)
check-update: true check-update: true
# Settings here are for economy integration. # Settings here are for economy integration. playervaults.free bypasses it.
economy: economy:
enabled: false enabled: false