mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-07 12:47:36 +01:00
fix out of bounds error with hasTime
Took 10 minutes
This commit is contained in:
parent
7e9043f359
commit
c88f185e8e
@ -143,17 +143,24 @@ public final class CommandSell extends AbstractCommand {
|
||||
boolean isStackPrice = false;
|
||||
boolean partialBuy = false;
|
||||
|
||||
List<String> timeSets = Arrays.asList(
|
||||
"second",
|
||||
"minute",
|
||||
"hour",
|
||||
"day",
|
||||
"week",
|
||||
"month"
|
||||
);
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
|
||||
if (NumberUtils.isDouble(args[i]) && !Double.isNaN(Double.parseDouble(args[i]))) {
|
||||
final boolean hasTimeValue = args.length >= i + 1 && Arrays.asList(
|
||||
"second",
|
||||
"minute",
|
||||
"hour",
|
||||
"day",
|
||||
"week",
|
||||
"month"
|
||||
).contains(args[i + 1]);
|
||||
boolean hasTimeValue = false;
|
||||
|
||||
if (i + 1 < args.length) {
|
||||
if (timeSets.contains(args[i + 1].toLowerCase()))
|
||||
hasTimeValue = true;
|
||||
}
|
||||
|
||||
if (!hasTimeValue) {
|
||||
if (buyNowPrice == null)
|
||||
@ -181,8 +188,6 @@ public final class CommandSell extends AbstractCommand {
|
||||
if (i + 2 < args.length) {
|
||||
int customTime = (int) AuctionAPI.toTicks(args[i + 1] + " " + args[i + 2]);
|
||||
|
||||
Bukkit.broadcastMessage(customTime + " time");
|
||||
|
||||
if (customTime <= Settings.MAX_CUSTOM_DEFINED_TIME.getInt())
|
||||
allowedTime = customTime;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user