T
- player type for the specific platformpublic interface ViaAPI<T>
Via.getManager()
.ViaManager
,
ProtocolManager
,
ConnectionManager
,
ViaPlatform
Modifier and Type | Method and Description |
---|---|
default int |
apiVersion()
Returns an internally based API version incremented with meaningful API changes.
|
@Nullable UserConnection |
getConnection(java.util.UUID uuid)
Returns the Via injected UserConnection if present.
|
java.util.SortedSet<java.lang.Integer> |
getFullSupportedVersions()
Returns the supported protocol versions, including blocked protocols.
|
int |
getPlayerVersion(T player)
Returns the protocol version of a player.
|
int |
getPlayerVersion(java.util.UUID uuid)
Returns the protocol version of a player.
|
ServerProtocolVersion |
getServerVersion()
Returns the server's protocol version info.
|
java.util.SortedSet<java.lang.Integer> |
getSupportedVersions()
Returns the supported protocol versions.
|
java.lang.String |
getVersion()
Returns the version of the plugin.
|
boolean |
isInjected(java.util.UUID uuid)
Returns whether Via injected into this player connection.
|
LegacyViaAPI<T> |
legacyAPI()
Returns legacy api only applicable on/to legacy versions.
|
default int |
majorVersion()
Returns the major version matching
getVersion() . |
void |
sendRawPacket(T player,
io.netty.buffer.ByteBuf packet)
Sends a raw packet to the player.
|
void |
sendRawPacket(java.util.UUID uuid,
io.netty.buffer.ByteBuf packet)
Sends a raw packet to the player.
|
default int majorVersion()
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.default int apiVersion()
ServerProtocolVersion getServerVersion()
int getPlayerVersion(T player)
player
- the platform's player object, e.g. Bukkit this is Playerint getPlayerVersion(java.util.UUID uuid)
uuid
- UUID of a playerboolean isInjected(java.util.UUID uuid)
uuid
- uuid of the player@Nullable UserConnection getConnection(java.util.UUID uuid)
uuid
- uuid of the playerjava.lang.String getVersion()
void sendRawPacket(T player, io.netty.buffer.ByteBuf packet)
player
- the platform's player object, e.g. for Bukkit this is Playerpacket
- the packet; you need a VarInt Id, then the packet contentsjava.lang.IllegalArgumentException
- if the player is not injected by Viavoid sendRawPacket(java.util.UUID uuid, io.netty.buffer.ByteBuf packet)
uuid
- the uuid from the player to send packetpacket
- the packet; you need a VarInt Id, then the packet contentsjava.lang.IllegalArgumentException
- if the player is not injected by Viajava.util.SortedSet<java.lang.Integer> getSupportedVersions()
for a full list
java.util.SortedSet<java.lang.Integer> getFullSupportedVersions()
LegacyViaAPI<T> legacyAPI()
These methods are safe to use and are unlikely to be removed, but it is important to be aware of their limited use.