GrzybcioRynek

Plugin events

ListingCreatedEvent, ListingRemovedEvent, and TransactionCompletedEvent — non-cancellable Bukkit events.

Compatible with: GrzybcioRynek 1.0.3Minecraft 26.2Web 0.1.0

Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.

Three events in com.example.marketplace.api.event. They extend org.bukkit.event.Eventnot Cancellable. You cannot block listing / purchase with a listener.

All are fired via Bukkit.getPluginManager().callEvent on the main thread (MarketManager path).

ListingCreatedEvent

After a successful StorageManager.createListing and the success message. AlertService.checkListing is in the same try.

java
public MarketListing getListing();

Exception in a listener: Błąd po utworzeniu oferty (event/alert): <msg> — the listing stays.

ListingRemovedEvent

java
public MarketListing getListing();
public String getReason();
reasonSource
"removed"owner removed (/market remove or GUI)
"admin-removed"admin removed (/market admin remove or removeListing without owner)
"force-expire"/market admin forceexpire

Natural expiry (30 min timer) does not emit this event — it goes through the expiry outbox.

TransactionCompletedEvent

Only after committed == true (state COMPLETED, TX saved).

java
public MarketTransaction getTransaction();

Exception: Błąd TransactionCompletedEvent: <msg> — the purchase already completed.

There is no event on FAILED / ROLLED_BACK / refund.

Example

Example
java
@EventHandler
public void onSold(TransactionCompletedEvent event) {
    MarketTransaction tx = event.getTransaction();
    getLogger().info("TX " + tx.getId() + " price=" + tx.getPrice());
}

Fuller TX field description: Java API and MarketManager.