Developer API
AstralCrates exposes its state through the CrateService hung off the main plugin instance (plugin.crates()) and, more commonly, through an item-supplier registration that lets any other plugin resolve a crate's key as an ordinary AstralCore item reference. There is no static CratesAPI façade and no custom Bukkit events — integration is service calls and the item-supplier registry only.
Maven coordinates
Repository: https://maven.astralrealms.fr/repository/maven-public/.
crates:<id> item supplier
On onEnable, AstralCrates registers itself with AstralCore's item-supplier registry under the name crates:
This means any AstralCore call site that accepts an item-supplier key ([give-item] actions, /give, menu item definitions, etc.) also accepts a crates:<crate-id> key, resolving to that crate's tagged key ItemStack — the same item CrateConfiguration#createItemStack would build. CrateItemSupplier implements AstralCore's ItemStackSupplier contract:
Method | Behavior |
|---|---|
|
|
| Same lookup using |
| Every loaded crate's id, as |
|
|
There is no built-in command to give a key for this reason — see Commands.
CrateService
Accessed via AstralCrates#crates().
Method | Returns | Behavior |
|---|---|---|
|
| Case-insensitive match against every loaded crate's |
|
| Block-coordinate match (world name + block X/Y/Z) against every crate's |
|
|
|
|
| Reads the PDC string under |
|
| The crate id stored on the stack's PDC, or |
|
| Builds a |
|
| Calls |
|
| No-op if the crate has no |
|
| Every currently loaded crate. |
load() and createHolograms(CrateConfiguration) also exist on CrateService but are lifecycle/internal methods — called from AstralCrates#loadConfiguration() on enable/reload — not intended as an external integration surface.
CrateService.CRATE_KEY
Every crate key ItemStack carries exactly one PDC entry, written by CrateConfiguration#createItemStack:
Key | Type | Value |
|---|---|---|
|
| The owning crate's |
Reading it directly (equivalent to getCrateKey):
CrateConfiguration#createItemStack
Builds the crate's key item from its key: ItemStackWrapper (see Crate Files), resolving any %placeholders% in that wrapper against RootPlaceholderContainer.get() — the global placeholder container, not a per-player one, so only server-wide placeholders (not player-scoped ones like %player_name%) resolve correctly here. It then tags the built stack's PDC with CRATE_KEY = this.id, sets the stack's amount to amount, and returns a clone. Both CrateItemSupplier#get overloads and any /give/[give-item] crates:<id> call ultimately go through this method, so every key ItemStack in the network — however it was obtained — is tagged identically.
CrateReward type serializer
AstralCrates registers a Configurate TypeSerializer for CrateReward on enable:
CrateRewardTypeSerializer reads a reward node as: an ItemStackWrapper at the node root (item: and its siblings), chance as a double, actions: as a PaperActionList, and requirements: as a (@Nullable) PaperRequirementList. Serialization back to config is unsupported (CrateRewardTypeSerializer#serialize throws UnsupportedOperationException) — rewards are read-only config, never written back by the plugin. CrateReward itself is a record CrateReward(ItemStackWrapper itemStack, double chance, PaperActionList actions, @Nullable PaperRequirementList requirements) and doubles as the reward placeholder namespace — see Placeholders.
Dependencies AstralCrates itself consumes
AstralCrates is a consumer, not just a provider, of two other plugins' APIs — relevant if you're tracing why a crate's holograms or placeholders behave a certain way:
AstralHologramAPI(from AstralHologram, a hard dependency) —CrateService#createHologramsregisters one text hologram per crate location viaAstralHologramAPI.registerTextHologram(id, param, location, true, BillboardType.FIXED),1.2blocks above the block, using the crate'shologram:lines as the text param.CrateService#loadunregisters every previously-tracked hologram id viaAstralHologramAPI.unregisterHologram(id)before reloading. Hologram creation/teardown is skipped entirely whencrates-enabled: false(see Configuration).AstralPaperAPIplaceholder containers —CrateConfigurationandCrateRewardimplementComplexPlaceholder(namespacescrateandreward), and are resolved through the standardAstralPaperAPI.createPlaceholderContainer(player)chain like every other plugin's placeholders; no crate-specific placeholder wiring is needed by callers.createItemStackis the one place that deliberately uses the globalRootPlaceholderContainerinstead (see above).
No custom Bukkit events
AstralCrates fires no custom Bukkit events — there is no CrateOpenEvent, CrateWinEvent, or similar. Other plugins observe crate activity by:
Calling
CrateServicedirectly (findById,findByLocation,isKeyFor,pickRandomReward/pickMultipleRewards) for live lookups, orResolving key items through the
crates:<id>item supplier, orHooking the side effects a crate's own
open-actions/win-actionsalready produce (see Opening & Rewards) — e.g. an economy or logging action placed directly in a crate's YAML runs through the normal action pipeline and is observable the same way any other action is.
VaultDisplayItemEvent (cancelled/filled by CrateListener) and BlockPlaceEvent (cancelled by KeyListener for key items) are vanilla/Paper events AstralCrates listens to, not events it defines.