mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-27 21:22:57 +00:00
Harden auction display and trader stock init
This commit is contained in:
1 parent
77c8e418eb
commit
d657bab73c
11 files changed
+148
-41
No files matched your search
@@ -107,6 +107,9 @@ public class AuctionFilter {
|
||||
if (listing == null) {
|
||||
return false;
|
||||
}
|
||||
if (listing.item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Search text filter (case-insensitive)
|
||||
if (!searchText.isEmpty()) {
|
||||
@@ -199,9 +202,13 @@ public class AuctionFilter {
|
||||
maxPrice = compound.getLong("MaxPrice");
|
||||
buyoutOnly = compound.getBoolean("BuyoutOnly");
|
||||
noBidsOnly = compound.getBoolean("NoBidsOnly");
|
||||
page = compound.getInteger("Page");
|
||||
page = Math.max(0, compound.getInteger("Page"));
|
||||
pageSize = compound.getInteger("PageSize");
|
||||
if (pageSize <= 0) pageSize = 20;
|
||||
if (pageSize <= 0) {
|
||||
pageSize = 20;
|
||||
} else {
|
||||
pageSize = Math.min(100, pageSize);
|
||||
}
|
||||
sellerUUID = compound.getString("SellerUUID");
|
||||
sellerName = compound.getString("SellerName");
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ public class TraderStock {
|
||||
return pStock.getStock(slot, maxStock[slot]);
|
||||
}
|
||||
|
||||
if (currentStock[slot] < 0) {
|
||||
return maxStock[slot];
|
||||
}
|
||||
return Math.max(0, currentStock[slot]);
|
||||
}
|
||||
|
||||
@@ -83,6 +86,9 @@ public class TraderStock {
|
||||
return pStock.consumeStock(slot, maxStock[slot], amount);
|
||||
}
|
||||
|
||||
if (currentStock[slot] < 0) {
|
||||
currentStock[slot] = maxStock[slot];
|
||||
}
|
||||
if (currentStock[slot] >= amount) {
|
||||
currentStock[slot] -= amount;
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user