mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 00:19:05 +00:00
Auction Fixes
This commit is contained in:
1 parent
5992e1badc
commit
3e57b837aa
13 files changed
+555
-210
No files matched your search
@@ -12,18 +12,25 @@ public class AuctionClaim {
|
||||
public String playerName;
|
||||
public String listingId;
|
||||
public EnumClaimType type;
|
||||
public ItemStack item;
|
||||
public ItemStack item; // The item (for ITEM claims only)
|
||||
public String itemName; // Display name of item (for CURRENCY/REFUND tooltip)
|
||||
public String otherPlayerName; // Buyer name (CURRENCY) or who outbid (REFUND)
|
||||
public long currency;
|
||||
public long createdTime;
|
||||
public boolean claimed;
|
||||
public boolean isReturned; // For ITEM claims: true if returned to seller, false if won by buyer
|
||||
|
||||
public AuctionClaim() {
|
||||
this.id = UUID.randomUUID().toString();
|
||||
this.createdTime = System.currentTimeMillis();
|
||||
this.claimed = false;
|
||||
this.isReturned = false;
|
||||
this.itemName = "";
|
||||
this.otherPlayerName = "";
|
||||
}
|
||||
|
||||
public static AuctionClaim createItemClaim(UUID playerUUID, String playerName, String listingId, ItemStack item) {
|
||||
/** Create claim for winning an item (buyer won auction or buyout) */
|
||||
public static AuctionClaim createItemWonClaim(UUID playerUUID, String playerName, String listingId, ItemStack item) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
claim.playerName = playerName;
|
||||
@@ -31,28 +38,50 @@ public class AuctionClaim {
|
||||
claim.type = EnumClaimType.ITEM;
|
||||
claim.item = item != null ? item.copy() : null;
|
||||
claim.currency = 0;
|
||||
claim.isReturned = false;
|
||||
return claim;
|
||||
}
|
||||
|
||||
public static AuctionClaim createCurrencyClaim(UUID playerUUID, String playerName, String listingId, long currency) {
|
||||
/** Create claim for returned item (seller's expired/cancelled listing) */
|
||||
public static AuctionClaim createItemReturnedClaim(UUID playerUUID, String playerName, String listingId, ItemStack item) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
claim.playerName = playerName;
|
||||
claim.listingId = listingId;
|
||||
claim.type = EnumClaimType.ITEM;
|
||||
claim.item = item != null ? item.copy() : null;
|
||||
claim.currency = 0;
|
||||
claim.isReturned = true;
|
||||
return claim;
|
||||
}
|
||||
|
||||
/** Create claim for seller's proceeds (stores item name for tooltip, not full item) */
|
||||
public static AuctionClaim createCurrencyClaim(UUID playerUUID, String playerName, String listingId, long currency, String itemName, String buyerName) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
claim.playerName = playerName;
|
||||
claim.listingId = listingId;
|
||||
claim.type = EnumClaimType.CURRENCY;
|
||||
claim.item = null;
|
||||
claim.item = null; // No item stored for currency claims
|
||||
claim.itemName = itemName != null ? itemName : "";
|
||||
claim.otherPlayerName = buyerName != null ? buyerName : "";
|
||||
claim.currency = currency;
|
||||
claim.isReturned = false;
|
||||
return claim;
|
||||
}
|
||||
|
||||
public static AuctionClaim createRefundClaim(UUID playerUUID, String playerName, String listingId, long currency) {
|
||||
/** Create claim for outbid refund (stores item name for tooltip, not full item) */
|
||||
public static AuctionClaim createRefundClaim(UUID playerUUID, String playerName, String listingId, long currency, String itemName, String outbidderName) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
claim.playerName = playerName;
|
||||
claim.listingId = listingId;
|
||||
claim.type = EnumClaimType.REFUND;
|
||||
claim.item = null;
|
||||
claim.item = null; // No item stored for refund claims
|
||||
claim.itemName = itemName != null ? itemName : "";
|
||||
claim.otherPlayerName = outbidderName != null ? outbidderName : "";
|
||||
claim.currency = currency;
|
||||
claim.isReturned = false;
|
||||
return claim;
|
||||
}
|
||||
|
||||
@@ -84,9 +113,12 @@ public class AuctionClaim {
|
||||
compound.setTag("Item", itemTag);
|
||||
}
|
||||
|
||||
compound.setString("ItemName", itemName != null ? itemName : "");
|
||||
compound.setString("OtherPlayerName", otherPlayerName != null ? otherPlayerName : "");
|
||||
compound.setLong("Currency", currency);
|
||||
compound.setLong("CreatedTime", createdTime);
|
||||
compound.setBoolean("Claimed", claimed);
|
||||
compound.setBoolean("IsReturned", isReturned);
|
||||
|
||||
return compound;
|
||||
}
|
||||
@@ -107,9 +139,12 @@ public class AuctionClaim {
|
||||
item = null;
|
||||
}
|
||||
|
||||
itemName = compound.getString("ItemName");
|
||||
otherPlayerName = compound.getString("OtherPlayerName");
|
||||
currency = compound.getLong("Currency");
|
||||
createdTime = compound.getLong("CreatedTime");
|
||||
claimed = compound.getBoolean("Claimed");
|
||||
isReturned = compound.getBoolean("IsReturned");
|
||||
}
|
||||
|
||||
public static AuctionClaim fromNBT(NBTTagCompound compound) {
|
||||
|
||||
Reference in new issue
Block a user