mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-21 11:55:15 +01:00
Merge remote-tracking branch 'origin/update/1.20.5'
This commit is contained in:
commit
72d6e4a188
@ -60,14 +60,14 @@ dependencies {
|
||||
implementation(kotlin("stdlib-jdk8"))
|
||||
implementation(kotlin("reflect"))
|
||||
|
||||
val vvVer = "4.10.0-24w09a-SNAPSHOT"
|
||||
val vbVer = "4.10.0-24w09a-SNAPSHOT"
|
||||
val vrVer = "3.0.6-24w07a-SNAPSHOT"
|
||||
implementation("com.viaversion:viaversion:$vvVer") { isTransitive = false }
|
||||
implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false }
|
||||
implementation("com.viaversion:viarewind-universal:$vrVer") { isTransitive = false }
|
||||
implementation("net.raphimc:ViaAprilFools:2.0.11-SNAPSHOT")
|
||||
implementation("net.raphimc:ViaLegacy:2.2.22-SNAPSHOT")
|
||||
val vvVer = "4.10.1-SNAPSHOT"
|
||||
val vbVer = "4.10.1-SNAPSHOT"
|
||||
val vrVer = "3.1.1-SNAPSHOT"
|
||||
implementation("com.viaversion:viaversion-common:$vvVer") { isTransitive = false }
|
||||
implementation("com.viaversion:viabackwards-common:$vbVer") { isTransitive = false }
|
||||
implementation("com.viaversion:viarewind-common:$vrVer") { isTransitive = false }
|
||||
implementation("net.raphimc:ViaAprilFools:2.0.12-SNAPSHOT")
|
||||
implementation("net.raphimc:ViaLegacy:2.2.23-SNAPSHOT")
|
||||
|
||||
val nettyVer = "4.1.107.Final"
|
||||
implementation("io.netty:netty-handler-proxy:$nettyVer")
|
||||
|
@ -0,0 +1,41 @@
|
||||
package com.viaversion.aas.codec.packet.configuration;
|
||||
|
||||
import com.viaversion.aas.codec.packet.Packet;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ConfigurationTransfer implements Packet {
|
||||
|
||||
private String host;
|
||||
private int port;
|
||||
|
||||
@Override
|
||||
public void decode(@NotNull ByteBuf byteBuf, ProtocolVersion protocolVersion) throws Exception {
|
||||
host = Type.STRING.read(byteBuf);
|
||||
port = Type.VAR_INT.readPrimitive(byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(@NotNull ByteBuf byteBuf, ProtocolVersion protocolVersion) throws Exception {
|
||||
Type.STRING.write(byteBuf, host);
|
||||
Type.VAR_INT.writePrimitive(byteBuf, port);
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.viaversion.aas.codec.packet.handshake;
|
||||
|
||||
import com.viaversion.aas.codec.packet.Packet;
|
||||
import com.viaversion.aas.util.IntendedState;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
@ -12,13 +13,18 @@ public class Handshake implements Packet {
|
||||
private String address;
|
||||
private int port;
|
||||
private State nextState;
|
||||
private IntendedState intendedState;
|
||||
|
||||
@Override
|
||||
public void decode(@NotNull ByteBuf byteBuf, ProtocolVersion protocolVersion) throws Exception {
|
||||
protocolId = Type.VAR_INT.readPrimitive(byteBuf);
|
||||
address = Type.STRING.read(byteBuf);
|
||||
port = byteBuf.readUnsignedShort();
|
||||
nextState = State.values()[Type.VAR_INT.readPrimitive(byteBuf)];
|
||||
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
intendedState = IntendedState.values()[Type.VAR_INT.readPrimitive(byteBuf) - 1];
|
||||
} else {
|
||||
nextState = State.values()[Type.VAR_INT.readPrimitive(byteBuf)];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -26,7 +32,11 @@ public class Handshake implements Packet {
|
||||
Type.VAR_INT.writePrimitive(byteBuf, protocolId);
|
||||
Type.STRING.write(byteBuf, address);
|
||||
byteBuf.writeShort(port);
|
||||
byteBuf.writeByte(nextState.ordinal()); // var int is too small, fits in a byte
|
||||
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
Type.VAR_INT.writePrimitive(byteBuf, intendedState.ordinal() + 1);
|
||||
} else {
|
||||
byteBuf.writeByte(nextState.ordinal()); // var int is too small, fits in a byte
|
||||
}
|
||||
}
|
||||
|
||||
public int getProtocolId() {
|
||||
@ -60,4 +70,12 @@ public class Handshake implements Packet {
|
||||
public void setNextState(State nextState) {
|
||||
this.nextState = nextState;
|
||||
}
|
||||
|
||||
public IntendedState getIntendedState() {
|
||||
return intendedState;
|
||||
}
|
||||
|
||||
public void setIntendedState(IntendedState intendedState) {
|
||||
this.intendedState = intendedState;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public class CryptoRequest implements Packet {
|
||||
private String serverId;
|
||||
private PublicKey publicKey;
|
||||
private byte[] nonce;
|
||||
private boolean authenticate;
|
||||
|
||||
@Override
|
||||
public void decode(@NotNull ByteBuf byteBuf, ProtocolVersion protocolVersion) throws Exception {
|
||||
@ -30,6 +31,9 @@ public class CryptoRequest implements Packet {
|
||||
.generatePublic(new X509EncodedKeySpec(UtilKt.readByteArray(byteBuf, byteBuf.readUnsignedShort())));
|
||||
nonce = UtilKt.readByteArray(byteBuf, byteBuf.readUnsignedShort());
|
||||
}
|
||||
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
authenticate = byteBuf.readBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,6 +51,9 @@ public class CryptoRequest implements Packet {
|
||||
byteBuf.writeShort(nonce.length);
|
||||
byteBuf.writeBytes(nonce);
|
||||
}
|
||||
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
byteBuf.writeBoolean(authenticate);
|
||||
}
|
||||
}
|
||||
|
||||
public String getServerId() {
|
||||
@ -72,4 +79,12 @@ public class CryptoRequest implements Packet {
|
||||
public void setNonce(byte[] nonce) {
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
public boolean isAuthenticate() {
|
||||
return authenticate;
|
||||
}
|
||||
|
||||
public void setAuthenticate(boolean authenticate) {
|
||||
this.authenticate = authenticate;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.viaversion.aas.platform;
|
||||
|
||||
import com.viaversion.aas.provider.AspirinCompressionProvider;
|
||||
import com.viaversion.aas.provider.AspirinEncryptionProvider;
|
||||
import com.viaversion.aas.provider.AspirinProfileProvider;
|
||||
import com.viaversion.aas.provider.AspirinVersionProvider;
|
||||
import com.viaversion.aas.provider.*;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.TransferProvider;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
|
||||
import com.viaversion.viaversion.api.protocol.version.VersionProvider;
|
||||
@ -17,6 +15,9 @@ public class AspirinLoader implements ViaPlatformLoader {
|
||||
Via.getManager().getProviders().use(VersionProvider.class, new AspirinVersionProvider());
|
||||
Via.getManager().getProviders().use(CompressionProvider.class, new AspirinCompressionProvider());
|
||||
|
||||
//ViaBackwards
|
||||
Via.getManager().getProviders().use(TransferProvider.class, new AspirinTransferProvider());
|
||||
|
||||
//ViaLegacy
|
||||
Via.getManager().getProviders().use(GameProfileFetcher.class, new AspirinProfileProvider());
|
||||
Via.getManager().getProviders().use(EncryptionProvider.class, new AspirinEncryptionProvider());
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.viaversion.aas.provider;
|
||||
|
||||
import com.viaversion.viabackwards.protocol.protocol1_20_3to1_20_5.provider.TransferProvider;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
|
||||
public class AspirinTransferProvider implements TransferProvider {
|
||||
|
||||
@Override
|
||||
public void connectToServer(UserConnection userConnection, String s, int i) {
|
||||
}
|
||||
}
|
20
src/main/java/com/viaversion/aas/util/IntendedState.java
Normal file
20
src/main/java/com/viaversion/aas/util/IntendedState.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.viaversion.aas.util;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
|
||||
public enum IntendedState {
|
||||
|
||||
STATUS(State.STATUS),
|
||||
LOGIN(State.LOGIN),
|
||||
TRANSFER(State.LOGIN);
|
||||
|
||||
private final State state;
|
||||
|
||||
IntendedState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import com.viaversion.aas.web.ViaWebApp
|
||||
import com.viaversion.viaversion.api.Via
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
|
||||
import com.viaversion.viaversion.api.protocol.version.VersionType
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.Protocol1_20_5To1_20_3
|
||||
import io.ktor.server.application.*
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
@ -67,6 +68,7 @@ private fun initVia() {
|
||||
Via.getManager().configurationProvider.register(VIAaaSConfig)
|
||||
}
|
||||
|
||||
Protocol1_20_5To1_20_3.strictErrorHandling = false
|
||||
ProtocolVersion.register(AUTO)
|
||||
registerAspirinProtocols()
|
||||
}
|
||||
|
@ -3,10 +3,7 @@ package com.viaversion.aas.codec.packet
|
||||
import com.google.common.collect.Range
|
||||
import com.google.common.collect.RangeMap
|
||||
import com.google.common.collect.TreeRangeMap
|
||||
import com.viaversion.aas.codec.packet.configuration.ConfigurationDisconnect
|
||||
import com.viaversion.aas.codec.packet.configuration.ConfigurationKeepAlive
|
||||
import com.viaversion.aas.codec.packet.configuration.ConfigurationPluginMessage
|
||||
import com.viaversion.aas.codec.packet.configuration.FinishConfig
|
||||
import com.viaversion.aas.codec.packet.configuration.*
|
||||
import com.viaversion.aas.codec.packet.handshake.Handshake
|
||||
import com.viaversion.aas.codec.packet.login.*
|
||||
import com.viaversion.aas.codec.packet.play.*
|
||||
@ -32,8 +29,14 @@ import com.viaversion.viaversion.protocols.protocol1_19_3to1_19_1.ClientboundPac
|
||||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4
|
||||
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_20_2to1_20.packet.ClientboundConfigurationPackets1_20_2
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundConfigurationPackets1_20_2
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundConfigurationPackets1_20_5
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundConfigurationPackets1_20_5
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5
|
||||
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8
|
||||
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9
|
||||
import io.netty.buffer.ByteBuf
|
||||
@ -68,13 +71,37 @@ object PacketRegistry {
|
||||
register(State.STATUS, Direction.CLIENTBOUND, ::StatusResponse, Range.all(), 0)
|
||||
register(State.STATUS, Direction.CLIENTBOUND, ::StatusPong, Range.all(), 1)
|
||||
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::ConfigurationPluginMessage, Range.all(), 0)
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::ConfigurationDisconnect, Range.all(), 1)
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::FinishConfig, Range.all(), 2)
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::ConfigurationKeepAlive, Range.all(), 3)
|
||||
register(State.CONFIGURATION, Direction.SERVERBOUND, ::ConfigurationPluginMessage, Range.all(), 1)
|
||||
register(State.CONFIGURATION, Direction.SERVERBOUND, ::FinishConfig, Range.all(), 2)
|
||||
register(State.CONFIGURATION, Direction.SERVERBOUND, ::ConfigurationKeepAlive, Range.all(), 3)
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::ConfigurationPluginMessage, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundConfigurationPackets1_20_2.CUSTOM_PAYLOAD.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ClientboundConfigurationPackets1_20_5.CUSTOM_PAYLOAD.id
|
||||
))
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::ConfigurationDisconnect, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundConfigurationPackets1_20_2.DISCONNECT.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ClientboundConfigurationPackets1_20_5.DISCONNECT.id
|
||||
))
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::FinishConfig, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundConfigurationPackets1_20_2.FINISH_CONFIGURATION.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION.id
|
||||
))
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::ConfigurationKeepAlive, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundConfigurationPackets1_20_2.KEEP_ALIVE.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ClientboundConfigurationPackets1_20_5.KEEP_ALIVE.id
|
||||
))
|
||||
register(State.CONFIGURATION, Direction.CLIENTBOUND, ::ConfigurationTransfer, Range.atLeast(ProtocolVersion.v1_20_5),
|
||||
ClientboundConfigurationPackets1_20_5.TRANSFER.id)
|
||||
|
||||
register(State.CONFIGURATION, Direction.SERVERBOUND, ::ConfigurationPluginMessage, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ServerboundConfigurationPackets1_20_2.CUSTOM_PAYLOAD.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ServerboundConfigurationPackets1_20_5.CUSTOM_PAYLOAD.id
|
||||
))
|
||||
register(State.CONFIGURATION, Direction.SERVERBOUND, ::FinishConfig, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ServerboundConfigurationPackets1_20_2.FINISH_CONFIGURATION.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ServerboundConfigurationPackets1_20_5.FINISH_CONFIGURATION.id
|
||||
))
|
||||
register(State.CONFIGURATION, Direction.SERVERBOUND, ::ConfigurationKeepAlive, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ServerboundConfigurationPackets1_20_2.KEEP_ALIVE.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ServerboundConfigurationPackets1_20_5.KEEP_ALIVE.id
|
||||
))
|
||||
|
||||
register(
|
||||
State.PLAY, Direction.CLIENTBOUND, ::Kick, mapOf(
|
||||
@ -91,7 +118,8 @@ object PacketRegistry {
|
||||
ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.DISCONNECT.id,
|
||||
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.DISCONNECT.id,
|
||||
ProtocolVersion.v1_19_4..ProtocolVersion.v1_20 to ClientboundPackets1_19_4.DISCONNECT.id,
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundPackets1_20_2.DISCONNECT.id
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundPackets1_20_2.DISCONNECT.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ClientboundPackets1_20_5.DISCONNECT.id
|
||||
)
|
||||
)
|
||||
register(
|
||||
@ -109,7 +137,8 @@ object PacketRegistry {
|
||||
ProtocolVersion.v1_19_1.singleton to ClientboundPackets1_19_1.PLUGIN_MESSAGE.id,
|
||||
ProtocolVersion.v1_19_3.singleton to ClientboundPackets1_19_3.PLUGIN_MESSAGE.id,
|
||||
ProtocolVersion.v1_19_4..ProtocolVersion.v1_20 to ClientboundPackets1_19_4.PLUGIN_MESSAGE.id,
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundPackets1_20_2.PLUGIN_MESSAGE.id
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ClientboundPackets1_20_2.PLUGIN_MESSAGE.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ClientboundPackets1_20_5.PLUGIN_MESSAGE.id
|
||||
)
|
||||
)
|
||||
register(
|
||||
@ -118,7 +147,8 @@ object PacketRegistry {
|
||||
)
|
||||
register(
|
||||
State.PLAY, Direction.SERVERBOUND, ::ConfigurationAck, mapOf(
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ServerboundPackets1_20_2.CONFIGURATION_ACKNOWLEDGED.id
|
||||
ProtocolVersion.v1_20_2..ProtocolVersion.v1_20_3 to ServerboundPackets1_20_2.CONFIGURATION_ACKNOWLEDGED.id,
|
||||
ProtocolVersion.v1_20_5.singleton to ServerboundPackets1_20_5.CONFIGURATION_ACKNOWLEDGED.id
|
||||
)
|
||||
)
|
||||
// todo update this to latest version
|
||||
|
@ -13,6 +13,7 @@ class LoginSuccess : Packet {
|
||||
lateinit var id: UUID
|
||||
lateinit var username: String
|
||||
private val properties = mutableListOf<SignableProperty>()
|
||||
private var strictErrorHandling: Boolean = false
|
||||
|
||||
override fun decode(byteBuf: ByteBuf, protocolVersion: ProtocolVersion) {
|
||||
id = when {
|
||||
@ -34,6 +35,9 @@ class LoginSuccess : Packet {
|
||||
this.properties.add(SignableProperty(name, value, signature))
|
||||
}
|
||||
}
|
||||
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
strictErrorHandling = byteBuf.readBoolean()
|
||||
}
|
||||
}
|
||||
|
||||
override fun encode(byteBuf: ByteBuf, protocolVersion: ProtocolVersion) {
|
||||
@ -55,5 +59,8 @@ class LoginSuccess : Packet {
|
||||
Type.OPTIONAL_STRING.write(byteBuf, property.signature)
|
||||
}
|
||||
}
|
||||
if (protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5)) {
|
||||
byteBuf.writeBoolean(strictErrorHandling)
|
||||
}
|
||||
}
|
||||
}
|
@ -125,7 +125,7 @@ frame-src 'self' https://login.microsoftonline.com/ https://login.live.com/"
|
||||
</div>
|
||||
<datalist id="backend_version_list">
|
||||
<option>AUTO</option>
|
||||
<option>1.20.5</option>
|
||||
<option value="1.20.5">1.20.5/6</option>
|
||||
<option value="1.20.4">1.20.3/4</option>
|
||||
<option>1.20.2</option>
|
||||
<option value="1.20.1">1.20(.1)</option>
|
||||
|
Loading…
Reference in New Issue
Block a user