API
EmakiItem exposes item creation, identification, and query capabilities. Other plugins can get EmakiItemApi through Bukkit ServicesManager.
EmakiItemApi
| Method | Return | Description |
|---|---|---|
exists(String id) | boolean | Whether an item id is loaded. |
create(String id, int amount) | ItemStack | Create a new ItemStack from an EmakiItem id. Returns null if missing. |
identify(ItemStack itemStack) | String | Identify the EmakiItem id from an ItemStack. Returns null if not an EmakiItem. |
definitionIds() | Set<String> | All loaded item ids. |
displayName(String id) | String | Plain display name for an item id. |
Getting the service
java
RegisteredServiceProvider<EmakiItemApi> provider =
Bukkit.getServicesManager().getRegistration(EmakiItemApi.class);
if (provider != null) {
EmakiItemApi api = provider.getProvider();
}Notes
- Query the service after EmakiItem has loaded.
- If the service is unavailable, degrade gracefully instead of crashing a soft dependency.
createreturns a fresh item with PDC and presentation data.identifyuses PDC identity data and does not rely on lore or display name.