Developer API
Other plugins can listen to order, auction and Sell GUI events and use the SigmaOrdersAPI service. The event API exists since 2.0.14.
| Part | Package / class | Page |
|---|---|---|
| Events (read-only, fired after the action) | com.sigma.orders.api.events | Events |
| API service (read data, make changes) | com.sigma.orders.api.SigmaOrdersAPI | API Service |
| Server owner switches | plugins/SigmaOrders-Auction/api.yml | api.yml |
Add the dependency
The plugin is not published to a Maven repository. Add the jar (sigma-orders-auction-2.0.14.jar) as a compile-only dependency.
// Gradle (Kotlin DSL)
dependencies {
compileOnly(files("libs/sigma-orders-auction-2.0.14.jar"))
}
For Maven, install the jar locally and use scope provided. Then declare the dependency in your plugin.yml:
depend: [SigmaOrders-Auction] # or softdepend
Get the API instance
The service is registered with Bukkit's ServicesManager when the plugin enables.
SigmaOrdersAPI api = Bukkit.getServicesManager().load(SigmaOrdersAPI.class);
if (api == null) {
// SigmaOrders-Auction is missing or failed to start
}
Listen to events
Register a normal Bukkit listener; nothing else is needed.
public final class SaleLogger implements Listener {
@EventHandler
public void onSold(AuctionListingSoldEvent event) {
ListingInfo listing = event.getListing();
Bukkit.getLogger().info(event.getBuyerName() + " bought " + listing.item().getType()
+ " for " + listing.price() + " (" + event.getSource() + ")");
}
}
Rules
- Events cannot be cancelled. They fire after the action was saved.
- Many order events fire on a database thread (
event.isAsynchronous()is true). Do not touch worlds, blocks, entities or inventories there; schedule that work (on Folia use the region or entity scheduler). - Items in events are copies; changing them has no effect.
- Players may be offline, so events give UUIDs and names.
- Events are only built when at least one plugin listens to them. An exception in your listener is logged and does not break the action.
- The server owner can turn events off or block changes in api.yml.