TebexStore now includes a simple Gems API for developers. Other plugins can hook into TebexStore to check player gem balances, withdraw gems for purchases, add gems as rewards, and refund gems when needed.
This lets server owners build custom in-game shops, crate systems, battle passes, black markets, or other plugins that use the same TebexStore gem currency.
How developers use it:
1. Add TebexStore as a soft dependency in plugin.yml:
softdepend: [TebexStore]
2. Hook the API using Bukkit ServicesManager:
RegisteredServiceProvider<GemCurrencyApi> provider =
Bukkit.getServicesManager().getRegistration(GemCurrencyApi.class);
if (provider != null) {
GemCurrencyApi gems = provider.getProvider();
}
3. Use the available API methods:
getBalance(player)
hasBalance(player, amount)
withdraw(player, amount)
addBalance(player, amount)
refund(player, amount)
setBalance(player, amount)
Example use:
If another plugin wants to sell an item for 100 gems, it can check the player's balance, withdraw 100 gems, then give the item.
