#
Developer API
You can import EconomyBridge to your project using Maven. Replace {VERSION}
with the latest version below:
<repository>
<id>nightexpress-releases</id>
<name>NightExpress's Repository</name>
<url>https://repo.nightexpressdev.com/releases</url>
</repository>
<dependency>
<groupId>su.nightexpress.economybridge</groupId>
<artifactId>economy-bridge</artifactId>
<version>{VERSION}</version>
</dependency>
#
Currency API
There is EconomyBridge
class that provides all utility methods to work with currencies.
You can obtain currency IDs from the CurrencyId
class.
// Check if currency disabled in the config.
EconomyBridge.isDisabled(String id);
// Check if currency exists.
EconomyBridge.hasCurrency(String id);
// Check if 'vault' currency exists.
EconomyBridge.hasEconomy();
// Do something with a currency if it does exist.
EconomyBridge.handle(String id, Consumer<Currency> consumer);
// Check if player's balance >= amount.
EconomyBridge.hasEnough(Player player, String id, double amount);
EconomyBridge.hasEnough(UUID playerId, String id, double amount);
// Get player's balance.
EconomyBridge.getBalance(Player player, String id);
EconomyBridge.getBalance(UUID playerId, String id);
// Get player's balance of the "vault" currency.
EconomyBridge.getEconomyBalance(Player player);
EconomyBridge.getEconomyBalance(UUID playerId);
// Deposit to player's balance.
EconomyBridge.deposit(Player player, String id, double amount);
EconomyBridge.deposit(UUID playerId, String id, double amount);
// Deposit to player's balance of the "vault" currency.
EconomyBridge.depositEconomy(Player player, double amount);
EconomyBridge.depositEconomy(UUID playerId, double amount);
// Withdraw from player's balance.
EconomyBridge.withdraw(Player player, String id, double amount);
EconomyBridge.withdraw(UUID playerId, String id, double amount);
// Withdraw from player's balance of the "vault" currency.
EconomyBridge.withdrawEconomy(Player player, double amount);
EconomyBridge.withdrawEconomy(UUID playerId, double amount);
// Check if there is any currency.
boolean hasCurrency = EconomyBridge.hasCurrency();
// Get currency manager.
CurrencyManager manager = EconomyBridge.getCurrencyManager();
// Get all currencies.
Set<Currency> currencies = EconomyBridge.getCurrencies();
// Get all currency IDs.
Set<String> ids = EconomyBridge.getCurrencyIds();
// Get currency by ID.
Currency = EconomyBridge.getCurrency(String internalId);
// Get currency by ID or Dummy currency instance.
Currency = EconomyBridge.getCurrencyOrDummy(String internalId);
// Get dummy currency.
DummyCurrency dummy = EconomyBridge.getDummyCurrency();
#
Custom Item API
There is ItemBridge
class that provides all utility methods to work with custom item handlers.
You can obtain item handler IDs from the ItemPlugins
class.
// Get Item Manager.
ItemManager itemManager = ItemBridge.getItemManager();
// Get all registered Item Handlers.
Set<ItemHandler> handlers = ItemBridge.getHandlers();
// Get DummyHandler.
DummyHandler dummy = ItemBridge.getDummyHandler();
// Get ItemHandler by ID.
ItemHandler handler = ItemBridge.getHandler(String name);
// Get ItemHandler by ID or fallback to DummyHandler.
ItemHandler handler = ItemBridge.getHandlerOrDummy(String name);
// Get ItemHandler by ItemStack.
ItemHandler handler = ItemBridge.getHandler(ItemStack itemStack);
// Get ItemHandler by ItemStack or fallback to DummyHandler.
ItemHandler handler = ItemBridge.getHandlerOrDummy(ItemStack itemStack);
// Create ItemStack by internal (EconomyBridge) item ID from specific handler.
ItemStack itemStack = ItemBridge.createItem(String handlerName, String itemId);
// Get internal (EconomyBridge) item ID of an ItemStack from specific handler.
String itemId = ItemBridge.getItemId(String handlerName, ItemStack itemStack);
// Get internal (EconomyBridge) item ID of an ItemStack.
String itemId = ItemBridge.getItemId(ItemStack itemStack);
// Returns whether ItemStack can be handled by any of registered Item Handlers.
boolean isCustom = ItemBridge.isCustomItem(ItemStack itemStack);