API events
Three non-cancellable Bukkit events — listing created, listing removed, and completed transaction.
Compatible with: GrzybcioRynek 1.0.3Minecraft 26.2Web 0.1.0
Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.
Package: com.example.marketplace.api.event. Standard Bukkit Event + HandlerList. None are Cancellable.
ListingCreatedEvent
Fired: after a successful list in MarketManager.sellItem.
java
public MarketListing getListing();ListingRemovedEvent
Fired: removeListing and forceExpire.
java
public MarketListing getListing();
public String getReason();Reasons in code:
reason | When |
|---|---|
"removed" | owner removed |
"admin-removed" | admin removed |
"force-expire" | /market admin forceexpire |
The expiry timer (30 min) does not fire this event.
TransactionCompletedEvent
Fired: only after buy commit (COMPLETED).
java
public MarketTransaction getTransaction();No events for FAILED, ROLLED_BACK, or refund (error = REFUND:<timestamp>).
Registration
Example
java
public final class MarketListener implements Listener {
@EventHandler
public void onCreate(ListingCreatedEvent event) {
int id = event.getListing().getId();
}
@EventHandler
public void onRemove(ListingRemovedEvent event) {
String reason = event.getReason();
}
@EventHandler
public void onDone(TransactionCompletedEvent event) {
String txId = event.getTransaction().getId();
}
}An exception in a listener does not undo the listing or purchase — the plugin logs a warning and continues.