Class SpongePlatform

java.lang.Object
io.github.projectunified.faststats.sponge.SpongePlatform
All Implemented Interfaces:
Platform

public class SpongePlatform extends Object implements Platform
Sponge implementation of Platform.
  • Constructor Details

    • SpongePlatform

      public SpongePlatform(org.spongepowered.plugin.PluginContainer plugin, org.apache.logging.log4j.Logger logger, Path dataDirectory)
      Constructs a new SpongePlatform for the given plugin container.

      The plugin's Sponge metrics collection state is used as the enabled flag, so opting out via the global Sponge metrics configuration also opts out here.

      Parameters:
      plugin - the plugin container
      logger - the logger instance
      dataDirectory - the data directory
  • Method Details

    • getProjectName

      public String getProjectName()
      Description copied from interface: Platform
      Gets the name of the project (plugin, mod, ...) reporting metrics.

      This name is submitted along with the metrics so the service can associate the data with the correct project.

      Specified by:
      getProjectName in interface Platform
      Returns:
      the project name
    • getConfig

      public Config getConfig()
      Description copied from interface: Platform
      Retrieves the platform-specific configuration.
      Specified by:
      getConfig in interface Platform
      Returns:
      the platform config instance
    • getMetrics

      public Collection<Metric<?>> getMetrics()
      Description copied from interface: Platform
      Gets default platform-specific metrics.
      Specified by:
      getMetrics in interface Platform
      Returns:
      a collection of platform metrics
    • logInfo

      public void logInfo(String message)
      Description copied from interface: Platform
      Logs informational messages.
      Specified by:
      logInfo in interface Platform
      Parameters:
      message - the message to log
    • logWarning

      public void logWarning(String message)
      Description copied from interface: Platform
      Logs warning messages.
      Specified by:
      logWarning in interface Platform
      Parameters:
      message - the message to log
    • logError

      public void logError(String message, Throwable throwable)
      Description copied from interface: Platform
      Logs error messages.
      Specified by:
      logError in interface Platform
      Parameters:
      message - the error message
      throwable - the cause of the error