Interface Game

  • All Superinterfaces:
    RegistryHolder

    public interface Game
    extends RegistryHolder
    The core accessor of the API. The implementation uses this to pass constructed objects.
    • Method Detail

      • asyncScheduler

        Scheduler asyncScheduler()
        Gets the async Scheduler.
        Returns:
        The async scheduler
      • gameDirectory

        java.nio.file.Path gameDirectory()
        Gets the directory where the game's files are located.
        Returns:
        The game directory
      • isServerAvailable

        boolean isServerAvailable()
        Returns if the Server is available for use. The result of this method is entirely dependent on the implementation.
        Returns:
        True if the Server is available, false if not
      • server

        Server server()
        Gets the Server.
        Returns:
        The server
        Throws:
        java.lang.IllegalStateException - If the Server isn't currently available
      • locale

        java.util.Locale locale​(@NonNull java.lang.String locale)
        Gets a locale for the specified locale code, e.g. en_US.
        Parameters:
        locale - The locale to lookup (e.g. en_US.
        Returns:
        The locale
      • isClientAvailable

        default boolean isClientAvailable()
        Returns if the Client is available for use. The result of this method is entirely dependent on the implementation.
        Returns:
        True if the Client is available, false if not
      • client

        default Client client()
        Gets the Client.
        Returns:
        The client
        Throws:
        UnsupportedEngineException - If the client engine is not supported
        java.lang.IllegalStateException - If the Client isn't currently available
      • platform

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

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

        ServiceProvider.GameScoped serviceProvider()
        Gets the ServiceProvider.GameScoped, used to provide Sponge services that plugins may provide. Services provided here are scoped to the lifetime of the Game.

        The provider will not be available during plugin construction and will throw an IllegalStateException if there is an attempt to access this before the provider is ready.

        Returns:
        The service manager