/MCVersion

Primary LanguageJavaMIT LicenseMIT

Minecraft Version Library

Twitter

Get MCVersion from ProtocolVersion

You can recognize the version of the player based on the ProtocolVersion obtained by ViaVersion, etc.

import xyz.mlserver.mcversion.MCVersion;

public class Example {
    public static void example() {
        MCVersion version = MCVersion.fromProtocolVersion(47);
        System.out.println(version);
    }
}

Example with ViaVersion

import xyz.mlserver.mcversion.MCVersion;

public class Example implements Listener {
    @EventHandler
    public void on(PlayerJoinEvent e) {
        Player player = e.getPlayer();
        int protocolVersion = Via.getAPI().getPlayerVersion(uuid);
        version = MCVersion.getByProtocolVersion(protocolVersion).getName();
        System.out.println(version);
    }
}

Using with Maven

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

<dependency>
    <groupId>xyz.mlserver</groupId>
    <artifactId>MCVersion</artifactId>
    <version>VERSION</version>
</dependency>

Using with Gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'xyz.mlserver:MCVersion:VERSION'
}

Developer

JavaDoc Command

mvn javadoc:javadoc