Skip to content

Class endstone::ItemMeta

ClassList > endstone > ItemMeta

Represents the metadata of a generic item.

  • #include <endstone/inventory/meta/item_meta.h>

Inherited by the following classes: endstone::MapMeta

Public Types

Type Name
enum Type

Public Static Attributes

Type Name
ItemMeta EMPTY

Public Functions

Type Name
ItemMeta () = default
ItemMeta (const ItemMeta * meta)
virtual std::unique_ptr< ItemMeta > clone () const
Creates a clone of the current metadata.
virtual int getDamage () const
Gets the damage.
virtual std::optional< std::string > getDisplayName () const
Gets the display name that is set.
virtual std::optional< std::vector< std::string > > getLore () const
Gets the lore that is set.
virtual Type getType () const
Gets the type of this item meta.
virtual bool hasDamage () const
Checks to see if this item has damage.
virtual bool hasDisplayName () const
Checks for existence of a display name.
virtual bool hasLore () const
Checks for existence of lore.
virtual bool isEmpty () const
Checks if the item metadata is empty.
virtual void setDamage (int damage)
Sets the damage.
virtual void setDisplayName (std::optional< std::string > name)
Sets the display name.
virtual void setLore (std::optional< std::vector< std::string > > lore)
Sets the lore for this item or removes lore when given std::nullopt.
virtual ~ItemMeta () = default

Public Types Documentation

enum Type

enum endstone::ItemMeta::Type {
    Item = 0,
    Map = 1,
    Count = 2,
    None = Item
};

Public Static Attributes Documentation

variable EMPTY

ItemMeta endstone::ItemMeta::EMPTY;

Public Functions Documentation

function ItemMeta [½]

endstone::ItemMeta::ItemMeta () = default

function ItemMeta [2/2]

inline explicit endstone::ItemMeta::ItemMeta (
    const  ItemMeta * meta
) 

function clone

Creates a clone of the current metadata.

inline virtual std::unique_ptr< ItemMeta > endstone::ItemMeta::clone () const

Returns:

A copy of the metadata containing the same state as the original.


function getDamage

Gets the damage.

inline virtual int endstone::ItemMeta::getDamage () const

Returns:

the damage


function getDisplayName

Gets the display name that is set.

inline virtual std::optional< std::string > endstone::ItemMeta::getDisplayName () const

Returns:

the display name that is set


function getLore

Gets the lore that is set.

inline virtual std::optional< std::vector< std::string > > endstone::ItemMeta::getLore () const

Returns:

a list of lore that is set


function getType

Gets the type of this item meta.

inline virtual Type endstone::ItemMeta::getType () const

Returns:

type of this item meta


function hasDamage

Checks to see if this item has damage.

inline virtual bool endstone::ItemMeta::hasDamage () const

Returns:

true if this has damage


function hasDisplayName

Checks for existence of a display name.

inline virtual bool endstone::ItemMeta::hasDisplayName () const

Returns:

true if this has a display name


function hasLore

Checks for existence of lore.

inline virtual bool endstone::ItemMeta::hasLore () const

Returns:

true if this has lore


function isEmpty

Checks if the item metadata is empty.

inline virtual bool endstone::ItemMeta::isEmpty () const

Returns:

true if the metadata is empty, false otherwise.


function setDamage

Sets the damage.

inline virtual void endstone::ItemMeta::setDamage (
    int damage
) 

Parameters:

  • damage item damage

function setDisplayName

Sets the display name.

inline virtual void endstone::ItemMeta::setDisplayName (
    std::optional< std::string > name
) 

Parameters:

  • name the name to set

function setLore

Sets the lore for this item or removes lore when given std::nullopt.

inline virtual void endstone::ItemMeta::setLore (
    std::optional< std::vector< std::string > > lore
) 

Parameters:

  • lore the lore that will be set

function ~ItemMeta

virtual endstone::ItemMeta::~ItemMeta () = default


The documentation for this class was generated from the following file include/endstone/inventory/meta/item_meta.h