Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Analyse Server Plugins
# ServerStats Server Plugins

Analytics tracking plugins for Minecraft servers. Supports Paper, Velocity, and BungeeCord.

Expand Down Expand Up @@ -27,32 +27,32 @@ Download the appropriate plugin for your server:

| Platform | Download |
|----------|----------|
| Paper/Spigot | `analyse-paper-x.x.x.jar` |
| BungeeCord | `analyse-bungeecord-x.x.x.jar` |
| Velocity | `analyse-velocity-x.x.x.jar` |
| Paper/Spigot | `serverstats-paper-x.x.x.jar` |
| BungeeCord | `serverstats-bungeecord-x.x.x.jar` |
| Velocity | `serverstats-velocity-x.x.x.jar` |

### 2. Configure

Add your API key from [analyse.net](https://analyse.net):
Add your API key from [serverstats.net](https://serverstats.net):

```yaml
# Paper - plugins/Analyse/config.yml
# Paper - plugins/ServerStats/config.yml
api-key: "your-api-key-here"
```

### 3. Verify

Run `/analyse status` to check the connection.
Run `/serverstats status` to check the connection.

## For Developers

Track custom events from your plugin:

```java
import net.analyse.api.Analyse;
import net.serverstats.api.ServerStats;

// Simple event
Analyse.trackEvent("shop_purchase")
ServerStats.trackEvent("shop_purchase")
.withPlayer(player.getUniqueId(), player.getName())
.withData("item", "diamond_sword")
.withValue(500.0)
Expand All @@ -78,9 +78,9 @@ See the [Developer API Documentation](docs/api.md) for more examples.
```

Output JARs:
- `paper/build/libs/analyse-paper-*.jar`
- `velocity/build/libs/analyse-velocity-*.jar`
- `bungeecord/build/libs/analyse-bungeecord-*.jar`
- `paper/build/libs/serverstats-paper-*.jar`
- `velocity/build/libs/serverstats-velocity-*.jar`
- `bungeecord/build/libs/serverstats-bungeecord-*.jar`

## Requirements

Expand All @@ -92,20 +92,20 @@ Output JARs:
## Commands

```
/analyse - Show plugin status
/analyse status - Show plugin status
/analyse reload - Reload configuration
/analyse debug - Toggle debug mode
/analyse event <name> - Send a custom event
/analyse help - Show help
/serverstats - Show plugin status
/serverstats status - Show plugin status
/serverstats reload - Reload configuration
/serverstats debug - Toggle debug mode
/serverstats event <name> - Send a custom event
/serverstats help - Show help
```

See [Commands Documentation](docs/commands.md) for details.

## Support

- Website: [analyse.net](https://analyse.net)
- API: [api.analyse.net](https://api.analyse.net)
- Website: [serverstats.net](https://serverstats.net)
- API: [api.serverstats.net](https://api.serverstats.net)

## License

Expand Down
14 changes: 7 additions & 7 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ tasks.register('generateBuildConstants') {
outputs.dir(outputDir)

doLast {
def constantsFile = new File(outputDir, 'net/analyse/api/BuildConstants.java')
def constantsFile = new File(outputDir, 'com/serverstats/api/BuildConstants.java')
constantsFile.parentFile.mkdirs()
constantsFile.text = """package net.analyse.api;
constantsFile.text = """package com.serverstats.api;

/**
* Auto-generated build constants from Gradle.
Expand All @@ -52,14 +52,14 @@ publishing {
maven(MavenPublication) {
from components.java

groupId = 'net.analyse'
artifactId = 'analyse-api'
groupId = 'com.serverstats'
artifactId = 'serverstats-api'
version = rootProject.version

pom {
name = 'Analyse API'
description = 'Public API for Analyse analytics plugin'
url = 'https://analyse.net'
name = 'ServerStats API'
description = 'Public API for ServerStats analytics plugin'
url = 'https://serverstats.com'

licenses {
license {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package net.analyse.api;
package com.serverstats.api;

import net.analyse.api.manager.ABTestManager;
import net.analyse.api.manager.SessionManager;
import net.analyse.api.object.abtest.ABTest;
import net.analyse.api.object.builder.EventBuilder;
import net.analyse.api.platform.AnalysePlatform;
import com.serverstats.api.manager.ABTestManager;
import com.serverstats.api.manager.SessionManager;
import com.serverstats.api.object.abtest.ABTest;
import com.serverstats.api.object.builder.EventBuilder;
import com.serverstats.api.platform.ServerStatsPlatform;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
* Main entry point for the Analyse API.
* Main entry point for the ServerStats API.
* Use this class to track custom analytics events and interact with A/B tests.
*
* <p>Event tracking example:</p>
* <pre>{@code
* // Track a player completing a quest
* Analyse.trackEvent("quest_completed")
* ServerStats.trackEvent("quest_completed")
* .withPlayer(player.getUniqueId(), player.getName())
* .withData("quest_id", "dragon_slayer")
* .withData("time_taken_seconds", 3600)
Expand All @@ -27,53 +27,53 @@
* <p>A/B testing example:</p>
* <pre>{@code
* // Get the variant assigned to a player
* String variant = Analyse.getVariant(player.getUniqueId(), "welcome-rewards");
* String variant = ServerStats.getVariant(player.getUniqueId(), "welcome-rewards");
* if ("diamonds".equals(variant)) {
* giveWelcomeDiamonds(player);
* }
*
* // Track a conversion event
* Analyse.trackConversion(player.getUniqueId(), player.getName(), "welcome-rewards", "first_purchase");
* ServerStats.trackConversion(player.getUniqueId(), player.getName(), "welcome-rewards", "first_purchase");
* }</pre>
*
* <p>Accessing managers:</p>
* <pre>{@code
* // Get the platform for advanced usage
* AnalysePlatform platform = Analyse.get();
* ServerStatsPlatform platform = ServerStats.get();
* SessionManager sessions = platform.getSessionManager();
* ABTestManager abTests = platform.getABTestManager();
* }</pre>
*/
public final class Analyse {
public final class ServerStats {

private static EventBuilder.EventSender eventSender;

private Analyse() {
private ServerStats() {
}

/**
* Get the Analyse platform instance for advanced usage.
* Get the ServerStats platform instance for advanced usage.
* Use this to access managers and platform-specific functionality.
*
* @return The platform instance
* @throws IllegalStateException if Analyse is not initialized
* @throws IllegalStateException if ServerStats is not initialized
*/
public static AnalysePlatform get() {
AnalysePlatform platform = AnalyseProvider.getPlatform();
public static ServerStatsPlatform get() {
ServerStatsPlatform platform = ServerStatsProvider.getPlatform();
if (platform == null) {
throw new IllegalStateException("Analyse is not initialized. Make sure the Analyse plugin is enabled.");
throw new IllegalStateException("ServerStats is not initialized. Make sure the ServerStats plugin is enabled.");
}

return platform;
}

/**
* Check if Analyse is available and ready to use
* Check if ServerStats is available and ready to use
*
* @return true if Analyse is initialized and ready
* @return true if ServerStats is initialized and ready
*/
public static boolean isAvailable() {
return AnalyseProvider.isRegistered();
return ServerStatsProvider.isRegistered();
}

/**
Expand Down Expand Up @@ -203,7 +203,7 @@ public static void trackConversion(UUID playerUuid, String playerUsername, Strin
* Get the session manager
*
* @return The session manager
* @throws IllegalStateException if Analyse is not initialized
* @throws IllegalStateException if ServerStats is not initialized
*/
public static SessionManager sessions() {
return get().getSessionManager();
Expand All @@ -213,7 +213,7 @@ public static SessionManager sessions() {
* Get the A/B test manager
*
* @return The A/B test manager, or null if not available
* @throws IllegalStateException if Analyse is not initialized
* @throws IllegalStateException if ServerStats is not initialized
*/
public static ABTestManager abTests() {
return get().getABTestManager();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package net.analyse.api;
package com.serverstats.api;

import net.analyse.api.platform.AnalysePlatform;
import com.serverstats.api.platform.ServerStatsPlatform;

/**
* Internal provider that holds the reference to the active platform plugin.
* This allows the static Analyse API to access the underlying implementation.
* This allows the static ServerStats API to access the underlying implementation.
*
* <p><b>For plugin developers:</b> Use {@link Analyse} instead of this class.</p>
* <p><b>For plugin developers:</b> Use {@link ServerStats} instead of this class.</p>
*
* <p><b>For platform implementations:</b> Call {@link #register(AnalysePlatform)}
* <p><b>For platform implementations:</b> Call {@link #register(ServerStatsPlatform)}
* in your onEnable and {@link #unregister()} in your onDisable.</p>
*/
public final class AnalyseProvider {
public final class ServerStatsProvider {

private static AnalysePlatform platform;
private static ServerStatsPlatform platform;

private AnalyseProvider() {
private ServerStatsProvider() {
}

/**
Expand All @@ -24,12 +24,12 @@ private AnalyseProvider() {
* @param platform The platform implementation
* @throws IllegalStateException if a platform is already registered
*/
public static void register(AnalysePlatform platform) {
if (AnalyseProvider.platform != null) {
throw new IllegalStateException("Analyse platform is already registered");
public static void register(ServerStatsPlatform platform) {
if (ServerStatsProvider.platform != null) {
throw new IllegalStateException("ServerStats platform is already registered");
}

AnalyseProvider.platform = platform;
ServerStatsProvider.platform = platform;
}

/**
Expand All @@ -44,7 +44,7 @@ public static void unregister() {
*
* @return The platform implementation, or null if not registered
*/
public static AnalysePlatform getPlatform() {
public static ServerStatsPlatform getPlatform() {
return platform;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package net.analyse.api.exception;
package com.serverstats.api.exception;

/**
* Exception thrown when an Analyse API operation fails
* Exception thrown when an ServerStats API operation fails
*/
public class AnalyseException extends Exception {
public class ServerStatsException extends Exception {

private final int statusCode;
private final ErrorType errorType;
Expand All @@ -14,7 +14,7 @@ public class AnalyseException extends Exception {
* @param statusCode The HTTP status code
* @param message The error message
*/
public AnalyseException(int statusCode, String message) {
public ServerStatsException(int statusCode, String message) {
super(message);
this.statusCode = statusCode;
this.errorType = ErrorType.fromStatusCode(statusCode);
Expand All @@ -26,7 +26,7 @@ public AnalyseException(int statusCode, String message) {
* @param message The error message
* @param cause The underlying cause
*/
public AnalyseException(String message, Throwable cause) {
public ServerStatsException(String message, Throwable cause) {
super(message, cause);
this.statusCode = 0;
this.errorType = ErrorType.NETWORK_ERROR;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.analyse.api.manager;
package com.serverstats.api.manager;

import net.analyse.api.object.abtest.ABTest;
import com.serverstats.api.object.abtest.ABTest;
import java.util.List;
import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.analyse.api.manager;
package com.serverstats.api.manager;

import net.analyse.api.session.PlayerSession;
import com.serverstats.api.session.PlayerSession;
import java.util.Collection;
import java.util.Optional;
import java.util.UUID;
Expand Down
Loading