update deps

This commit is contained in:
creeper123123321 2022-12-07 15:22:46 -03:00
parent 330b27b3e2
commit 1178c369c2
6 changed files with 35 additions and 20 deletions

View File

@ -59,8 +59,8 @@ dependencies {
implementation(kotlin("stdlib-jdk8")) implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect")) implementation(kotlin("reflect"))
val vvVer = "4.4.3-SNAPSHOT" val vvVer = "4.5.0"
val vbVer = "4.4.3-SNAPSHOT" val vbVer = "4.5.0"
val vrVer = "9e4ac93" val vrVer = "9e4ac93"
implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false } implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false }
implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false } implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false }
@ -83,7 +83,7 @@ dependencies {
implementation("org.yaml:snakeyaml:1.33") implementation("org.yaml:snakeyaml:1.33")
val log4jVer = "2.19.0" val log4jVer = "2.19.0"
val slf4jVer = "2.0.4" val slf4jVer = "2.0.5"
implementation("com.lmax:disruptor:3.4.4") implementation("com.lmax:disruptor:3.4.4")
implementation("net.minecrell:terminalconsoleappender:1.3.0") implementation("net.minecrell:terminalconsoleappender:1.3.0")
implementation("org.apache.logging.log4j:log4j-core:$log4jVer") implementation("org.apache.logging.log4j:log4j-core:$log4jVer")

View File

@ -42,7 +42,8 @@ public class LoginStart implements Packet {
@Override @Override
public void decode(@NotNull ByteBuf byteBuf, int protocolVersion) throws Exception { public void decode(@NotNull ByteBuf byteBuf, int protocolVersion) throws Exception {
username = new StringType(16).read(byteBuf); username = new StringType(16).read(byteBuf);
if (protocolVersion >= ProtocolVersion.v1_19.getVersion()) { if (protocolVersion >= ProtocolVersion.v1_19.getVersion()
&& protocolVersion < ProtocolVersion.v1_19_3.getVersion()) {
profileKey = Type.OPTIONAL_PROFILE_KEY.read(byteBuf); profileKey = Type.OPTIONAL_PROFILE_KEY.read(byteBuf);
} }
@ -54,7 +55,8 @@ public class LoginStart implements Packet {
@Override @Override
public void encode(@NotNull ByteBuf byteBuf, int protocolVersion) throws Exception { public void encode(@NotNull ByteBuf byteBuf, int protocolVersion) throws Exception {
Type.STRING.write(byteBuf, username); Type.STRING.write(byteBuf, username);
if (protocolVersion >= ProtocolVersion.v1_19.getVersion()) { if (protocolVersion >= ProtocolVersion.v1_19.getVersion()
&& protocolVersion < ProtocolVersion.v1_19_3.getVersion()) {
Type.OPTIONAL_PROFILE_KEY.write(byteBuf, profileKey); Type.OPTIONAL_PROFILE_KEY.write(byteBuf, profileKey);
} }
if (protocolVersion >= ProtocolVersion.v1_19_1.getVersion()) { if (protocolVersion >= ProtocolVersion.v1_19_1.getVersion()) {

View File

@ -29,6 +29,7 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPacke
import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18 import com.viaversion.viaversion.protocols.protocol1_18to1_17_1.ClientboundPackets1_18
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1 import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ClientboundPackets1_19_1
import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ServerboundPackets1_19_1 import com.viaversion.viaversion.protocols.protocol1_19_1to1_19.ServerboundPackets1_19_1
import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPackets1_19_3
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19 import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19 import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ServerboundPackets1_19
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8 import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8
@ -87,7 +88,8 @@ object PacketRegistry {
ProtocolVersion.v1_17..ProtocolVersion.v1_17_1 to ClientboundPackets1_17.DISCONNECT.id, ProtocolVersion.v1_17..ProtocolVersion.v1_17_1 to ClientboundPackets1_17.DISCONNECT.id,
ProtocolVersion.v1_18..ProtocolVersion.v1_18_2 to ClientboundPackets1_18.DISCONNECT.id, ProtocolVersion.v1_18..ProtocolVersion.v1_18_2 to ClientboundPackets1_18.DISCONNECT.id,
ProtocolVersion.v1_19.singleton to ClientboundPackets1_19.DISCONNECT.id, ProtocolVersion.v1_19.singleton to ClientboundPackets1_19.DISCONNECT.id,
ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.DISCONNECT.id ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.DISCONNECT.id,
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.DISCONNECT.id
) )
) )
register( register(
@ -102,7 +104,8 @@ object PacketRegistry {
ProtocolVersion.v1_17..ProtocolVersion.v1_17_1 to ClientboundPackets1_17.PLUGIN_MESSAGE.id, ProtocolVersion.v1_17..ProtocolVersion.v1_17_1 to ClientboundPackets1_17.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_18..ProtocolVersion.v1_18_2 to ClientboundPackets1_18.PLUGIN_MESSAGE.id, ProtocolVersion.v1_18..ProtocolVersion.v1_18_2 to ClientboundPackets1_18.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_19.singleton to ClientboundPackets1_19.PLUGIN_MESSAGE.id, ProtocolVersion.v1_19.singleton to ClientboundPackets1_19.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.PLUGIN_MESSAGE.id ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.PLUGIN_MESSAGE.id,
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.PLUGIN_MESSAGE.id
) )
) )
register( register(
@ -112,6 +115,7 @@ object PacketRegistry {
ProtocolVersion.v1_8.singleton, ProtocolVersion.v1_8.singleton,
ClientboundPackets1_8.SET_COMPRESSION.id ClientboundPackets1_8.SET_COMPRESSION.id
) )
// todo update this to 1.19.3
register( register(
State.PLAY, Direction.SERVERBOUND, ::ServerboundChatCommand, State.PLAY, Direction.SERVERBOUND, ::ServerboundChatCommand,
mapOf( mapOf(
@ -132,7 +136,7 @@ object PacketRegistry {
return Range.closed(this.originalVersion, o.originalVersion) return Range.closed(this.originalVersion, o.originalVersion)
} }
val ProtocolVersion.singleton get() = Range.singleton(this.originalVersion) private val ProtocolVersion.singleton get() = Range.singleton(this.originalVersion)
inline fun <reified P : Packet> register( inline fun <reified P : Packet> register(
state: State, state: State,
@ -175,17 +179,17 @@ object PacketRegistry {
data class DecodingInfo(val constructor: Supplier<out Packet>) data class DecodingInfo(val constructor: Supplier<out Packet>)
data class EncodingInfo(val packetId: Int) data class EncodingInfo(val packetId: Int)
fun getPacketConstructor( private fun getPacketConstructor(
protocolVersion: Int, protocolVersion: Int,
state: State, state: State,
id: Int, id: Int,
direction: Direction direction: Direction
): Supplier<out Packet>? { ): Supplier<out Packet>? {
return entriesDecoding.get(Triple(state, direction, id))?.get(protocolVersion)?.constructor return entriesDecoding[Triple(state, direction, id)]?.get(protocolVersion)?.constructor
} }
fun getPacketId(packetClass: Class<out Packet>, protocolVersion: Int, direction: Direction): Int? { private fun getPacketId(packetClass: Class<out Packet>, protocolVersion: Int, direction: Direction): Int? {
return entriesEncoding.get(direction to packetClass)?.get(protocolVersion)?.packetId return entriesEncoding[direction to packetClass]?.get(protocolVersion)?.packetId
} }
fun decode(byteBuf: ByteBuf, protocolVersion: Int, state: State, direction: Direction): Packet { fun decode(byteBuf: ByteBuf, protocolVersion: Int, state: State, direction: Direction): Packet {

View File

@ -1,6 +1,7 @@
package com.viaversion.aas.codec.packet.login package com.viaversion.aas.codec.packet.login
import com.viaversion.aas.codec.packet.Packet import com.viaversion.aas.codec.packet.Packet
import com.viaversion.aas.protocol.sharewareVersion
import com.viaversion.aas.readByteArray import com.viaversion.aas.readByteArray
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
@ -16,7 +17,7 @@ class CryptoRequest : Packet {
override fun decode(byteBuf: ByteBuf, protocolVersion: Int) { override fun decode(byteBuf: ByteBuf, protocolVersion: Int) {
serverId = Type.STRING.read(byteBuf) serverId = Type.STRING.read(byteBuf)
if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1) { if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == sharewareVersion.version) {
publicKey = KeyFactory.getInstance("RSA") publicKey = KeyFactory.getInstance("RSA")
.generatePublic(X509EncodedKeySpec(Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf))) .generatePublic(X509EncodedKeySpec(Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)))
nonce = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf) nonce = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
@ -29,7 +30,7 @@ class CryptoRequest : Packet {
override fun encode(byteBuf: ByteBuf, protocolVersion: Int) { override fun encode(byteBuf: ByteBuf, protocolVersion: Int) {
Type.STRING.write(byteBuf, serverId) Type.STRING.write(byteBuf, serverId)
if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1) { if (protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == sharewareVersion.version) {
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, publicKey.encoded) Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, publicKey.encoded)
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, nonce) Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, nonce)
} else { } else {

View File

@ -1,6 +1,7 @@
package com.viaversion.aas.codec.packet.login package com.viaversion.aas.codec.packet.login
import com.viaversion.aas.codec.packet.Packet import com.viaversion.aas.codec.packet.Packet
import com.viaversion.aas.protocol.sharewareVersion
import com.viaversion.aas.readByteArray import com.viaversion.aas.readByteArray
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
@ -14,7 +15,8 @@ class CryptoResponse : Packet {
override fun decode(byteBuf: ByteBuf, protocolVersion: Int) { override fun decode(byteBuf: ByteBuf, protocolVersion: Int) {
when { when {
protocolVersion >= ProtocolVersion.v1_19.version -> { protocolVersion >= ProtocolVersion.v1_19.version
&& protocolVersion < ProtocolVersion.v1_19_3.version -> {
encryptedKey = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf) encryptedKey = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
if (byteBuf.readBoolean()) { if (byteBuf.readBoolean()) {
encryptedNonce = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf) encryptedNonce = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
@ -23,10 +25,12 @@ class CryptoResponse : Packet {
signature = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf) signature = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
} }
} }
protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1 -> {
protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == sharewareVersion.version -> {
encryptedKey = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf) encryptedKey = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
encryptedNonce = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf) encryptedNonce = Type.BYTE_ARRAY_PRIMITIVE.read(byteBuf)
} }
else -> { else -> {
encryptedKey = byteBuf.readByteArray(byteBuf.readUnsignedShort()) encryptedKey = byteBuf.readByteArray(byteBuf.readUnsignedShort())
encryptedNonce = byteBuf.readByteArray(byteBuf.readUnsignedShort()) encryptedNonce = byteBuf.readByteArray(byteBuf.readUnsignedShort())
@ -36,7 +40,8 @@ class CryptoResponse : Packet {
override fun encode(byteBuf: ByteBuf, protocolVersion: Int) { override fun encode(byteBuf: ByteBuf, protocolVersion: Int) {
when { when {
protocolVersion >= ProtocolVersion.v1_19.version -> { protocolVersion >= ProtocolVersion.v1_19.version
&& protocolVersion < ProtocolVersion.v1_19_3.version -> {
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedKey) Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedKey)
if (encryptedNonce != null) { if (encryptedNonce != null) {
byteBuf.writeBoolean(true) byteBuf.writeBoolean(true)
@ -47,10 +52,12 @@ class CryptoResponse : Packet {
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, signature) Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, signature)
} }
} }
protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == 1 -> {
protocolVersion >= ProtocolVersion.v1_8.version || protocolVersion == sharewareVersion.version -> {
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedKey) Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedKey)
Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedNonce) Type.BYTE_ARRAY_PRIMITIVE.write(byteBuf, encryptedNonce)
} }
else -> { else -> {
byteBuf.writeShort(encryptedKey.size) byteBuf.writeShort(encryptedKey.size)
byteBuf.writeBytes(encryptedKey) byteBuf.writeBytes(encryptedKey)

View File

@ -2,6 +2,7 @@ package com.viaversion.aas.codec.packet.login
import com.viaversion.aas.codec.packet.Packet import com.viaversion.aas.codec.packet.Packet
import com.viaversion.aas.parseUndashedId import com.viaversion.aas.parseUndashedId
import com.viaversion.aas.protocol.sharewareVersion
import com.viaversion.aas.type.AspirinTypes import com.viaversion.aas.type.AspirinTypes
import com.viaversion.aas.util.SignableProperty import com.viaversion.aas.util.SignableProperty
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
@ -19,7 +20,7 @@ class LoginSuccess : Packet {
protocolVersion >= ProtocolVersion.v1_16.version -> { protocolVersion >= ProtocolVersion.v1_16.version -> {
Type.UUID.read(byteBuf) Type.UUID.read(byteBuf)
} }
protocolVersion >= ProtocolVersion.v1_7_6.version || protocolVersion == 1 -> { protocolVersion >= ProtocolVersion.v1_7_6.version || protocolVersion == sharewareVersion.version -> {
UUID.fromString(Type.STRING.read(byteBuf)) UUID.fromString(Type.STRING.read(byteBuf))
} }
else -> parseUndashedId(Type.STRING.read(byteBuf)) else -> parseUndashedId(Type.STRING.read(byteBuf))
@ -35,7 +36,7 @@ class LoginSuccess : Packet {
protocolVersion >= ProtocolVersion.v1_16.version -> { protocolVersion >= ProtocolVersion.v1_16.version -> {
Type.UUID.write(byteBuf, id) Type.UUID.write(byteBuf, id)
} }
protocolVersion >= ProtocolVersion.v1_7_6.version || protocolVersion == 1 -> { protocolVersion >= ProtocolVersion.v1_7_6.version || protocolVersion == sharewareVersion.version -> {
Type.STRING.write(byteBuf, id.toString()) Type.STRING.write(byteBuf, id.toString())
} }
else -> Type.STRING.write(byteBuf, id.toString().replace("-", "")) else -> Type.STRING.write(byteBuf, id.toString().replace("-", ""))