Package xyz.srnyx.annoyingapi.options
Class DataOptions
- java.lang.Object
-
- xyz.srnyx.javautilities.parents.Stringable
-
- xyz.srnyx.annoyingapi.options.DataOptions
-
public class DataOptions extends xyz.srnyx.javautilities.parents.StringableThese options all relate to SQL data management utilities such asStringDataandEntityData
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataOptions.EntitiesOptions forentity data management
-
Field Summary
Fields Modifier and Type Field Description booleanenabled@NotNull DataOptions.EntitiesentitiesOptions forentity data management@NotNull java.util.Map<java.lang.String,java.util.Set<java.lang.String>>tablesA set of all tables/columns to be created forDataManager.booleanuseCacheDefaultWhether to use the cache by default forStringData
-
Constructor Summary
Constructors Constructor Description DataOptions()Constructs a newDataOptionsinstance with default values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull DataOptionsenabled(boolean enabled)Setsenabled@NotNull DataOptionsentities(@NotNull java.util.function.Consumer<DataOptions.Entities> consumer)Setsentitiesusing the specifiedConsumer@NotNull DataOptionsentities(@NotNull DataOptions.Entities entities)Setsentities@NotNull DataOptionsentityDataColumns(@NotNull java.lang.String... columns)Adds the specified columns to theEntityData.TABLE_NAMEtable@NotNull DataOptionsentityDataColumns(@NotNull java.util.Collection<java.lang.String> columns)Adds the specified columns to theEntityData.TABLE_NAMEtablestatic @NotNull DataOptionsload(@NotNull org.bukkit.configuration.ConfigurationSection section)Loads the options from the specifiedConfigurationSection@NotNull DataOptionstable(@NotNull java.lang.String table, @NotNull java.lang.String... columns)Adds the specified table totables
The table and all columns will be converted to lowercase@NotNull DataOptionstable(@NotNull java.lang.String table, @NotNull java.util.Collection<java.lang.String> columns)Adds the specified table totables
The table and all columns will be converted to lowercase@NotNull DataOptionstables(@NotNull java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> tables)Adds all the specified tables totables
All tables and columns will be converted to lowercase@NotNull DataOptionsuseCacheDefault(boolean useCacheDefault)SetsuseCacheDefault
-
-
-
Field Detail
-
enabled
public boolean enabled
-
tables
@NotNull public @NotNull java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tables
A set of all tables/columns to be created forDataManager. Do not include the table prefix!
This is case-insensitive, so all keys and values will be converted to lowercase
All tables will be made with the primary keytarget
If no custom columns are added toEntityData.TABLE_NAME, it won't be created. Manually removing it will breakEntityData
-
useCacheDefault
public boolean useCacheDefault
Whether to use the cache by default forStringData
-
entities
@NotNull public @NotNull DataOptions.Entities entities
Options forentity data management
-
-
Constructor Detail
-
DataOptions
public DataOptions()
Constructs a newDataOptionsinstance with default values
-
-
Method Detail
-
enabled
@NotNull public @NotNull DataOptions enabled(boolean enabled)
Setsenabled- Parameters:
enabled- the new value- Returns:
- this
DataOptionsinstance for chaining
-
tables
@NotNull public @NotNull DataOptions tables(@NotNull @NotNull java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> tables)
Adds all the specified tables totables
All tables and columns will be converted to lowercase- Parameters:
tables- the tables to add- Returns:
- this
DataOptionsinstance for chaining
-
table
@NotNull public @NotNull DataOptions table(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.util.Collection<java.lang.String> columns)
Adds the specified table totables
The table and all columns will be converted to lowercase- Parameters:
table- the table to addcolumns- the columns to add for the table- Returns:
- this
DataOptionsinstance for chaining
-
table
@NotNull public @NotNull DataOptions table(@NotNull @NotNull java.lang.String table, @NotNull @NotNull java.lang.String... columns)
Adds the specified table totables
The table and all columns will be converted to lowercase- Parameters:
table- the table to addcolumns- the columns to add for the table- Returns:
- this
DataOptionsinstance for chaining
-
entityDataColumns
@NotNull public @NotNull DataOptions entityDataColumns(@NotNull @NotNull java.util.Collection<java.lang.String> columns)
Adds the specified columns to theEntityData.TABLE_NAMEtable- Parameters:
columns- the columns to add- Returns:
- this
DataOptionsinstance for chaining
-
entityDataColumns
@NotNull public @NotNull DataOptions entityDataColumns(@NotNull @NotNull java.lang.String... columns)
Adds the specified columns to theEntityData.TABLE_NAMEtable- Parameters:
columns- the columns to add- Returns:
- this
DataOptionsinstance for chaining
-
useCacheDefault
@NotNull public @NotNull DataOptions useCacheDefault(boolean useCacheDefault)
SetsuseCacheDefault- Parameters:
useCacheDefault- the new value- Returns:
- this
DataOptionsinstance for chaining
-
entities
@NotNull public @NotNull DataOptions entities(@NotNull @NotNull DataOptions.Entities entities)
Setsentities- Parameters:
entities- the new value- Returns:
- this
DataOptionsinstance for chaining
-
entities
@NotNull public @NotNull DataOptions entities(@NotNull @NotNull java.util.function.Consumer<DataOptions.Entities> consumer)
Setsentitiesusing the specifiedConsumer- Parameters:
consumer- the consumer to accept theDataOptions.Entitiesinstance- Returns:
- this
DataOptionsinstance for chaining
-
load
@NotNull public static @NotNull DataOptions load(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section)
Loads the options from the specifiedConfigurationSection- Parameters:
section- the section to load the options from- Returns:
- the loaded options
-
-