Package com.dianxin.tori.api
Class ToriProvider
java.lang.Object
com.dianxin.tori.api.ToriProvider
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IBotLoaderRetrieves the bot loader responsible for loading and managing bots.static ServerConfigurationRetrieves the global configuration of the server.static ConsoleCommandManagerRetrieves the manager responsible for handling terminal console commands.static SchedulerRetrieves the scheduler responsible for managing timed and scheduled tasks.static booleanhasJDave()Checks if the JDave Audio Encryption extension is available in the classpath.static voidsetServer(ToriServer instance) Sets the global instance of the ToriServer.
-
Constructor Details
-
ToriProvider
public ToriProvider()
-
-
Method Details
-
setServer
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 initializedToriServerinstance.- Throws:
UnsupportedOperationException- if the server instance has already been set.
-
getConfig
Retrieves the global configuration of the server.- Returns:
- The
ServerConfigurationinstance containing server settings. - Throws:
IllegalStateException- if the server has not been initialized yet.
-
getConsoleCommandManager
Retrieves the manager responsible for handling terminal console commands.- Returns:
- The
ConsoleCommandManagerinstance. - Throws:
IllegalStateException- if the server has not been initialized yet.
-
getScheduler
Retrieves the scheduler responsible for managing timed and scheduled tasks.- Returns:
- The
Schedulerinstance. - Throws:
IllegalStateException- if the server has not been initialized yet.
-
getBotLoader
Retrieves the bot loader responsible for loading and managing bots.- Returns:
- The
IBotLoaderinstance. - 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:
trueif JDave is loaded and available,falseotherwise.- Throws:
IllegalStateException- if the server has not been initialized yet.
-