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' ## 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: ## 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: ## 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. ## Use '' for a flag to reset it.
flagProfiles: flagProfiles:
default: default:

View File

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

View File

@ -266,7 +266,7 @@ public class BuyRegion extends GeneralRegion {
} }
/* Check if the player has enough money */ /* 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(); UUID oldOwner = getBuyer();
if(isResell && oldOwner != null) { if(isResell && oldOwner != null) {
clearFriends(); clearFriends();
@ -335,7 +335,13 @@ public class BuyRegion extends GeneralRegion {
return true; return true;
} else { } else {
/* Player has not enough money */ /* 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 { } else {
if(isBuyer(player)) { if(isBuyer(player)) {