Class DataManager


  • public class DataManager
    extends java.lang.Object
    The data manager for the plugin, used to manage the connection and data storage
    • Constructor Summary

      Constructors 
      Constructor Description
      DataManager​(@NotNull StorageConfig config)
      Connect to the configured database and create the pre-defined tables/columns
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • plugin

        @NotNull
        public final @NotNull AnnoyingPlugin plugin
        The plugin to use for the data manager
      • dialect

        @NotNull
        public final @NotNull Dialect dialect
        The dialect for the database
      • tablePrefix

        @NotNull
        public final @NotNull java.lang.String tablePrefix
        The table prefix for the database (only for remote connections)
      • cacheSavingTask

        @Nullable
        public @Nullable org.bukkit.scheduler.BukkitTask cacheSavingTask
        The task that saves the cache on an interval
        See Also:
        toggleIntervalCacheSaving()
    • Constructor Detail

    • Method Detail

      • getTableName

        @NotNull
        public @NotNull java.lang.String getTableName​(@NotNull
                                                      @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
        Parameters:
        tableName - the name of the table to get
        Returns:
        the full name of the table
      • toggleIntervalCacheSaving

        public 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
      • attemptDatabaseMigration

        @NotNull
        public @NotNull DataManager attemptDatabaseMigration()
        Attempts to migrate data from storage.yml to storage-new.yml
        Returns:
        the new data manager