diff --git a/pom.xml b/pom.xml
index 7427026..51c28fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ca.tweetzy
auctionhouse
- 2.6.0
+ 2.6.2
UTF-8
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
index cf795a5..3b298ba 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIAuctionHouse.java
@@ -165,6 +165,11 @@ public class GUIAuctionHouse extends Gui {
return;
}
+ if (!AuctionHouse.getInstance().getEconomy().has(e.player, auctionItem.getBasePrice())) {
+ AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player);
+ return;
+ }
+
cleanup();
e.manager.showGUI(e.player, new GUIConfirmPurchase(this.auctionPlayer, auctionItem, false));
} else {
diff --git a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIConfirmPurchase.java b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIConfirmPurchase.java
index db308ac..68101c2 100644
--- a/src/main/java/ca/tweetzy/auctionhouse/guis/GUIConfirmPurchase.java
+++ b/src/main/java/ca/tweetzy/auctionhouse/guis/GUIConfirmPurchase.java
@@ -75,6 +75,14 @@ public class GUIConfirmPurchase extends Gui {
AuctionItem located = AuctionHouse.getInstance().getAuctionItemManager().getItem(this.auctionItem.getKey());
preItemChecks(e, located);
+ // Check economy
+ if (!AuctionHouse.getInstance().getEconomy().has(e.player, this.buyingSpecificQuantity ? this.purchaseQuantity * this.pricePerItem : located.getBasePrice())) {
+ AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player);
+ SoundManager.getInstance().playSound(e.player, Settings.SOUNDS_NOT_ENOUGH_MONEY.getString(), 1.0F, 1.0F);
+ e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
+ return;
+ }
+
Bukkit.getServer().getScheduler().runTaskAsynchronously(AuctionHouse.getInstance(), () -> {
AuctionEndEvent auctionEndEvent = new AuctionEndEvent(Bukkit.getOfflinePlayer(this.auctionItem.getOwner()), e.player, this.auctionItem, AuctionSaleType.WITHOUT_BIDDING_SYSTEM);
Bukkit.getServer().getPluginManager().callEvent(auctionEndEvent);
@@ -159,13 +167,6 @@ public class GUIConfirmPurchase extends Gui {
e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
return;
}
-
- if (!AuctionHouse.getInstance().getEconomy().has(e.player, located.getBasePrice())) {
- AuctionHouse.getInstance().getLocale().getMessage("general.notenoughmoney").sendPrefixedMessage(e.player);
- SoundManager.getInstance().playSound(e.player, Settings.SOUNDS_NOT_ENOUGH_MONEY.getString(), 1.0F, 1.0F);
- e.manager.showGUI(e.player, new GUIAuctionHouse(this.auctionPlayer));
- return;
- }
}
private ItemStack getPurchaseInfoItem(int qty) {