Documentation for EzShops' pricing interfaces and helpers. Use this page to learn how to obtain price information for items and how to integrate safe price lookups into your plugin.
com.skyblockexp.ezshops.shop.api.ShopPriceService— recommended public interface for price lookups (see source).ShopPricingManager— internal pricing manager used by the plugin for price resolution and dynamic pricing rules (consult source when extending behavior).
Preferred (recommended):
ShopPriceService svc = EzShopsAPI.getInstance().getShopAPI();
// svc may be null if shop pricing is disabledFallback (legacy) via Bukkit ServicesManager:
RegisteredServiceProvider<ShopPriceService> p = Bukkit.getServicesManager().getRegistration(ShopPriceService.class);
ShopPriceService svc = p != null ? p.getProvider() : null;OptionalDouble findBuyPrice(ItemStack itemStack)— total price to buy the provided stack from a shopOptionalDouble findSellPrice(ItemStack itemStack)— total price the shop will pay for the provided stack
- Always handle
OptionalDouble.empty()when a price is not available for the requested item. - For single lookups on the main thread the calls are fast; for bulk operations (many different materials or large counts) prefer running lookups on an async task to avoid main-thread stalls.
- Respect currency/formatting conventions in your plugin when presenting prices to players.
Simple sell price lookup:
ShopPriceService svc = EzShopsAPI.getInstance().getShopAPI();
if (svc != null) {
OptionalDouble sell = svc.findSellPrice(new ItemStack(Material.DIAMOND, 10));
sell.ifPresent(p -> player.sendMessage("Sell price: " + p));
}Bulk (async) example sketch:
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
ShopPriceService svc = EzShopsAPI.getInstance().getShopAPI();
if (svc == null) return;
for (ItemStack s : stacks) {
OptionalDouble buy = svc.findBuyPrice(s);
// aggregate results and schedule sync update if needed
}
});src/main/java/com/skyblockexp/ezshops/shop/api/ShopPriceService.java
- Pricing configuration and dynamic rules: check the plugin's
ShopPricingManagerand configuration files undersrc/main/resourcesfor rules and defaults.