Fix a bug with buying a region while it is in resell mode

This commit is contained in:
Thijs Wiefferink 2015-01-12 17:11:08 +01:00
parent 679ffe2145
commit 5bae5ecf67
3 changed files with 12 additions and 8 deletions

View File

@ -233,7 +233,7 @@ schematicProfiles:
## You can add groups by using 'g:<groupname>', so in total you could use: '%uuid%, %friendsuuid%, g:vip, n:cool-guy'
## For flags like 'entry' and 'exit' you can add group setting by using 'g:<scope>' behind it, <scope> is one of the following:
## members, non_members, owners, non_owners, all. Example, only owners can enter the region:
## entry: 'allow g:owners'
## entry: 'deny g:non_owners'
## Use '' for a flag to reset it.
flagProfiles:
default:

View File

@ -1,6 +1,6 @@
name: AreaShop
main: nl.evolutioncoding.areashop.AreaShop
version: 2.1.3
version: 2.1.4
depend: [Vault, WorldGuard, WorldEdit]
softdepend: [Multiverse-Core]
author: NLThijs48
@ -9,8 +9,6 @@ commands:
AreaShop:
description: For all commands use /as help
usage: AreaShop has not started correctly, check the console and correct any errors
permission: areashop.help
permission-message: You don't have <permission>
aliases: [as]
permissions:
areashop.*:
@ -53,7 +51,7 @@ permissions:
areashop.stopresellall: true
areashop.addfriendall: true
areashop.delfriendall: true
areashop.nofityupdate: true
areashop.notifyupdate: true
areashop.help:
description: Allows you to see the help pages
default: true
@ -207,6 +205,6 @@ permissions:
areashop.delfriendall:
description: Allows you to delete friends from all regions
default: op
areashop.nofityupdate:
areashop.notifyupdate:
description: Will notify this player when an update is available
default: op

View File

@ -266,7 +266,7 @@ public class BuyRegion extends GeneralRegion {
}
/* Check if the player has enough money */
if(plugin.getEconomy().has(player, getWorldName(), getPrice())) {
if((!isResell && plugin.getEconomy().has(player, getWorldName(), getPrice())) || (isResell && plugin.getEconomy().has(player, getWorldName(), getResellPrice()))) {
UUID oldOwner = getBuyer();
if(isResell && oldOwner != null) {
clearFriends();
@ -335,7 +335,13 @@ public class BuyRegion extends GeneralRegion {
return true;
} else {
/* Player has not enough money */
plugin.message(player, "buy-lowMoney", plugin.formatCurrency(plugin.getEconomy().getBalance(player, getWorldName())), getFormattedPrice());
String requiredMoney = "";
if(isResell) {
requiredMoney = getFormattedResellPrice();
} else {
requiredMoney = getFormattedPrice();
}
plugin.message(player, "buy-lowMoney", plugin.formatCurrency(plugin.getEconomy().getBalance(player, getWorldName())), requiredMoney);
}
} else {
if(isBuyer(player)) {