Package xyz.srnyx.annoyingapi.data
Class StringData
- java.lang.Object
-
- xyz.srnyx.javautilities.parents.Stringable
-
- xyz.srnyx.annoyingapi.data.Data<java.lang.String>
-
- xyz.srnyx.annoyingapi.data.StringData
-
- All Implemented Interfaces:
Annoyable
- Direct Known Subclasses:
EntityData
public class StringData extends Data<java.lang.String>
A data class for storing and retrieving string data from SQL databases
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull java.lang.StringTARGET_COLUMNThe primary target column namebooleanuseCacheWhether to use the cache for this data
-
Constructor Summary
Constructors Constructor Description StringData(@NotNull AnnoyingPlugin plugin, @NotNull java.lang.String table, @NotNull java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable java.lang.Stringget(@NotNull java.lang.String key)Get the data value for the given keybooleanremove(@NotNull java.lang.String key)Remove the data value with the given keyprotected booleanset(@NotNull java.lang.String key, @NotNull java.lang.String value)Set the data value for the given key.@NotNull StringDatauseCache(@Nullable java.lang.Boolean useCache)Whether to use the cache for this data (if caching is enabled in the storage config)
Defaults toDataOptions.useCacheDefault-
Methods inherited from class xyz.srnyx.annoyingapi.data.Data
get, getAnnoyingPlugin, getOptional, has, removeChain, sendError, set, setChain
-
-
-
-
Field Detail
-
TARGET_COLUMN
@NotNull public static final @NotNull java.lang.String TARGET_COLUMN
The primary target column name- See Also:
- Constant Field Values
-
useCache
public boolean useCache
Whether to use the cache for this data
-
-
Constructor Detail
-
StringData
public StringData(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.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 Detail
-
useCache
@NotNull public @NotNull StringData useCache(@Nullable @Nullable java.lang.Boolean 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
@Nullable public @Nullable java.lang.String get(@NotNull @NotNull java.lang.String key)Description copied from class:DataGet the data value for the given key
-
set
protected boolean set(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)Description copied from class:DataSet the data value for the given key. If the key already exists, it will be overwritten
-
remove
public boolean remove(@NotNull @NotNull java.lang.String key)Description copied from class:DataRemove the data value with the given key
-
-