Don't charge players for costs of zero
This commit is contained in:
@@ -22,7 +22,6 @@ import com.drtshock.playervaults.PlayerVaults;
|
|||||||
import com.drtshock.playervaults.translations.Lang;
|
import com.drtshock.playervaults.translations.Lang;
|
||||||
import net.milkbowl.vault.economy.EconomyResponse;
|
import net.milkbowl.vault.economy.EconomyResponse;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -48,6 +47,9 @@ public class EconomyOperations {
|
|||||||
if (!VaultManager.getInstance().vaultExists(player.getUniqueId().toString(), number)) {
|
if (!VaultManager.getInstance().vaultExists(player.getUniqueId().toString(), number)) {
|
||||||
return payToCreate(player);
|
return payToCreate(player);
|
||||||
} else {
|
} else {
|
||||||
|
if (PlayerVaults.getInstance().getConf().getEconomy().getFeeToOpen() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
double cost = PlayerVaults.getInstance().getConf().getEconomy().getFeeToOpen();
|
double cost = PlayerVaults.getInstance().getConf().getEconomy().getFeeToOpen();
|
||||||
EconomyResponse resp = PlayerVaults.getInstance().getEconomy().withdrawPlayer(player, cost);
|
EconomyResponse resp = PlayerVaults.getInstance().getEconomy().withdrawPlayer(player, cost);
|
||||||
if (resp.transactionSuccess()) {
|
if (resp.transactionSuccess()) {
|
||||||
@@ -66,7 +68,7 @@ public class EconomyOperations {
|
|||||||
* @return The transaction success
|
* @return The transaction success
|
||||||
*/
|
*/
|
||||||
public static boolean payToCreate(Player player) {
|
public static boolean payToCreate(Player player) {
|
||||||
if (!PlayerVaults.getInstance().isEconomyEnabled() || player.hasPermission("playervaults.free")) {
|
if (!PlayerVaults.getInstance().isEconomyEnabled() || PlayerVaults.getInstance().getConf().getEconomy().getFeeToCreate() == 0 || player.hasPermission("playervaults.free")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +90,7 @@ public class EconomyOperations {
|
|||||||
* @return The transaction success.
|
* @return The transaction success.
|
||||||
*/
|
*/
|
||||||
public static boolean refundOnDelete(Player player, int number) {
|
public static boolean refundOnDelete(Player player, int number) {
|
||||||
if (!PlayerVaults.getInstance().isEconomyEnabled() || player.hasPermission("playervaults.free")) {
|
if (!PlayerVaults.getInstance().isEconomyEnabled() || PlayerVaults.getInstance().getConf().getEconomy().getRefundOnDelete() == 0 || player.hasPermission("playervaults.free")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user