Install Plugin

Installing MinecraftMetrics is specific for Plugin Developer who want to collect data about the servers active and using your plugins. This is not required if you are a Server Owner, only for Plugin Developers.

Plugin Collection Features

- Collects anonymous usage statistics for your plugins
- Privacy-focused with server-side opt-out
- Easy to integrate with Maven

Privacy

- All data collected is **anonymous**
- Server owners can opt-out at any time
- No personal or identifying information is collected
- Data is used solely for statistics and analytics

What Data is Collected?

- Game version
- Java version
- OS information
- CPU core count
- Player count
- Online mode status
- Plugin Version

Add Repository

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Add Dependency

<dependencies>
    <dependency>
        <groupId>com.github.hytalecore</groupId>
        <artifactId>minecraftmetrics-plugin</artifactId>
        <version>v1.0.1</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

Shade and Relocate

IMPORTANT: You must shade and relocate the library into your plugin!

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <configuration>
                <relocations>
                    <relocation>
                        <pattern>minecraftmetricsplugin</pattern>
                        <!-- Replace [your.plugin.package.metrics] with your plugin's package! -->
                        <shadedPattern>your.plugin.package.metrics</shadedPattern>
                    </relocation>
                </relocations>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Usage

Bukkit / Spigot / Paper / Folia

import org.bukkit.plugin.java.JavaPlugin;
import minecraftmetricsplugin.bukkit.Metrics;
public class YourPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        // Get your plugin ID from https://minecraftmetrics.net/plugins
        String pluginId = "12345"; // Replace with your actual plugin ID
        Metrics metrics = new Metrics(this, pluginId);
    }
}

BungeeCord

    import net.md_5.bungee.api.plugin.Plugin;
    import minecraftmetricsplugin.bungeecord.Metrics;
    public class YourPlugin extends Plugin {
        @Override
        public void onEnable() {
            // Get your plugin ID from https://minecraftmetrics.net/plugins
            String pluginId = "12345"; // Replace with your actual plugin ID
            Metrics metrics = new Metrics(this, pluginId);
        }
    }

Configuration

The library creates a config file at `plugins/minecraftmetrics-config.yml`:


# MinecraftMetrics Configuration
# Learn more at: https://minecraftmetrics.net
#
# Set to false to disable metrics collection
enabled: true
#
# Unique server identifier (auto-generated)
serverUuid: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
#
# Debug options
logFailedRequests: false
logDataSent: false
logResponseStatus: false

Building from Source

git clone https://github.com/hytalecore/minecraftmetrics-plugin.git
cd minecraftmetrics-plugin
mvn clean install

The compiled JAR will be in `target/minecraftmetrics-plugin-1.0.0.jar`