GrpcXenosClient

class GrpcXenosClient(host: String, port: Int = DEFAULT_XENOS_PORT) : XenosClient

A GrpcXenosClient represents the gRPC implementation of the Xenos Client. The implementation is based on the official Protobuf definitions released with Xenos. Each platform only needs to use one implementation of the Xenos Client, but is free to choose it freely. This implementation is really fast and should be preferred if Xenos is deployed with gRPC.

When creating an instance of this implementation, the corresponding network channel is dynamically assembled for this purpose. The corresponding stubs for coroutine-based communication with the interface are instantiated for the channel to the attached sidecar. No action is taken by creating this instance, and communication with the external interface is not initiated.

Parameters

host

The host, under which the gRPC server of Xenos can be reached and that will therefore be used to establish the connection.

port

The port, under which the gRPC server of Xenos can be reached and that will therefore be used to establish the connection.

Constructors

Link copied to clipboard
constructor(host: String, port: Int = DEFAULT_XENOS_PORT)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()

Closes all open resources that are associated with the Xenos Client. After this operation, this instance of the Xenos Client may no longer be used, as all connections are no longer usable. This method is idempotent and can therefore be called any number of times without changing its behaviour. It is guaranteed, that after this call all open connections and allocated resources will be closed or released. Although not all implementations have such resources, the method should still always be called (for example, within a Try-With-Resources block or a use method) to cleanly terminate resource usage.

Link copied to clipboard
open suspend override fun getCape(userId: UUID): CapeInfo?

Retrieves the current cape of the supplied userId from Xenos. The result includes the moment when the data was fetched from the Mojang API, to that stale data can be identified. If the player cannot be found or has no cape, null will be returned. The texture is guaranteed to be present within the memory and therefore easily accessible.

Link copied to clipboard
open suspend override fun getHead(userId: UUID, includeOverlay: Boolean): HeadInfo?

Retrieves the current head of the supplied userId from Xenos. The result includes the moment when the data was fetched from the Mojang API, to that stale data can be identified. The overlay skin layer may be included. If the player cannot be found, null will be returned. The texture is guaranteed to be present within the memory and therefore easily accessible.

Link copied to clipboard
open suspend override fun getProfile(userId: UUID): ProfileInfo?

Retrieves the profile for the supplied userId from Xenos. The result includes the moment when the data was fetched from the Mojang API, so that stale data can be identified. If the player cannot be found, null will be returned. Whether profiles contain signatures can be configured within Xenos.

Link copied to clipboard
open suspend override fun getSkin(userId: UUID): SkinInfo?

Retrieves the current skin of the supplied userId from Xenos. The result includes the moment when the data was fetched from the Mojang API, to that stale data can be identified. If the player cannot be found, null will be returned. The texture is guaranteed to be present within the memory and therefore easily accessible.

Link copied to clipboard
open suspend override fun getUuid(name: String): UuidInfo?

Retrieves the UUID for the supplied name from Xenos. The result includes the moment when the data was fetched from the Mojang API, so that stale data can be identified. If the player cannot be found, null will be returned. The username does not have to be in the correct case and the canonical name will be returned within the result.

Link copied to clipboard
open suspend override fun getUuids(names: Collection<String>): Map<String, UuidInfo>

Retrieves the UUIDs of the supplied names from Xenos. Duplicates are filtered from the result and names that could not be found are discarded from the result. Each result includes the moment when the data was fetched from the Mojang API, so that stale data can be identified. The usernames do not have to be in the correct case and the canonical names will also be returned within the result.