Class ToriProvider

java.lang.Object
com.dianxin.tori.api.ToriProvider

public final class ToriProvider extends Object
A global provider and registry for the ToriServer instance. This class acts as a central access point for plugins or bots to interact with the core server functionalities without needing direct dependency injection.
  • Constructor Details

    • ToriProvider

      public ToriProvider()
  • Method Details

    • setServer

      public static void setServer(ToriServer instance)
      Sets the global instance of the ToriServer.

      This method is intended to be called only once during the server's bootstrap or startup phase. Subsequent calls will result in an exception to prevent the core server instance from being overwritten.

      Parameters:
      instance - The initialized ToriServer instance.
      Throws:
      UnsupportedOperationException - if the server instance has already been set.
    • getConfig

      public static ServerConfiguration getConfig()
      Retrieves the global configuration of the server.
      Returns:
      The ServerConfiguration instance containing server settings.
      Throws:
      IllegalStateException - if the server has not been initialized yet.
    • getConsoleCommandManager

      public static ConsoleCommandManager getConsoleCommandManager()
      Retrieves the manager responsible for handling terminal console commands.
      Returns:
      The ConsoleCommandManager instance.
      Throws:
      IllegalStateException - if the server has not been initialized yet.
    • getScheduler

      public static Scheduler getScheduler()
      Retrieves the scheduler responsible for managing timed and scheduled tasks.
      Returns:
      The Scheduler instance.
      Throws:
      IllegalStateException - if the server has not been initialized yet.
    • getBotLoader

      public static IBotLoader getBotLoader()
      Retrieves the bot loader responsible for loading and managing bots.
      Returns:
      The IBotLoader instance.
      Throws:
      IllegalStateException - if the server has not been initialized yet.
    • hasJDave

      public static boolean hasJDave()
      Checks if the JDave Audio Encryption extension is available in the classpath.

      JDave is an optional audio encryption module that provides enhanced audio security features. This method can be used to conditionally enable or disable advanced audio functionality.

      Returns:
      true if JDave is loaded and available, false otherwise.
      Throws:
      IllegalStateException - if the server has not been initialized yet.