Class PluginKeyPair<Z>
java.lang.Object
io.github.projectunified.minelib.util.key.PluginKeyPair<Z>
- Type Parameters:
Z
- the retrieved object type when applying this data type
A pair of
NamespacedKey
and PersistentDataType
-
Constructor Summary
ConstructorDescriptionPluginKeyPair
(org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<?, Z> dataType, Z defaultValue) Create a new instance ofPluginKeyPair
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(org.bukkit.persistence.PersistentDataContainer container) Check if the container contains the keyboolean
contains
(org.bukkit.persistence.PersistentDataHolder holder) Check if the holder contains the keyvoid
copy
(org.bukkit.persistence.PersistentDataContainer fromContainer, org.bukkit.persistence.PersistentDataContainer toContainer) Copy the value from the source container to the target containervoid
copy
(org.bukkit.persistence.PersistentDataHolder fromHolder, org.bukkit.persistence.PersistentDataHolder toHolder) Copy the value from the source holder to the target holderget
(org.bukkit.persistence.PersistentDataContainer container) Get the value from the containerget
(org.bukkit.persistence.PersistentDataHolder holder) Get the value from the holderorg.bukkit.persistence.PersistentDataType<?,
Z> Get the data typeGet the default valueorg.bukkit.NamespacedKey
getKey()
Get the keyvoid
remove
(org.bukkit.persistence.PersistentDataContainer container) Remove the value from the containervoid
remove
(org.bukkit.persistence.PersistentDataHolder holder) Remove the value from the holdervoid
Set the value to the containervoid
Set the value to the holder
-
Constructor Details
-
PluginKeyPair
public PluginKeyPair(org.bukkit.NamespacedKey key, org.bukkit.persistence.PersistentDataType<?, Z> dataType, Z defaultValue) Create a new instance ofPluginKeyPair
- Parameters:
key
- the keydataType
- the data typedefaultValue
- the default value
-
-
Method Details
-
getKey
public org.bukkit.NamespacedKey getKey()Get the key- Returns:
- the key
-
getDataType
Get the data type- Returns:
- the data type
-
getDefaultValue
Get the default value- Returns:
- the default value
-
get
Get the value from the container- Parameters:
container
- the container- Returns:
- the value
-
set
Set the value to the container- Parameters:
container
- the containervalue
- the value
-
get
Get the value from the holder- Parameters:
holder
- the holder- Returns:
- the value
-
set
Set the value to the holder- Parameters:
holder
- the holdervalue
- the value
-
contains
public boolean contains(org.bukkit.persistence.PersistentDataContainer container) Check if the container contains the key- Parameters:
container
- the container
-
contains
public boolean contains(org.bukkit.persistence.PersistentDataHolder holder) Check if the holder contains the key- Parameters:
holder
- the holder
-
copy
public void copy(org.bukkit.persistence.PersistentDataContainer fromContainer, org.bukkit.persistence.PersistentDataContainer toContainer) Copy the value from the source container to the target container- Parameters:
fromContainer
- the source containertoContainer
- the target container
-
copy
public void copy(org.bukkit.persistence.PersistentDataHolder fromHolder, org.bukkit.persistence.PersistentDataHolder toHolder) Copy the value from the source holder to the target holder- Parameters:
fromHolder
- the source holdertoHolder
- the target holder
-
remove
public void remove(org.bukkit.persistence.PersistentDataContainer container) Remove the value from the container- Parameters:
container
- the container
-
remove
public void remove(org.bukkit.persistence.PersistentDataHolder holder) Remove the value from the holder- Parameters:
holder
- the holder
-