Skip to content

API

EmakiItem exposes item creation, identification, and query capabilities. Other plugins can get EmakiItemApi through Bukkit ServicesManager.

EmakiItemApi

MethodReturnDescription
exists(String id)booleanWhether an item id is loaded.
create(String id, int amount)ItemStackCreate a new ItemStack from an EmakiItem id. Returns null if missing.
identify(ItemStack itemStack)StringIdentify the EmakiItem id from an ItemStack. Returns null if not an EmakiItem.
definitionIds()Set<String>All loaded item ids.
displayName(String id)StringPlain 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.
  • create returns a fresh item with PDC and presentation data.
  • identify uses PDC identity data and does not rely on lore or display name.