Update economyoperation methods.
This commit is contained in:
@@ -30,33 +30,13 @@ public class EconomyOperations {
|
||||
* @return transaction success
|
||||
*/
|
||||
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;
|
||||
|
||||
double cost = bukkitConfig.getDouble("economy.cost-to-open");
|
||||
EconomyResponse resp = Main.econ.withdrawPlayer(player.getName(), cost);
|
||||
if(resp.transactionSuccess()) {
|
||||
player.sendMessage(Lang.TITLE.toString() + Lang.COST_TO_OPEN.toString());
|
||||
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());
|
||||
player.sendMessage(Lang.TITLE.toString() + Lang.COST_TO_OPEN.toString().replaceAll("%price", "" + cost));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -76,7 +56,7 @@ public class EconomyOperations {
|
||||
double cost = bukkitConfig.getDouble("economy.refund-on-delete");
|
||||
EconomyResponse resp = Main.econ.depositPlayer(player.getName(), cost);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ public enum Lang {
|
||||
NO_PERMS("no-permissions"),
|
||||
INSUFFICIENT_FUNDS("insufficient-funds"),
|
||||
REFUND_AMOUNT("refund-amount"),
|
||||
COST_TO_CREATE("cost-to-create"),
|
||||
COST_TO_OPEN("cost-to-open");
|
||||
|
||||
private String path = "";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Will not download an update, that is your job :)
|
||||
check-update: true
|
||||
|
||||
# Settings here are for economy integration.
|
||||
# Settings here are for economy integration. playervaults.free bypasses it.
|
||||
economy:
|
||||
enabled: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user