Package com.plotsquared.core.player
Class MetaDataAccess<T>
java.lang.Object
com.plotsquared.core.player.MetaDataAccess<T>
- Type Parameters:
T- Meta data type
- All Implemented Interfaces:
AutoCloseable
Access to player meta data
-
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinal voidclose()get()Get the stored meta data valueGet the meta data keyGet the owner of the meta databooleanisClosed()Check whether or not the meta data access has been closed.abstract booleanCheck if the player has meta data stored with the given keyremove()Remove the stored value meta dataabstract voidSet the meta data value
-
Method Details
-
isPresent
public abstract boolean isPresent()Check if the player has meta data stored with the given key- Returns:
trueif player has meta data with this key, orfalse
-
remove
Remove the stored value meta data- Returns:
- Old value, or
null
-
set
Set the meta data value- Parameters:
value- New value
-
get
Get the stored meta data value- Returns:
- Stored value, or
Optional.empty()
-
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
getPlayer
Get the owner of the meta data- Returns:
- Player
-
getMetaDataKey
Get the meta data key- Returns:
- Meta data key
-
isClosed
public boolean isClosed()Check whether or not the meta data access has been closed. After being closed, all attempts to access the meta data through the instance, will lead toIllegalAccessExceptionbeing thrown- Returns:
trueif the access has been closed
-
checkClosed
protected void checkClosed()
-