OrthodoxIcons exposes a small, stable API for other plugins via the
com.orthodoxicons.OrthodoxIconsApi interface, obtained from the main plugin
instance.
OrthodoxIconsPlugin plugin = (OrthodoxIconsPlugin) Bukkit.getPluginManager()
.getPlugin("OrthodoxIcons");
if (plugin == null || !plugin.isEnabled()) {
// OrthodoxIcons is not installed / not enabled.
return;
}
OrthodoxIconsApi api = plugin.api();Add OrthodoxIcons as a softdepend (or depend) in your own plugin.yml so it
loads first:
softdepend: [OrthodoxIcons]Returns an immutable snapshot of all stored icons. Safe on the main thread (served from the in-memory cache).
Looks up a single icon by its stable id.
Case-insensitive substring search across name, saint, feast, category, and tags.
Builds a fully-decorated, PDC-tagged icon item (a filled map by default). Must
be called on the main thread because it may create a MapView.
Gives the icon item to a player, dropping any overflow at their feet.
Reads the icon id stored in an item's PersistentDataContainer; empty if the
item is not an OrthodoxIcons item.
Registers a new icon source at runtime. See the developer guide for the
IconProvider contract. Idempotent per provider id (re-registering replaces).
Starts an asynchronous fetch/update pass across enabled providers and completes
with a FetchResult (added, updated, skipped, failed). If a pass is
already running, completes immediately with an empty result.
Immutable value object. Key accessors: id(), name(), saint(), feast(),
category(), description(), imageUrl(), sourceUrl(), attribution(),
license(), tags(), providerId(), imageHash(), dateAdded().
Provider-supplied description of an icon before it is downloaded. Built with
IconMetadata.builder().
Enum of recognized licenses with isFree() and fromLabel(String) for lenient
parsing of provider license strings.
Immutable counters: added(), updated(), skipped(), failed().
- Read methods (
allIcons,icon,search,readIconId) are safe from any thread. createItemandgiveIconmust run on the main server thread.triggerUpdatemay be called from any thread and performs its work asynchronously; observe completion withwhenCompleteand hop back to the main thread (e.g. via the scheduler) before touching the Bukkit API.
The OrthodoxIconsApi interface and the domain accessors listed above are the
supported surface. Internal service classes may change between releases; depend
only on the API interface and the model package.