Package de.oliver.fancyanalytics.api
Class FancyAnalyticsAPI
java.lang.Object
de.oliver.fancyanalytics.api.FancyAnalyticsAPI
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFancyAnalyticsAPI(@NotNull String projectId, @NotNull String apiToken) Initializes a new instance of the FancyAnalyticsAPI. -
Method Summary
Modifier and TypeMethodDescriptionGets the GlobalExceptionHandler instance associated with this FancyAnalyticsAPI.voidvoidregisterMinecraftPluginMetrics(org.bukkit.plugin.Plugin plugin) Registers the default metrics related to the provided plugin.voidregisterNumberArrayMetric(MetricSupplier<Double[]> metric) Registers a numerical array metric using the provided MetricSupplier.voidregisterNumberMetric(MetricSupplier<Double> metric) Registers a numerical metric using the provided MetricSupplier.voidregisterStringArrayMetric(MetricSupplier<String[]> metric) Registers a string array metric using the provided MetricSupplier.voidregisterStringMetric(MetricSupplier<String> metric) Registers a string metric using the provided MetricSupplier.voidreportError(Throwable throwable) Reports an error by sending it to the configured analytics server.voidsendEvent(de.oliver.fancyanalytics.sdk.events.Event event) Sends an event to the analytics server.
-
Field Details
-
LOGGER
-
-
Constructor Details
-
FancyAnalyticsAPI
Initializes a new instance of the FancyAnalyticsAPI.- Parameters:
projectId- can be found in the project settings page: https://fancyanalytics.net/projects/apiToken- can be found in the project settings page: https://fancyanalytics.net/projects/
-
-
Method Details
-
initialize
public void initialize() -
reportError
Reports an error by sending it to the configured analytics server.- Parameters:
throwable- The Throwable object representing the error to be reported.
-
sendEvent
public void sendEvent(de.oliver.fancyanalytics.sdk.events.Event event) Sends an event to the analytics server.- Parameters:
event- The Event object containing the name and properties of the event to be sent.
-
registerMinecraftPluginMetrics
public void registerMinecraftPluginMetrics(org.bukkit.plugin.Plugin plugin) Registers the default metrics related to the provided plugin.- Parameters:
plugin- the Plugin instance for which to register the default metrics
-
registerNumberMetric
Registers a numerical metric using the provided MetricSupplier. The metric will be stored and managed by the FancyAnalyticsAPI instance.- Parameters:
metric- the MetricSupplier containing the name and value supplier of the numeric metric to be registered- Throws:
IllegalArgumentException- if a metric with the same name already exists
-
registerNumberArrayMetric
Registers a numerical array metric using the provided MetricSupplier. The metric will be stored and managed by the FancyAnalyticsAPI instance.- Parameters:
metric- the MetricSupplier containing the name and value supplier of the numeric array metric to be registered- Throws:
IllegalArgumentException- if a metric with the same name already exists
-
registerStringMetric
Registers a string metric using the provided MetricSupplier. The metric will be stored and managed by the FancyAnalyticsAPI instance.- Parameters:
metric- the MetricSupplier containing the name and value supplier of the string metric to be registered- Throws:
IllegalArgumentException- if a metric with the same name already exists
-
registerStringArrayMetric
Registers a string array metric using the provided MetricSupplier. The metric will be stored and managed by the FancyAnalyticsAPI instance.- Parameters:
metric- the MetricSupplier containing the name and value supplier of the string array metric to be registered- Throws:
IllegalArgumentException- if a metric with the same name already exists
-
getExceptionHandler
Gets the GlobalExceptionHandler instance associated with this FancyAnalyticsAPI.- Returns:
- the current instance of GlobalExceptionHandler.
-
getConfig
-