Package xyz.srnyx.annoyingapi.data
Class StringData
java.lang.Object
xyz.srnyx.javautilities.parents.Stringable
- All Implemented Interfaces:
Annoyable
- Direct Known Subclasses:
EntityData
A data class for storing and retrieving string data from SQL databases
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final @NotNull StringThe primary target column namebooleanWhether to use the cache for this data -
Constructor Summary
ConstructorsConstructorDescriptionStringData(@NotNull AnnoyingPlugin plugin, @NotNull String table, @NotNull String string) Construct a newStringDatafor the given stringStringData(@NotNull AnnoyingPlugin plugin, @NotNull org.bukkit.OfflinePlayer player) Construct a newStringDatafor the givenOfflinePlayer
This uses the same table used forEntityData(EntityData.TABLE_NAME) and the player's UUID as the target -
Method Summary
Modifier and TypeMethodDescription@Nullable StringGet the data value for the given keybooleanRemove the data value with the given keyprotected booleanSet the data value for the given key.@NotNull StringDataWhether to use the cache for this data (if caching is enabled in the storage config)
Defaults toDataOptions.useCacheDefaultMethods inherited from class xyz.srnyx.annoyingapi.data.Data
get, getAnnoyingPlugin, getOptional, has, removeChain, sendError, set, setChainMethods inherited from class xyz.srnyx.javautilities.parents.Stringable
toString, toString, toString, toString, toString
-
Field Details
-
TARGET_COLUMN
The primary target column name- See Also:
-
useCache
public boolean useCacheWhether to use the cache for this data
-
-
Constructor Details
-
StringData
public StringData(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull String table, @NotNull @NotNull String string) Construct a newStringDatafor the given string- Parameters:
plugin-Data.plugintable-tablestring-Data.target
-
StringData
public StringData(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull org.bukkit.OfflinePlayer player) Construct a newStringDatafor the givenOfflinePlayer
This uses the same table used forEntityData(EntityData.TABLE_NAME) and the player's UUID as the target- Parameters:
plugin-Data.pluginplayer- the player to get/store the data for
-
-
Method Details
-
useCache
Whether to use the cache for this data (if caching is enabled in the storage config)
Defaults toDataOptions.useCacheDefault- Parameters:
useCache- the new value ornullto useDataOptions.useCacheDefault- Returns:
thisfor chaining
-
get
Description copied from class:DataGet the data value for the given key -
set
Description copied from class:DataSet the data value for the given key. If the key already exists, it will be overwritten -
remove
Description copied from class:DataRemove the data value with the given key
-