Events
EzAuction fires Bukkit events for all major auction actions, allowing external plugins to react, modify, or cancel operations.
All events are in the com.skyblockexp.ezauction.event package.
Event summary
| Event | Cancellable | Fired when |
|---|---|---|
AuctionListingCreateEvent | ✅ | A player attempts to create a new listing |
AuctionListingSellEvent | ✅ | A listing is about to be sold |
AuctionListingSoldEvent | ❌ | A listing has been successfully sold |
AuctionOrderCreateEvent | ✅ | A buy order is created |
AuctionOrderFulfillEvent | ❌ | A buy order is fulfilled |
LiveAuctionStartedEvent | ✅ | A live auction becomes active |
LiveAuctionBidPlacedEvent | ✅ | A player places a valid bid in a live auction |
LiveAuctionEndedEvent | ❌ | A live auction ends (with or without a winner) |
LiveAuctionPlayerJoinedEvent | ❌ | A player joins a live auction session |
LiveAuctionPlayerLeftEvent | ❌ | A player leaves a live auction session |
AuctionListingCreateEvent
Fired before a new auction listing is finalized. Allows modification of item, price, and player.
public AuctionListingCreateEvent(Player player, ItemStack item, double price)
public AuctionListingCreateEvent(AuctionListing listing, Player player, ItemStack item, double price)
// Getters / setters
Player getPlayer() / void setPlayer(Player player)
ItemStack getItem() / void setItem(ItemStack item)
double getPrice() / void setPrice(double price)
boolean isCancelled() / void setCancelled(boolean cancel)
AuctionListingSellEvent
Fired before a listing is sold. Cancel to prevent the purchase.
public AuctionListingSellEvent(AuctionListing listing)
boolean isCancelled() / void setCancelled(boolean cancel)
AuctionListingSoldEvent
Fired after a listing is successfully sold. Not cancellable.
public AuctionListingSoldEvent(AuctionListing listing)
AuctionOrderCreateEvent
Fired when a buy order is created. Cancellable.
AuctionOrderFulfillEvent
Fired when a buy order is fulfilled. Not cancellable.
LiveAuctionStartedEvent
Fired when a live auction becomes active. Cancellable — cancel to prevent the auction from starting.
public LiveAuctionStartedEvent(LiveAuctionState state)
LiveAuctionState getState()
boolean isCancelled() / void setCancelled(boolean cancel)
LiveAuctionBidPlacedEvent
Fired after bid validation passes but before the bid is committed. Cancellable — cancel to reject the bid silently.
public LiveAuctionBidPlacedEvent(LiveAuctionState state, Player bidder, double amount)
LiveAuctionState getState()
Player getBidder()
double getAmount()
boolean isCancelled() / void setCancelled(boolean cancel)
LiveAuctionEndedEvent
Fired when a live auction ends. Always fires regardless of whether there was a winner. Not cancellable.
public LiveAuctionEndedEvent(LiveAuctionState state, boolean hadWinner)
LiveAuctionState getState()
boolean hadWinner()
LiveAuctionPlayerJoinedEvent
Fired when a player joins a live auction session via /bid select. Not cancellable.
public LiveAuctionPlayerJoinedEvent(LiveAuctionState state, Player player)
LiveAuctionState getState()
Player getPlayer()
LiveAuctionPlayerLeftEvent
Fired when a player leaves a live auction session via /bid leave or when the auction ends. Not cancellable.
public LiveAuctionPlayerLeftEvent(LiveAuctionState state, Player player)
LiveAuctionState getState()
Player getPlayer()
Listener registration
@EventHandler
public void onAuctionCreate(AuctionListingCreateEvent event) {
// Block listings under 1 coin
if (event.getPrice() < 1.0) {
event.setCancelled(true);
event.getPlayer().sendMessage("Minimum price is 1 coin.");
}
}
Register the listener in your plugin’s onEnable():
getServer().getPluginManager().registerEvents(new MyAuctionListener(), this);
Code samples
Block specific items from being listed
@EventHandler
public void onAuctionCreate(AuctionListingCreateEvent event) {
if (event.getItem().getType() == Material.DIRT) {
event.setCancelled(true);
event.getPlayer().sendMessage("Dirt cannot be auctioned.");
}
}
Enforce a minimum price
@EventHandler
public void onAuctionCreate(AuctionListingCreateEvent event) {
if (event.getPrice() < 10.0) {
event.setPrice(10.0);
}
}
Related
- Developer API — programmatic access
- CONTRIBUTING.md — adding new events