public class StringData extends Data<java.lang.String>
| Modifier and Type | Field and Description |
|---|---|
static @NotNull java.lang.String |
TARGET_COLUMN
The primary target column name
|
boolean |
useCache
Whether to use the cache for this data
If false, all cache methods will return null |
| Constructor and Description |
|---|
StringData(@NotNull AnnoyingPlugin plugin,
@NotNull org.bukkit.OfflinePlayer player)
Construct a new
StringData for the given OfflinePlayer with DataOptions.useCacheDefault as useCache
This uses the same table used for EntityData (EntityData.TABLE_NAME) and the player's UUID as the target |
StringData(@NotNull AnnoyingPlugin plugin,
@NotNull org.bukkit.OfflinePlayer player,
@Nullable java.lang.Boolean useCache)
Construct a new
StringData for the given OfflinePlayer
This uses the same table used for EntityData (EntityData.TABLE_NAME) and the player's UUID as the target |
StringData(@NotNull AnnoyingPlugin plugin,
@NotNull java.lang.String table,
@NotNull java.lang.String string)
|
StringData(@NotNull AnnoyingPlugin plugin,
@NotNull java.lang.String table,
@NotNull java.lang.String string,
@Nullable java.lang.Boolean useCache)
Construct a new
StringData for the given string |
| Modifier and Type | Method and Description |
|---|---|
@Nullable java.lang.String |
get(@NotNull java.lang.String key)
Get the data value for the given key
|
@Nullable java.util.Map<java.lang.String,java.lang.String> |
getCache()
Get the target's cached data
|
@Nullable java.lang.String |
getFromCache(@NotNull java.lang.String key)
Get the target's cached data for the given key
|
boolean |
remove(@NotNull java.lang.String key)
Remove the data value with the given key
|
@NotNull StringData |
removeFromCache(@NotNull java.lang.String key)
Remove the target's cached data for the given key
|
boolean |
saveCache()
Save the target's cached data to the database
|
protected boolean |
set(@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set the data value for the given key.
|
@NotNull StringData |
setToCache(@NotNull java.lang.String key,
@Nullable java.lang.String value)
Set the target's cached data for the given key
|
get, getAnnoyingPlugin, has, removeChain, sendError, set, setChain@NotNull public static final @NotNull java.lang.String TARGET_COLUMN
public final boolean useCache
false, all cache methods will return nullgetCache(),
getFromCache(String),
saveCache()public StringData(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String string,
@Nullable
@Nullable java.lang.Boolean useCache)
StringData for the given stringplugin - Data.plugintable - tablestring - Data.targetuseCache - useCache, or null to use DataOptions.useCacheDefaultpublic StringData(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull java.lang.String table,
@NotNull
@NotNull java.lang.String string)
plugin - Data.plugintable - tablestring - Data.targetpublic StringData(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull org.bukkit.OfflinePlayer player,
@Nullable
@Nullable java.lang.Boolean useCache)
StringData for the given OfflinePlayer
EntityData (EntityData.TABLE_NAME) and the player's UUID as the targetplugin - Data.pluginplayer - the player to get/store the data foruseCache - useCache, or null to use DataOptions.useCacheDefaultpublic StringData(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull org.bukkit.OfflinePlayer player)
StringData for the given OfflinePlayer with DataOptions.useCacheDefault as useCache
EntityData (EntityData.TABLE_NAME) and the player's UUID as the targetplugin - Data.pluginplayer - the player to get/store the data for@Nullable
public @Nullable java.lang.String get(@NotNull
@NotNull java.lang.String key)
Dataprotected boolean set(@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull java.lang.String value)
Datapublic boolean remove(@NotNull
@NotNull java.lang.String key)
Data@Nullable
public @Nullable java.lang.String getFromCache(@NotNull
@NotNull java.lang.String key)
key - the key to get from the cachenull if the cache is disabled or the target has no cached data for the key@NotNull public @NotNull StringData setToCache(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.String value)
key - the key to set in the cachevalue - the value to set in the cacheStringData instance@NotNull public @NotNull StringData removeFromCache(@NotNull @NotNull java.lang.String key)
key - the key to remove from the cacheStringData instance@Nullable public @Nullable java.util.Map<java.lang.String,java.lang.String> getCache()
null if the cache is disabled or the target has no cached datapublic boolean saveCache()
true if the data was saved successfully, false otherwise