Closed kaxlabs closed 3 years ago
Hi, how do you get the protocol version of a player with ViaVersion api? It seems you need the Player object which you can't get on ping event.
For spigot, you can add it to your maven like so:
<repository>
<id>viaversion-repo</id>
<url>https://repo.viaversion.com</url>
</repository>
<dependency>
<groupId>us.myles</groupId>
<artifactId>viaversion</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>
and then use it in your code like this:
Player player = // some reference of the player
int protocolVersion = Via.getAPI().getPlayerVersion(player.getUniqueId());
For bungeecord this is not needed, you can just use event.getConnection().getVersion();
from the ProxyPingEvent.
I will try to implement this for BungeeCord. It will not be possible to do in Bukkit as you can't get the "Player" on ServerListPing.
I will try to implement this for BungeeCord. It will not be possible to do in Bukkit as you can't get the "Player" on ServerListPing.
You can do it with ProtocolLib tho... We will probably have an implementation soon :)
Closed with 4f13ced
I had to revert the changes because they broke some stuff and only work on BungeeCord if ViaVersion is installed.
Since 1.16 color formatting codes don't work on lower versions, it would be good to have different version profiles (e.g. 1.16+, 1.15-) so that servers with ViaVersion/ViaBackwards are able to look good for all users.