Package org.spongepowered.api
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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Scheduler
asyncScheduler()
Gets the asyncScheduler
.BuilderProvider
builderProvider()
Retrieves theBuilderProvider
.ChannelManager
channelManager()
Gets theChannelManager
for creating network channels.default Client
client()
Gets theClient
.ConfigManager
configManager()
Gets theConfigManager
used to load and manage configuration files for plugins.DataManager
dataManager()
EventManager
eventManager()
Gets theEventManager
.FactoryProvider
factoryProvider()
Retrieves theFactoryProvider
.Path
gameDirectory()
Gets the directory where the game's files are located.default boolean
isClientAvailable()
Returns if theClient
is available for use.boolean
isServerAvailable()
Returns if theServer
is available for use.Locale
locale(@NonNull String locale)
Gets a locale for the specified locale code, e.g.MetricsConfigManager
metricsConfigManager()
Gets theMetricsConfigManager
instance, allowing data/metric gathering systems to determine whether they have permission to gather server metrics.Platform
platform()
Returns the current platform, or implementation, thisGame
is running on.PluginManager
pluginManager()
Gets thePluginManager
.Server
server()
Gets theServer
.ServiceProvider.GameScoped
serviceProvider()
Gets theServiceProvider.GameScoped
, used to provide Sponge services that plugins may provide.SqlManager
sqlManager()
Gets theSqlManager
for grabbing sql data sources.SystemSubject
systemSubject()
Gets theSystemSubject
.-
Methods inherited from interface org.spongepowered.api.registry.RegistryHolder
findRegistry, registry, streamRegistries
-
-
-
-
Method Detail
-
gameDirectory
Path gameDirectory()
Gets the directory where the game's files are located.- Returns:
- The game directory
-
isServerAvailable
boolean isServerAvailable()
Returns if theServer
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 theServer
.- Returns:
- The server
- Throws:
IllegalStateException
- If the Server isn't currently available
-
systemSubject
SystemSubject systemSubject()
Gets theSystemSubject
. Depending on the implementation, this may also represent the game console.- Returns:
- The
SystemSubject
-
locale
Locale locale(@NonNull 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 theClient
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 theClient
.- Returns:
- The client
- Throws:
UnsupportedEngineException
- If the client engine is not supportedIllegalStateException
- If the Client isn't currently available
-
platform
Platform platform()
Returns the current platform, or implementation, thisGame
is running on.- Returns:
- The current implementation
-
builderProvider
BuilderProvider builderProvider()
Retrieves theBuilderProvider
.- Returns:
- The builder provider
-
factoryProvider
FactoryProvider factoryProvider()
Retrieves theFactoryProvider
.- Returns:
- The factory provider
-
dataManager
DataManager dataManager()
- Returns:
- The serialization service
-
pluginManager
PluginManager pluginManager()
Gets thePluginManager
.- Returns:
- The plugin manager
-
eventManager
EventManager eventManager()
Gets theEventManager
.- Returns:
- The event manager
-
configManager
ConfigManager configManager()
Gets theConfigManager
used to load and manage configuration files for plugins.- Returns:
- The configuration manager
-
channelManager
ChannelManager channelManager()
Gets theChannelManager
for creating network channels.- Returns:
- The channel manager
-
metricsConfigManager
MetricsConfigManager metricsConfigManager()
Gets theMetricsConfigManager
instance, allowing data/metric gathering systems to determine whether they have permission to gather server metrics.- Returns:
- The
MetricsConfigManager
instance
-
sqlManager
SqlManager sqlManager()
Gets theSqlManager
for grabbing sql data sources.- Returns:
- The
SqlManager
instance.
-
serviceProvider
ServiceProvider.GameScoped serviceProvider()
Gets theServiceProvider.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
-
-