Final touches for the 1.0.6 release

This commit is contained in:
Kiran Hart 2019-02-03 18:57:44 -05:00
parent 8e8eecefcb
commit 1561a1ea56
8 changed files with 52 additions and 13 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.shadebyte</groupId>
<artifactId>auctionhouse</artifactId>
<name>AuctionHouse</name>
<version>1.0.5</version>
<version>1.0.5</version>
<description>A premium auction house plugin</description>
<url>https://www.shadebyte.com</url>
<build>

View File

@ -6,7 +6,7 @@
<groupId>com.shadebyte</groupId>
<artifactId>auctionhouse</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
<packaging>jar</packaging>
<name>AuctionHouse</name>

View File

@ -17,6 +17,7 @@ public enum Lang {
CANNOT_BID_OWN("cantbidonown"),
AIR("air"),
INVALID_TRANSACTION("invalidtransaction"),
BLOCKED_ITEM("blockeditem"),
AUCTION_LISTED("auction.listed"),
AUCTION_BUY("auction.buy"),

View File

@ -5,6 +5,7 @@ import com.shadebyte.auctionhouse.api.AuctionAPI;
import com.shadebyte.auctionhouse.util.NBTEditor;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@ -157,11 +158,11 @@ public class AuctionItem {
String timeLeft = AuctionAPI.getInstance().timeLeft(getTime());
for (String lores : Core.getInstance().getConfig().getStringList("auction-items.auction-stack")) {
lores.replace("{buynowprice}", buyNowNumber)
.replace("{seller", theOwner)
lore.add(ChatColor.translateAlternateColorCodes('&', lores.replace("{buynowprice}", buyNowNumber)
.replace("{seller}", theOwner)
.replace("{currentprice}", currentPriceNumber)
.replace("{bidincrement}", bidIncrementNumber)
.replace("{timeleft}", timeLeft);
.replace("{timeleft}", timeLeft)));
}
meta.setLore(lore);
@ -183,11 +184,11 @@ public class AuctionItem {
String timeLeft = AuctionAPI.getInstance().timeLeft(getTime());
for (String lores : Core.getInstance().getConfig().getStringList("auction-items.auction-stack")) {
lores.replace("{buynowprice}", buyNowNumber)
.replace("{seller", theOwner)
lore.add(ChatColor.translateAlternateColorCodes('&', lores.replace("{buynowprice}", buyNowNumber)
.replace("{seller}", theOwner)
.replace("{currentprice}", currentPriceNumber)
.replace("{bidincrement}", bidIncrementNumber)
.replace("{timeleft}", timeLeft);
.replace("{timeleft}", timeLeft)));
}
meta.setLore(lore);

View File

@ -17,9 +17,7 @@ import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
/**
* The current file has been created by Kiran Hart
@ -44,6 +42,27 @@ public class SellCommand extends SubCommand {
Player p = (Player) sender;
for (String bitems : Core.getInstance().getConfig().getStringList("blocked-items")) {
String[] item = bitems.split(":");
if (AuctionAPI.getItemInHand(p) != null || AuctionAPI.getItemInHand(p).getType() != Material.AIR) {
if (AuctionAPI.getItemInHand(p).getType() == Material.valueOf(item[0].toUpperCase()) && AuctionAPI.getItemInHand(p).getDurability() == Short.parseShort(item[1])) {
p.sendMessage(Core.getInstance().getSettings().getPrefix() + Core.getInstance().getLocale().getMessage(Lang.BLOCKED_ITEM.getNode()));
return;
}
}
}
int timeLimit;
List<Integer> times = new ArrayList<>();
for (String nodes : Core.getInstance().getConfig().getStringList("time-limits")) {
if (p.hasPermission(nodes)) {
times.add(Core.getInstance().getConfig().getInt("time-limits." + nodes));
}
}
timeLimit = (times.size() <= 0) ? Core.getInstance().getConfig().getInt("settings.default-auction-time") : Collections.max(times);
if (args.length == 1) {
p.sendMessage(Core.getInstance().getSettings().getPrefix() + Core.getInstance().getLocale().getMessage(Lang.CMD_SELL.getNode()));
return;
@ -78,7 +97,7 @@ public class SellCommand extends SubCommand {
return;
}
AuctionItem auctionItem = new AuctionItem(p.getUniqueId().toString(), AuctionAPI.getItemInHand(p), Core.getInstance().getConfig().getInt("settings.default-auction-time"), buyNow, 0, buyNow);
AuctionItem auctionItem = new AuctionItem(p.getUniqueId().toString(), AuctionAPI.getItemInHand(p), timeLimit, buyNow, 0, buyNow);
AuctionStartEvent auctionStartEvent = new AuctionStartEvent(auctionItem);
Core.getInstance().getServer().getPluginManager().callEvent(auctionStartEvent);
@ -178,7 +197,7 @@ public class SellCommand extends SubCommand {
return;
}
AuctionItem auctionItem = new AuctionItem(p.getUniqueId().toString(), AuctionAPI.getItemInHand(p), Core.getInstance().getConfig().getInt("settings.default-auction-time"), startPrice, increment, buyNow);
AuctionItem auctionItem = new AuctionItem(p.getUniqueId().toString(), AuctionAPI.getItemInHand(p), timeLimit, startPrice, increment, buyNow);
AuctionStartEvent auctionStartEvent = new AuctionStartEvent(auctionItem);
Core.getInstance().getServer().getPluginManager().callEvent(auctionStartEvent);

View File

@ -67,6 +67,11 @@ public class AuctionGUI implements AGUI {
p.openInventory(new ExpiredGUI(p).getInventory());
}
if (slot == 51) {
p.closeInventory();
p.openInventory(new TransactionSelectGUI().getInventory());
}
if (slot >= 0 & slot <= 44) {
if (clicked == null || clicked.getType() == Material.AIR) {

View File

@ -3,6 +3,7 @@
#have it in the same locale folder, just set new lang name here.
#Lang name formats: https://www.science.co.il/language/Locale-codes.php
lang: "en_US"
debugger: true
settings:
default-auction-time: 150 # 15 Minutes by default
@ -64,6 +65,17 @@ discord:
inline: false
data: "{item_lore}"
#add permissions to allow more auction time.
time-limits:
auctionhouse.times.default: 600
auctionhouse.times.rank1: 1200
#Blocked items that cannot be listed on the auction house
#You must include the type data (the number of : ) usually it's 0
#unless you're targeting glass or a changable item on 1.12 or lower (most cases)
blocked-items:
- "ENDER_CHEST:0"
auction-items:
use-short-form-number: true
auction-stack:

View File

@ -21,6 +21,7 @@ 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}"
blockeditem = "&cYou're not allowed to auction that item."
price.max.start = "&cPlease start auction with a lower price."
price.max.auction = "&cPlease start with a lower bid price."