Page tree
Skip to end of metadata
Go to start of metadata

ViaVersion provides an API for developers, this page will show you some basic usage.


French Tutorial:


The old API is deprecated from 1.0.0, please use the new API.

What changed?

We focused for the 1.0.0 release at making ViaVersion multiplatform compatible. This also meant we had to change the way ViaVersion and the api worked,

The class ViaVersion is deprecated, by usages like ViaVersion.getInstance() use Via.getAPI() instead.


ViaVersion provides a Maven repository that you can use to implement the ViaVersion API inside your project.

ViaVersion Maven repository

ViaVersion Maven dependency

You may need to replace LATEST with the version number of the latest release, eg. 2.2.2.

Get the players protocol version

You can get the protocol version from a player, List with all the Minecraft versions + protocol numbers (

ViaAPI api = Via.getAPI(); // Get the API
int version = api.getPlayerVersion(player); // Get the protocol version

BossBar API

Mojang introduced new bossbars in Minecraft 1.9

ViaVersion provides an API for developers to use the new BossBar for 1.9 players and higher.

Example BossBar usage:
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import us.myles.ViaVersion.api.ViaVersion;
import us.myles.ViaVersion.api.ViaVersionAPI;
import us.myles.ViaVersion.api.boss.BossBar;
import us.myles.ViaVersion.api.boss.BossColor;
import us.myles.ViaVersion.api.boss.BossStyle;

public class BossBarExample extends JavaPlugin implements Listener {
    private BossBar bossBar;

    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this); // Register Bukkit events

        ViaAPI api = Via.getAPI(); // Get the API
        bossBar = api.createBossBar(
                "Hi! This BossBar is created using the ViaVersion API!", // BossBar title
                1F, // Boss health (Float between 0 and 1)
                BossColor.BLUE,  // BossBar color
                BossStyle.SOLID); // BossBar Style

    public void onJoin(PlayerJoinEvent e) {
		// When we added the BossBar, we supported addPlayer with a Player object, that is deprecated since 1.0.0. 
		// Get the player UUID instead.
        bossBar.addPlayer(e.getPlayer().getUniqueId()); // Show the BossBar when a player joins 

Side note

Our API will not give 1.8 players a BossBar for the people that use 1.8-1.8.8.

Spigot provides an API for everyone that uses Spigot 1.9 and higher. We recommend you to use that one if you are using Spigot 1.9 or higher.