Interface ViaAPI<T>

    • Method Detail

      • majorVersion

        default int majorVersion()
        Returns the major version matching getVersion(). It is highly advised to check against the major version and to disable/not initiate any hooks into ViaVersion if given and expected versions do not match.
        Returns:
        major plugin version
        Since:
        4.0.2
      • apiVersion

        default int apiVersion()
        Returns an internally based API version incremented with meaningful API changes. This includes breaking changes to existing API and larger additions.
        Returns:
        API version incremented with meaningful API changes
      • getServerVersion

        ServerProtocolVersion getServerVersion()
        Returns the server's protocol version info.
        Returns:
        the server's protocol version info
      • getPlayerVersion

        int getPlayerVersion​(T player)
        Returns the protocol version of a player. This will also retrieve the version from ProtocolSupport if it's being used.
        Parameters:
        player - the platform's player object, e.g. Bukkit this is Player
        Returns:
        protocol version, for example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if no longer connected
      • getPlayerVersion

        int getPlayerVersion​(java.util.UUID uuid)
        Returns the protocol version of a player.
        Parameters:
        uuid - UUID of a player
        Returns:
        protocol version, for example (47=1.8-1.8.8, 107=1.9, 108=1.9.1), or -1 if not connected
      • isInjected

        boolean isInjected​(java.util.UUID uuid)
        Returns whether Via injected into this player connection.
        Parameters:
        uuid - uuid of the player
        Returns:
        whether Via has a cached a UserConnection for this player
      • getConnection

        @Nullable UserConnection getConnection​(java.util.UUID uuid)
        Returns the Via injected UserConnection if present.
        Parameters:
        uuid - uuid of the player
        Returns:
        user connection if present
      • getVersion

        java.lang.String getVersion()
        Returns the version of the plugin.
        Returns:
        plugin version
      • sendRawPacket

        void sendRawPacket​(T player,
                           io.netty.buffer.ByteBuf packet)
        Sends a raw packet to the player.
        Parameters:
        player - the platform's player object, e.g. for Bukkit this is Player
        packet - the packet; you need a VarInt Id, then the packet contents
        Throws:
        java.lang.IllegalArgumentException - if the player is not injected by Via
      • sendRawPacket

        void sendRawPacket​(java.util.UUID uuid,
                           io.netty.buffer.ByteBuf packet)
        Sends a raw packet to the player.
        Parameters:
        uuid - the uuid from the player to send packet
        packet - the packet; you need a VarInt Id, then the packet contents
        Throws:
        java.lang.IllegalArgumentException - if the player is not injected by Via
      • getSupportedVersions

        java.util.SortedSet<java.lang.Integer> getSupportedVersions()
        Returns the supported protocol versions. This method removes any blocked protocol versions.
        Returns:
        a list of protocol versions
        See Also:
        for a full list
      • getFullSupportedVersions

        java.util.SortedSet<java.lang.Integer> getFullSupportedVersions()
        Returns the supported protocol versions, including blocked protocols.
        Returns:
        a list of protocol versions
      • legacyAPI

        LegacyViaAPI<T> legacyAPI()
        Returns legacy api only applicable on/to legacy versions.

        These methods are safe to use and are unlikely to be removed, but it is important to be aware of their limited use.

        Returns:
        legacy api only applicable on/to legacy versions