[ViaVersion] Get player's client version.

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dovias

New Member
Dec 8, 2019
6
1
0
26
Want to get player's client version, but ViaVersion is overwriting player's packets which at the end provide spoofed client version? No problem, just use ViaVersion's API! here's a simple expression which i made in 5 minutes. Add this to new .sk file or at the top of your skript of choice. You could use this without the expression but i know there's a lot of people who are new to skript, so i tried to make it as simple as possible.

Requires:
- Skript-Mirror. (Preferably skript-mirror 2.0-SNAPSHOT)
- Skript plugin which is compatible with skript-mirror addon. (Preferably Skript 2.4.1)
- ViaVersion (ViaRewind, ViaBackwards, ProtocolSupport is compatible with this.)

Code:
import:
    us.myles.ViaVersion.api.Via

expression %player%'s protocol version:
    get:
        return Via.getAPI().getPlayerVersion(expression-1)

Usage:

Code:
command /getversion:
    trigger:
        set {_protocolnumber} to player's protocol version
        if {_protocolnumber} > 47:
            message "Your client is 1.9+"
        else if {_protocolnumber} = 47:
            message "Your client is 1.8.x"

! This expression returns protocol numbers! To get protocol numbers of all minecraft client versions, use this neat website which lists all minecraft's client version numbers:
https://wiki.vg/Protocol_version_numbers
 
  • Like
Reactions: orange233