Package noppes.npcs.api.handler
Interface IAuctionHandler
-
public interface IAuctionHandlerHandler for the Auction system. Access via API.getAuctions()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stringbuyout(String listingId, IPlayer<?> player)Buyout a listing instantly.StringcancelListing(String listingId, IPlayer<?> player, boolean isAdmin)Cancel a listing (seller only, unless admin).IAuctionListingcreateListing(IPlayer<?> player, IItemStack item, long startingPrice, long buyoutPrice)Create a new listing.intgetActiveListingCount()Get total count of active listings.IAuctionListing[]getActiveListings()Get all active listings.intgetAuctionDurationHours()Get the auction duration in hours.StringgetCurrencyName()Get the currency name used by the auction system.IAuctionListinggetListing(String listingId)Get a specific listing by ID.longgetListingFee()Get the listing fee amount.IAuctionListing[]getListingsByBidder(String bidderUUID)Get all listings where a player is the current high bidder.IAuctionListing[]getListingsBySeller(String sellerUUID)Get all active listings by a specific seller.doublegetMinBidIncrementPercent()Get the minimum bid increment percentage (0.0 to 1.0).longgetMinimumListingPrice()Get the minimum listing price.doublegetSalesTaxPercent()Get the sales tax percentage (0.0 to 1.0).intgetSnipeProtectionMinutes()Get the snipe protection time in minutes.booleanisEnabled()Check if the auction system is enabled.StringplaceBid(String listingId, IPlayer<?> player, long amount)Place a bid on a listing.voidsave()Force save auction data.IAuctionListing[]searchListings(String searchText)Search listings by item name or seller name.
-
-
-
Method Detail
-
isEnabled
boolean isEnabled()
Check if the auction system is enabled.- Returns:
- true if the auction system is enabled
-
getActiveListings
IAuctionListing[] getActiveListings()
Get all active listings.- Returns:
- array of all currently active auction listings
-
getListing
IAuctionListing getListing(String listingId)
Get a specific listing by ID.- Parameters:
listingId- The listing ID- Returns:
- The listing, or null if not found
-
getListingsBySeller
IAuctionListing[] getListingsBySeller(String sellerUUID)
Get all active listings by a specific seller.- Parameters:
sellerUUID- The seller's UUID as a string- Returns:
- array of listings created by this seller
-
getListingsByBidder
IAuctionListing[] getListingsByBidder(String bidderUUID)
Get all listings where a player is the current high bidder.- Parameters:
bidderUUID- The bidder's UUID as a string- Returns:
- array of listings this player has bid on
-
getActiveListingCount
int getActiveListingCount()
Get total count of active listings.- Returns:
- the number of currently active listings
-
createListing
IAuctionListing createListing(IPlayer<?> player, IItemStack item, long startingPrice, long buyoutPrice)
Create a new listing.- Parameters:
player- The selleritem- The item to sellstartingPrice- The starting bid pricebuyoutPrice- The buyout price (0 for no buyout)- Returns:
- The created listing, or null if failed
-
placeBid
String placeBid(String listingId, IPlayer<?> player, long amount)
Place a bid on a listing.- Parameters:
listingId- The listing IDplayer- The bidderamount- The bid amount- Returns:
- null on success, error message on failure
-
buyout
String buyout(String listingId, IPlayer<?> player)
Buyout a listing instantly.- Parameters:
listingId- The listing IDplayer- The buyer- Returns:
- null on success, error message on failure
-
cancelListing
String cancelListing(String listingId, IPlayer<?> player, boolean isAdmin)
Cancel a listing (seller only, unless admin).- Parameters:
listingId- The listing IDplayer- The player cancellingisAdmin- Whether to bypass ownership check- Returns:
- null on success, error message on failure
-
getListingFee
long getListingFee()
Get the listing fee amount.- Returns:
- the currency fee charged when creating a listing
-
getSalesTaxPercent
double getSalesTaxPercent()
Get the sales tax percentage (0.0 to 1.0).- Returns:
- the sales tax percentage applied to completed sales
-
getMinBidIncrementPercent
double getMinBidIncrementPercent()
Get the minimum bid increment percentage (0.0 to 1.0).- Returns:
- the minimum bid increment as a percentage of current bid
-
getAuctionDurationHours
int getAuctionDurationHours()
Get the auction duration in hours.- Returns:
- the default auction duration in hours
-
getSnipeProtectionMinutes
int getSnipeProtectionMinutes()
Get the snipe protection time in minutes.- Returns:
- the snipe protection window in minutes
-
getCurrencyName
String getCurrencyName()
Get the currency name used by the auction system.- Returns:
- the display name of the auction currency
-
getMinimumListingPrice
long getMinimumListingPrice()
Get the minimum listing price.- Returns:
- the minimum starting price for new listings
-
searchListings
IAuctionListing[] searchListings(String searchText)
Search listings by item name or seller name.- Parameters:
searchText- The search text- Returns:
- Matching active listings
-
save
void save()
Force save auction data.
-
-