mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 20:24:30 +00:00
Refactor auction system: consolidate controllers, add lang keys, remove categories
- Consolidate AuctionLogger and AuctionNotificationController into AuctionController - Add inline logging and notification methods to AuctionController - Add comprehensive LANG keys for all auction GUI strings - Update EnumAuctionSort and EnumAuctionDuration to use lang keys - Remove category filtering system (EnumAuctionCategory deleted) - Update AuctionFilter to remove category references - Update GuiAuction and all sub-GUIs to use StatCollector.translateToLocal() - Update AuctionListing to remove category field and NBT serialization
This commit is contained in:
15 files changed
+374
-1165
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.constants.EnumAuctionCategory;
|
||||
import noppes.npcs.constants.EnumAuctionSort;
|
||||
|
||||
/**
|
||||
@@ -13,9 +12,6 @@ public class AuctionFilter {
|
||||
/** Search text to match against item names */
|
||||
public String searchText = "";
|
||||
|
||||
/** Category to filter by (ALL for no category filter) */
|
||||
public EnumAuctionCategory category = EnumAuctionCategory.ALL;
|
||||
|
||||
/** How to sort results */
|
||||
public EnumAuctionSort sortOrder = EnumAuctionSort.ENDING_SOON;
|
||||
|
||||
@@ -55,15 +51,6 @@ public class AuctionFilter {
|
||||
return filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a filter with category
|
||||
*/
|
||||
public static AuctionFilter category(EnumAuctionCategory category) {
|
||||
AuctionFilter filter = new AuctionFilter();
|
||||
filter.category = category;
|
||||
return filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a filter for a specific seller
|
||||
*/
|
||||
@@ -80,11 +67,6 @@ public class AuctionFilter {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuctionFilter withCategory(EnumAuctionCategory category) {
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuctionFilter withSort(EnumAuctionSort sort) {
|
||||
this.sortOrder = sort;
|
||||
return this;
|
||||
@@ -135,11 +117,6 @@ public class AuctionFilter {
|
||||
}
|
||||
}
|
||||
|
||||
// Category filter
|
||||
if (category != EnumAuctionCategory.ALL && listing.category != category) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Price range filter (uses current bid or starting price)
|
||||
long price = listing.currentBid > 0 ? listing.currentBid : listing.startingPrice;
|
||||
if (minPrice > 0 && price < minPrice) {
|
||||
@@ -180,7 +157,6 @@ public class AuctionFilter {
|
||||
*/
|
||||
public void reset() {
|
||||
searchText = "";
|
||||
category = EnumAuctionCategory.ALL;
|
||||
sortOrder = EnumAuctionSort.ENDING_SOON;
|
||||
minPrice = 0;
|
||||
maxPrice = 0;
|
||||
@@ -196,7 +172,6 @@ public class AuctionFilter {
|
||||
*/
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setString("SearchText", searchText);
|
||||
compound.setInteger("Category", category.ordinal());
|
||||
compound.setInteger("SortOrder", sortOrder.ordinal());
|
||||
compound.setLong("MinPrice", minPrice);
|
||||
compound.setLong("MaxPrice", maxPrice);
|
||||
@@ -215,11 +190,6 @@ public class AuctionFilter {
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
searchText = compound.getString("SearchText");
|
||||
|
||||
int catOrdinal = compound.getInteger("Category");
|
||||
if (catOrdinal >= 0 && catOrdinal < EnumAuctionCategory.values().length) {
|
||||
category = EnumAuctionCategory.values()[catOrdinal];
|
||||
}
|
||||
|
||||
int sortOrdinal = compound.getInteger("SortOrder");
|
||||
if (sortOrdinal >= 0 && sortOrdinal < EnumAuctionSort.values().length) {
|
||||
sortOrder = EnumAuctionSort.values()[sortOrdinal];
|
||||
@@ -240,7 +210,6 @@ public class AuctionFilter {
|
||||
public String toString() {
|
||||
return "AuctionFilter{" +
|
||||
"search='" + searchText + '\'' +
|
||||
", category=" + category +
|
||||
", sort=" + sortOrder +
|
||||
", price=" + minPrice + "-" + maxPrice +
|
||||
", buyoutOnly=" + buyoutOnly +
|
||||
|
||||
@@ -4,7 +4,6 @@ import kamkeel.npcs.controllers.data.attribute.ItemTradeAttribute;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.config.ConfigMarket;
|
||||
import noppes.npcs.constants.EnumAuctionCategory;
|
||||
import noppes.npcs.constants.EnumAuctionDuration;
|
||||
import noppes.npcs.constants.EnumAuctionStatus;
|
||||
import noppes.npcs.controllers.AuctionBlacklist;
|
||||
@@ -48,9 +47,6 @@ public class AuctionListing {
|
||||
// Status
|
||||
public EnumAuctionStatus status = EnumAuctionStatus.ACTIVE;
|
||||
|
||||
// Category for filtering
|
||||
public EnumAuctionCategory category = EnumAuctionCategory.MISC;
|
||||
|
||||
// Claim tracking
|
||||
public boolean sellerClaimed = false; // Has seller claimed their proceeds?
|
||||
public boolean buyerClaimed = false; // Has buyer claimed their item?
|
||||
@@ -87,7 +83,6 @@ public class AuctionListing {
|
||||
this.duration = duration;
|
||||
this.listingTime = System.currentTimeMillis();
|
||||
this.expirationTime = listingTime + duration.getMillis();
|
||||
this.category = EnumAuctionCategory.categorize(item);
|
||||
this.status = EnumAuctionStatus.ACTIVE;
|
||||
}
|
||||
|
||||
@@ -351,7 +346,6 @@ public class AuctionListing {
|
||||
compound.setLong("ExpirationTime", expirationTime);
|
||||
compound.setInteger("Duration", duration.ordinal());
|
||||
compound.setInteger("Status", status.ordinal());
|
||||
compound.setInteger("Category", category.ordinal());
|
||||
compound.setBoolean("SellerClaimed", sellerClaimed);
|
||||
compound.setBoolean("BuyerClaimed", buyerClaimed);
|
||||
compound.setInteger("BidCount", bidCount);
|
||||
@@ -396,13 +390,6 @@ public class AuctionListing {
|
||||
status = EnumAuctionStatus.ACTIVE;
|
||||
}
|
||||
|
||||
int categoryOrdinal = compound.getInteger("Category");
|
||||
if (categoryOrdinal >= 0 && categoryOrdinal < EnumAuctionCategory.values().length) {
|
||||
category = EnumAuctionCategory.values()[categoryOrdinal];
|
||||
} else {
|
||||
category = EnumAuctionCategory.MISC;
|
||||
}
|
||||
|
||||
sellerClaimed = compound.getBoolean("SellerClaimed");
|
||||
buyerClaimed = compound.getBoolean("BuyerClaimed");
|
||||
bidCount = compound.getInteger("BidCount");
|
||||
|
||||
Reference in new issue
Block a user