diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index 2675ecd..53e52e0 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -4,7 +4,7 @@
com.shadebyte
auctionhouse
AuctionHouse
- 1.0.4
+ 1.0.5
A premium auction house plugin
https://www.shadebyte.com
diff --git a/src/main/java/com/shadebyte/auctionhouse/api/enums/Lang.java b/src/main/java/com/shadebyte/auctionhouse/api/enums/Lang.java
index 5a01749..0c20e23 100644
--- a/src/main/java/com/shadebyte/auctionhouse/api/enums/Lang.java
+++ b/src/main/java/com/shadebyte/auctionhouse/api/enums/Lang.java
@@ -22,6 +22,7 @@ public enum Lang {
AUCTION_BUY("auction.buy"),
AUCTION_MAX("auction.max"),
AUCTION_SOLD("auction.sold"),
+ GOT_OUT_BID("outbid"),
MAX_START_PRICE("price.max.start"),
MAX_AUCTION_PRICE("price.max.auction"),
diff --git a/src/main/java/com/shadebyte/auctionhouse/auction/AuctionItem.java b/src/main/java/com/shadebyte/auctionhouse/auction/AuctionItem.java
index b34d805..36a2b2e 100644
--- a/src/main/java/com/shadebyte/auctionhouse/auction/AuctionItem.java
+++ b/src/main/java/com/shadebyte/auctionhouse/auction/AuctionItem.java
@@ -8,12 +8,11 @@ import org.bukkit.Bukkit;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
+import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import static org.bukkit.ChatColor.translateAlternateColorCodes;
-
/**
* The current file has been created by Kiran Hart
* Date Created: 7/6/2018
@@ -150,24 +149,21 @@ public class AuctionItem {
stack.setAmount((stack.getAmount() > 1) ? stack.getAmount() : 1);
ItemMeta meta = stack.getItemMeta();
List lore = (meta.hasLore() ? meta.getLore() : new ArrayList<>());
- lore.add(translateAlternateColorCodes('&', "&7-------------------------"));
- if (owner == null)
- lore.add(translateAlternateColorCodes('&', "&eSeller&f: &bSample User"));
- else
- lore.add(translateAlternateColorCodes('&', "&eSeller&f: &b" + Bukkit.getOfflinePlayer(UUID.fromString(owner)).getName()));
- lore.add(translateAlternateColorCodes('&', ""));
- lore.add(translateAlternateColorCodes('&', "&eBuy Now: &a$" + AuctionAPI.getInstance().friendlyNumber(buyNowPrice)));
- if (Core.getInstance().getConfig().getBoolean("settings.use-bid-system")) {
- lore.add(translateAlternateColorCodes('&', "&eCurrent Price: &a$" + AuctionAPI.getInstance().friendlyNumber(currentPrice)));
- lore.add(translateAlternateColorCodes('&', "&eBid Increment: &a$" + AuctionAPI.getInstance().friendlyNumber(bidIncrement)));
+
+ String theOwner = (owner == null) ? "&eSeller&f: &bSample User" : Bukkit.getOfflinePlayer(UUID.fromString(owner)).getName();
+ String buyNowNumber = (Core.getInstance().getConfig().getBoolean("auction-items.use-short-form-number")) ? AuctionAPI.getInstance().friendlyNumber(buyNowPrice) : String.valueOf(NumberFormat.getInstance().format(buyNowPrice));
+ String currentPriceNumber = (Core.getInstance().getConfig().getBoolean("settings.use-bid-system")) ? (Core.getInstance().getConfig().getBoolean("auction-items.use-short-form-number")) ? AuctionAPI.getInstance().friendlyNumber(currentPrice) : String.valueOf(NumberFormat.getInstance().format(currentPrice)) : "&cDisabled";
+ String bidIncrementNumber = (Core.getInstance().getConfig().getBoolean("settings.use-bid-system")) ? (Core.getInstance().getConfig().getBoolean("auction-items.use-short-form-number")) ? AuctionAPI.getInstance().friendlyNumber(bidIncrement) : String.valueOf(NumberFormat.getInstance().format(bidIncrement)) : "&cDisabled";
+ String timeLeft = AuctionAPI.getInstance().timeLeft(getTime());
+
+ for (String lores : Core.getInstance().getConfig().getStringList("auction-items.auction-stack")) {
+ lores.replace("{buynowprice}", buyNowNumber)
+ .replace("{seller", theOwner)
+ .replace("{currentprice}", currentPriceNumber)
+ .replace("{bidincrement}", bidIncrementNumber)
+ .replace("{timeleft}", timeLeft);
}
- lore.add(translateAlternateColorCodes('&', ""));
- lore.add(translateAlternateColorCodes('&', "&eTime Left: &b" + AuctionAPI.getInstance().timeLeft(getTime())));
- lore.add(translateAlternateColorCodes('&', "&7-------------------------"));
- if (Core.getInstance().getConfig().getBoolean("settings.use-bid-system"))
- lore.add(translateAlternateColorCodes('&', "&eLeft-Click&f: &bBid"));
- lore.add(translateAlternateColorCodes('&', "&eRight-Click&f: &bBuy Now"));
- lore.add(translateAlternateColorCodes('&', "&7-------------------------"));
+
meta.setLore(lore);
stack.setItemMeta(meta);
stack = NBTEditor.setItemTag(stack, getKey(), "AuctionItemKey");
@@ -179,15 +175,21 @@ public class AuctionItem {
stack.setAmount((stack.getAmount() > 1) ? stack.getAmount() : 1);
ItemMeta meta = stack.getItemMeta();
List lore = (meta.hasLore() ? meta.getLore() : new ArrayList<>());
- lore.add(translateAlternateColorCodes('&', "&7-------------------------"));
- lore.add(translateAlternateColorCodes('&', "&eBuy Now: &a$" + AuctionAPI.getInstance().friendlyNumber(buyNowPrice)));
- if (Core.getInstance().getConfig().getBoolean("settings.use-bid-system")) {
- lore.add(translateAlternateColorCodes('&', "&eCurrent Price: &a$" + AuctionAPI.getInstance().friendlyNumber(currentPrice)));
- lore.add(translateAlternateColorCodes('&', "&eBid Increment: &a$" + AuctionAPI.getInstance().friendlyNumber(bidIncrement)));
+
+ String theOwner = (owner == null) ? "&eSeller&f: &bSample User" : Bukkit.getOfflinePlayer(UUID.fromString(owner)).getName();
+ String buyNowNumber = (Core.getInstance().getConfig().getBoolean("auction-items.use-short-form-number")) ? AuctionAPI.getInstance().friendlyNumber(buyNowPrice) : String.valueOf(NumberFormat.getInstance().format(buyNowPrice));
+ String currentPriceNumber = (Core.getInstance().getConfig().getBoolean("settings.use-bid-system")) ? (Core.getInstance().getConfig().getBoolean("auction-items.use-short-form-number")) ? AuctionAPI.getInstance().friendlyNumber(currentPrice) : String.valueOf(NumberFormat.getInstance().format(currentPrice)) : "&cDisabled";
+ String bidIncrementNumber = (Core.getInstance().getConfig().getBoolean("settings.use-bid-system")) ? (Core.getInstance().getConfig().getBoolean("auction-items.use-short-form-number")) ? AuctionAPI.getInstance().friendlyNumber(bidIncrement) : String.valueOf(NumberFormat.getInstance().format(bidIncrement)) : "&cDisabled";
+ String timeLeft = AuctionAPI.getInstance().timeLeft(getTime());
+
+ for (String lores : Core.getInstance().getConfig().getStringList("auction-items.auction-stack")) {
+ lores.replace("{buynowprice}", buyNowNumber)
+ .replace("{seller", theOwner)
+ .replace("{currentprice}", currentPriceNumber)
+ .replace("{bidincrement}", bidIncrementNumber)
+ .replace("{timeleft}", timeLeft);
}
- lore.add(translateAlternateColorCodes('&', ""));
- lore.add(translateAlternateColorCodes('&', "&eTime Left: &b" + AuctionAPI.getInstance().timeLeft(getTime())));
- lore.add(translateAlternateColorCodes('&', "&7-------------------------"));
+
meta.setLore(lore);
stack.setItemMeta(meta);
stack = NBTEditor.setItemTag(stack, getKey(), "AuctionItemKey");
diff --git a/src/main/java/com/shadebyte/auctionhouse/inventory/inventories/AuctionGUI.java b/src/main/java/com/shadebyte/auctionhouse/inventory/inventories/AuctionGUI.java
index ea4dc6a..23183ec 100644
--- a/src/main/java/com/shadebyte/auctionhouse/inventory/inventories/AuctionGUI.java
+++ b/src/main/java/com/shadebyte/auctionhouse/inventory/inventories/AuctionGUI.java
@@ -19,6 +19,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.List;
+import java.util.UUID;
/**
* The current file has been created by Kiran Hart
@@ -97,12 +98,18 @@ public class AuctionGUI implements AGUI {
if (item.getOwner().equalsIgnoreCase(p.getUniqueId().toString())) {
if (Core.getInstance().getConfig().getBoolean("settings.owner-can-bid-own")) {
item.setCurrentPrice(item.getCurrentPrice() + item.getBidIncrement());
+ if (!item.getHighestBidder().equalsIgnoreCase(p.getUniqueId().toString())) {
+ Bukkit.getOfflinePlayer(UUID.fromString(item.getHighestBidder())).getPlayer().sendMessage(Core.getInstance().getSettings().getPrefix() + Core.getInstance().getLocale().getMessage(Lang.GOT_OUT_BID.getNode()).replace("{user}", Bukkit.getOfflinePlayer(UUID.fromString(item.getHighestBidder())).getName()));
+ }
item.setHighestBidder(p.getUniqueId().toString());
} else {
p.sendMessage(Core.getInstance().getSettings().getPrefix() + Core.getInstance().getLocale().getMessage(Lang.CANNOT_BID_OWN.getNode()));
}
} else {
item.setCurrentPrice(item.getCurrentPrice() + item.getBidIncrement());
+ if (!item.getHighestBidder().equalsIgnoreCase(p.getUniqueId().toString())) {
+ Bukkit.getOfflinePlayer(UUID.fromString(item.getHighestBidder())).getPlayer().sendMessage(Core.getInstance().getSettings().getPrefix() + Core.getInstance().getLocale().getMessage(Lang.GOT_OUT_BID.getNode()).replace("{user}", Bukkit.getOfflinePlayer(UUID.fromString(item.getHighestBidder())).getName()));
+ }
item.setHighestBidder(p.getUniqueId().toString());
}
@@ -158,6 +165,7 @@ public class AuctionGUI implements AGUI {
inventory.setItem(48, AuctionAPI.getInstance().createConfigItem("gui.auction.items.previouspage", 0, 0));
inventory.setItem(49, AuctionAPI.getInstance().createConfigItem("gui.auction.items.refresh", 0, 0));
inventory.setItem(50, AuctionAPI.getInstance().createConfigItem("gui.auction.items.nextpage", 0, 0));
+ inventory.setItem(51, AuctionAPI.getInstance().createConfigItem("gui.auction.items.transactions", 0, 0));
inventory.setItem(52, AuctionAPI.getInstance().createConfigItem("gui.auction.items.howtosell", 0, 0));
inventory.setItem(53, AuctionAPI.getInstance().createConfigItem("gui.auction.items.guide", 0, 0));
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index af05fee..22c9553 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -14,7 +14,7 @@ settings:
min-auction-increment: 1
owner-can-purchase-own: false
owner-can-bid-own: false
- use-bid-system: true
+ use-bid-system: false
auto-refresh-auction-page: true
bid:
increase-on-bid: true
@@ -64,7 +64,30 @@ discord:
inline: false
data: "{item_lore}"
-
+auction-items:
+ use-short-form-number: true
+ auction-stack:
+ - "&7-------------------------"
+ - "&eSeller&f: &b{seller}"
+ - ""
+ - "&eBuy Now: &a${buynowprice}"
+ #- "&eCurrent Price: &a${currentprice}"
+ #- "&eBid Increment: &a${bidincrement}"
+ #- "&eHighest Bidder: &a${highestbidder}"
+ - ""
+ - "&eTime Left: &b{timeleft}"
+ - "&7-------------------------"
+ #- "&eLeft-Click&f: &bBid"
+ - "&eRight-Click&f: &bBuy Now"
+ - "&7-------------------------"
+ listing-stack:
+ - "&7-------------------------"
+ - "&eBuy Now: &a${buynowprice}"
+ #- "&eCurrent Price: &a${currentprice}"
+ #- "&eBid Increment: &a${bidincrement}"
+ #- "&eHighest Bidder: &a${highestbidder}"
+ - "&eTime Left: &b{timeleft}"
+ - "&7-------------------------"
receipt:
give-on-transaction: true
@@ -302,6 +325,11 @@ gui:
- "&7purchase it right away with a set price."
- ""
- "&7For more help, use &e/ah help!"
+ transactions:
+ item: "PAPER:0"
+ name: "&e&lTransactions"
+ lore:
+ - "&7Click to view transaction history"
howtosell:
item: "GOLD_INGOT:0"
name: "&e&lHow to Sell"
diff --git a/src/main/resources/en_US.lang b/src/main/resources/en_US.lang
index 9439145..893206b 100644
--- a/src/main/resources/en_US.lang
+++ b/src/main/resources/en_US.lang
@@ -20,6 +20,7 @@ cantbidonown = "&cYou cannot bid on your own item!"
cantbuyown = "&cYou cannot buy your own item!"
air = "&CCome on, really tryna auction air?"
invalidtransaction = "&cThat transaction ID could not be found."
+outbid = "&cYou got outbid by &6{player}"
price.max.start = "&cPlease start auction with a lower price."
price.max.auction = "&cPlease start with a lower bid price."