Developer API
Add mcAuction as softdepend in your plugin.yml and compile against the jar. All calls are on the main thread.
Add a currency#
McAuctionAPI api = McAuctionAPI.get();
if (api != null) {
api.registerCurrency(this, new Currency() {
public String getId() { return "gems"; }
public String getDisplayName() { return "Gems"; }
public BigDecimal getBalance(OfflinePlayer p) { return gems(p); }
public boolean withdraw(OfflinePlayer p, BigDecimal a) { return take(p, a); }
public boolean deposit(OfflinePlayer p, BigDecimal a) { return give(p, a); }
});
}withdraw must return true only when the money was taken; mcAuction hands out the item after that. Optional methods: getDecimals, has, isAvailable, format. The currency is removed when your plugin disables. To restyle it, add currencies.<id> with type: api in config.yml.
McAuctionAPI#
registerCurrency(Plugin, Currency),unregisterCurrency(String)getCurrencyIds(),getCurrency(String)getListing(long),getActiveListings(),getActiveListings(UUID)getVersion()
Events#
In dev.technotypist.mcauction.api.event: ListingCreateEvent (cancellable), ListingBuyEvent (cancellable, before the buyer is charged), ListingBidEvent (cancellable), ListingSoldEvent (after a saved sale, also for won auctions), ListingExpireEvent, ListingCancelEvent.