ItemsRegistry

Deprecated

Use Items API from mimic-bukkit-api instead, it identifies items by their owner and creates them for a player.

Service for getting items by their ID. Also, can be used to match ID with item.

Mimic uses resource locations to identify items, where the namespace is the ID of an items registry: [namespace]:[itemId], e.g. minecraft:acacia_boat. IDs without namespace or with the mimic: namespace are searched over all registries.

Implementation Notes

Implementations receive and return IDs without the registry namespace: lowercase paths of a-z, 0-9, ., _, - and /. Mapping them to the plugin's own IDs is up to the implementation: itemsadder:ruby_sword ->itemsadder/ruby_sword. Invalid IDs are ignored.

Properties

Link copied to clipboard
abstract val knownIds: Collection<String>

Returns all known item IDs.

Inherited properties

Link copied to clipboard
open val id: String

Returns the ID of the service. It should match regex [a-z0-9._-].

Link copied to clipboard
open val isEnabled: Boolean

Returns true if the service is initialized may be used. Default implementation always returns true.

Functions

Link copied to clipboard
open fun getItem(itemId: String): ItemStackT?

Returns item by given itemId, or null if the ID not found in this registry.

open fun getItem(itemId: String, payload: Any?): ItemStackT?

Returns item stack with specified payload by given itemId, or null if the ID not found in this registry.

open fun getItem(itemId: String, amount: Int): ItemStackT?

Returns item stack with specified amount by given itemId, or null if ID not found in this registry.

abstract fun getItem(itemId: String, payload: Any?, amount: Int): ItemStackT?

Returns item stack with specified amount and payload by given itemId, or null if ID not found in this registry.

Link copied to clipboard
abstract fun getItemId(item: ItemStackT): String?

Returns ID representing given item, or null if the ID not found in this registry.

Link copied to clipboard
abstract fun isItemExists(itemId: String): Boolean

Returns true if item with given itemId exists.

Link copied to clipboard
open fun isSameItem(item: ItemStackT, itemId: String): Boolean

Returns true if given item represented with given itemId.