Class Sponge

java.lang.Object
org.spongepowered.api.Sponge

public final class Sponge extends Object
A static all access class granting static access to various systems for the API.
  • Constructor Details

    • Sponge

      public Sponge()
  • Method Details

    • game

      public static Game game()
      Gets the Game instance. There is ever only going to be a single game instance at any given time.
      Returns:
      The game instance
    • platform

      public static Platform platform()
      Returns the current platform, or implementation, this Game is running on.
      Returns:
      The current implementation
    • dataManager

      public static DataManager dataManager()
      Gets the DataManager instance.
      Returns:
      The data manager instance
    • pluginManager

      public static PluginManager pluginManager()
      Gets the PluginManager instance.
      Returns:
      The plugin manager instance
    • eventManager

      public static EventManager eventManager()
      Gets the EventManager instance.
      Returns:
      The event manager instance
    • configManager

      public static ConfigManager configManager()
      Gets the ConfigManager used to load and manage configuration files for plugins.
      Returns:
      The configuration manager
    • channelManager

      public static ChannelManager channelManager()
      Gets the ChannelManager for creating network channels.
      Returns:
      The channel registry
    • isServerAvailable

      public static boolean isServerAvailable()
      Gets whether a Server instance is available without throwing an exception from calling server().
      Returns:
      True if the server instance is available
      See Also:
    • server

      public static Server server()
      Gets the Server instance from the Game instance.

      Note: During various events, a Server instance may NOT be available. Calling Game.server() during one will throw an exception. To double check, call isServerAvailable()

      Returns:
      The server instance
      See Also:
    • isClientAvailable

      public static boolean isClientAvailable()
      Gets whether a Client instance is available without throwing an exception from calling client().
      Returns:
      True if the client instance is available
      See Also:
    • client

      public static Client client()
      Gets the Client instance from the Game instance.

      Note: Not all implementations support a client, consult your vendor for further information.

      Returns:
      The client instance
      See Also:
    • systemSubject

      public static SystemSubject systemSubject()
      Gets the SystemSubject instance from the Game instance.
      Returns:
      The system subject
      See Also:
    • metricsConfigManager

      public static MetricsConfigManager metricsConfigManager()
      Gets the MetricsConfigManager instance, allowing data/metric gathering systems to determine whether they have permission to gather server metrics.
      Returns:
      The MetricsConfigManager instance
    • asyncScheduler

      public static Scheduler asyncScheduler()
      Gets the Scheduler used to schedule async tasks.
      Returns:
      The async scheduler
    • sqlManager

      public static SqlManager sqlManager()
      Gets the SqlManager for grabbing sql data sources.
      Returns:
      The SqlManager instance.
    • serviceProvider

      public static ServiceProvider.GameScoped serviceProvider()
      Gets the Game scoped ServiceProvider for providing services.

      Engine scoped services, if they exist, can be found on the respective engine.

      Returns:
      The service provider.