public class DataManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
@Nullable org.bukkit.scheduler.BukkitTask |
cacheSavingTask
The task that saves the cache on an interval
|
@NotNull Dialect |
dialect
The
dialect for the database |
@NotNull AnnoyingPlugin |
plugin
The
plugin to use for the data manager |
@NotNull StorageConfig |
storageConfig
The
storage.yml config for the plugin |
@NotNull java.lang.String |
tablePrefix
The table prefix for the database (only for remote connections)
|
| Constructor and Description |
|---|
DataManager(@NotNull StorageConfig config)
Connect to the configured database and create the pre-defined tables/columns
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull DataManager |
attemptDatabaseMigration()
Attempts to migrate data from
storage.yml to storage-new.yml |
@NotNull java.lang.String |
getTableName(@NotNull java.lang.String tableName)
Get the full name of a table with the
prefix
This just returns the table name if it's a local database or there isn't prefix |
void |
toggleIntervalCacheSaving()
If saving the cache on an interval is enabled, this will start the asynchronous task to do that
If the feature is disabled, this will cancel the task if it exists |
@NotNull public final @NotNull AnnoyingPlugin plugin
plugin to use for the data manager@NotNull public final @NotNull StorageConfig storageConfig
storage.yml config for the plugin@NotNull public final @NotNull java.lang.String tablePrefix
@Nullable public @Nullable org.bukkit.scheduler.BukkitTask cacheSavingTask
toggleIntervalCacheSaving()public DataManager(@NotNull
@NotNull StorageConfig config)
throws ConnectionException
config - the storage.yml config to use for the data managerConnectionException - if the connection to the database fails for any reason@NotNull
public @NotNull java.lang.String getTableName(@NotNull
@NotNull java.lang.String tableName)
prefix
tableName - the name of the table to getpublic void toggleIntervalCacheSaving()
@NotNull public @NotNull DataManager attemptDatabaseMigration()
storage.yml to storage-new.yml