Skip to content

Class endstone::MapMeta

ClassList > endstone > MapMeta

Represents the metadata for a map item.

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

Inherits the following classes: endstone::ItemMeta

Public Types

Type Name
typedef std::int64_t MapId

Public Types inherited from endstone::ItemMeta

See endstone::ItemMeta

Type Name
enum Type

Public Functions

Type Name
virtual MapId getMapId () const = 0
Gets the map ID that is set. This is used to determine what map is displayed.
virtual MapView * getMapView () const = 0
Gets the map view associated with this map item.
virtual bool hasMapId () const = 0
Checks for existence of a map ID number.
virtual bool hasMapView () const = 0
Checks for existence of an associated map.
virtual void setMapId (MapId id) = 0
Sets the map ID. This is used to determine what map is displayed.
virtual void setMapView (const MapView * map) = 0
Sets the associated map. This is used to determine what map is displayed.

Public Functions inherited from endstone::ItemMeta

See endstone::ItemMeta

Type Name
virtual bool addEnchant (EnchantmentId id, int level, bool force) = 0
Adds the specified enchantment to this item meta.
T * as ()
const T * as () const
virtual std::unique_ptr< ItemMeta > clone () const = 0
Creates a clone of the current metadata.
virtual int getDamage () const = 0
Gets the damage.
virtual std::string getDisplayName () const = 0
Gets the display name that is set.
virtual int getEnchantLevel (EnchantmentId id) const = 0
Checks for the level of the specified enchantment.
virtual std::unordered_map< const Enchantment *, int > getEnchants () const = 0
Returns a copy the enchantments in this ItemMeta .
virtual std::vector< std::string > getLore () const = 0
Gets the lore that is set.
virtual int getRepairCost () const = 0
Gets the repair penalty.
virtual Type getType () const = 0
Gets the type of this item meta.
virtual bool hasConflictingEnchant (EnchantmentId id) const = 0
virtual bool hasDamage () const = 0
Checks to see if this item has damage.
virtual bool hasDisplayName () const = 0
Checks for existence of a display name.
virtual bool hasEnchant (EnchantmentId id) const = 0
Checks for existence of the specified enchantment.
virtual bool hasEnchants () const = 0
Checks for the existence of any enchantments.
virtual bool hasLore () const = 0
Checks for existence of lore.
virtual bool hasRepairCost () const = 0
Checks to see if this has a repair penalty.
virtual bool isUnbreakable () const = 0
Return if the unbreakable tag is true. An unbreakable item will not lose durability.
virtual bool removeEnchant (EnchantmentId id) = 0
Removes the specified enchantment from this item meta.
virtual void removeEnchants () = 0
Removes all enchantments from this item meta.
virtual void setDamage (int damage) = 0
Sets the damage.
virtual void setDisplayName (std::optional< std::string > name) = 0
Sets the display name.
virtual void setLore (std::optional< std::vector< std::string > > lore) = 0
Sets the lore for this item or removes lore when given std::nullopt .
virtual void setRepairCost (int cost) = 0
Sets the repair penalty.
virtual void setUnbreakable (bool unbreakable) = 0
Sets the unbreakable tag. An unbreakable item will not lose durability.
virtual ~ItemMeta () = default

Public Types Documentation

typedef MapId

using endstone::MapMeta::MapId =  std::int64_t;

Public Functions Documentation

function getMapId

Gets the map ID that is set. This is used to determine what map is displayed.

virtual MapId endstone::MapMeta::getMapId () const = 0

Returns:

the map ID that is set


function getMapView

Gets the map view associated with this map item.

virtual MapView * endstone::MapMeta::getMapView () const = 0

Note:

Plugins should check that hasMapView() returns true before calling this method.

Returns:

the map view, or nullptr if the item hasMapView(), but this map does not exist on the server


function hasMapId

Checks for existence of a map ID number.

virtual bool endstone::MapMeta::hasMapId () const = 0

Returns:

true if this has a map ID number.


function hasMapView

Checks for existence of an associated map.

virtual bool endstone::MapMeta::hasMapView () const = 0

Returns:

true if this item has an associated map


function setMapId

Sets the map ID. This is used to determine what map is displayed.

virtual void endstone::MapMeta::setMapId (
    MapId id
) = 0

Parameters:

  • id the map id to set

function setMapView

Sets the associated map. This is used to determine what map is displayed.

virtual void endstone::MapMeta::setMapView (
    const  MapView * map
) = 0

Parameters:

  • map the map to set


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