cleanup, clean PacketRegistry

This commit is contained in:
creeper123123321 2021-05-04 17:15:06 -03:00
parent ccfed4f20c
commit 60a63ec9f1
61 changed files with 447 additions and 353 deletions

View File

@ -10,52 +10,70 @@ Discord: https://viaversion.com/discord
Supported versions: https://viaversion.com/ Supported versions: https://viaversion.com/
## How does it work? ## How does it work?
- [ViaVersion](https://viaversion.com), [ViaBackwards](https://viaversion.com/backwards) and [ViaRewind](https://viaversion.com/rewind) translates the connections to backend server.
- VIAaaS auth page stores account credentials in the player's browser local storage. Check for XSS vulnerabilities on your domain. - [ViaVersion](https://viaversion.com), [ViaBackwards](https://viaversion.com/backwards)
- Due to technical/security reasons, it requires a CORS Proxy for calling Mojang APIs, which may make Mojang see that and [ViaRewind](https://viaversion.com/rewind) translates the connections to backend server.
as suspicious and reset/block your account password if the IP address seems suspect. - VIAaaS auth page stores account credentials in the player's browser local storage. Check for XSS vulnerabilities on
your domain.
- Due to technical/security reasons, it requires a CORS Proxy for calling Mojang APIs, which may make Mojang see that as
suspicious and reset/block your account password if the IP address seems suspect.
- Account credentials aren't sent to VIAaaS instance, though it's intermediated by CORS Proxy. - Account credentials aren't sent to VIAaaS instance, though it's intermediated by CORS Proxy.
- VIAaaS receives a the session hash from instance and then the browser validates it to Mojang. - VIAaaS receives a the session hash from instance and then the browser validates it to Mojang.
## Setting up server instance ## Setting up server instance
Download: [GitHub Actions](https://github.com/ViaVersion/VIAaaS/actions) (needs to be logged into GitHub) or [JitPack](https://jitpack.io/com/github/viaversion/viaaas/master-SNAPSHOT/viaaas-master-SNAPSHOT-all.jar)
Download: [GitHub Actions](https://github.com/ViaVersion/VIAaaS/actions) (needs to be logged into GitHub)
or [JitPack](https://jitpack.io/com/github/viaversion/viaaas/master-SNAPSHOT/viaaas-master-SNAPSHOT-all.jar)
How to start VIAaaS server: How to start VIAaaS server:
```sh ```sh
java -jar VIAaaS-all.jar java -jar VIAaaS-all.jar
``` ```
- Requires Java 11 - Requires Java 11
- Default Minecraft: ```via.localhost``` with port 25565 - Default Minecraft: ```via.localhost``` with port 25565
- Default HTTPS: ```https://localhost:25543/``` - Default HTTPS: ```https://localhost:25543/```
- Default WS URL: ```wss://localhost:25543/ws``` - Default WS URL: ```wss://localhost:25543/ws```
### How to create a public server ### How to create a public server
- You need a domain wildcarding to VIAaaS instance, like ``*.example.com -> 192.168.123.123``. You can use [DuckDNS](https://duckdns.org/) DDNS service.
- You need a domain wildcarding to VIAaaS instance, like ``*.example.com -> 192.168.123.123``. You can
use [DuckDNS](https://duckdns.org/) DDNS service.
- Configure the hostname in the config - Configure the hostname in the config
- Open the Minecraft port (25565) - Open the Minecraft port (25565)
- The HTTPS page needs a certificate, you can use [Apache](https://httpd.apache.org/) (with a [Let's Encrypt](https://letsencrypt.org/) certificate) as a proxy. See apache_copypasta.txt file. - The HTTPS page needs a certificate, you can use [Apache](https://httpd.apache.org/) (with
a [Let's Encrypt](https://letsencrypt.org/) certificate) as a proxy. See apache_copypasta.txt file.
## CORS Proxy ## CORS Proxy
- For less chance of Mojang seeing the login as suspect, you (the player) should set up a CORS proxy on your machine. - For less chance of Mojang seeing the login as suspect, you (the player) should set up a CORS proxy on your machine.
- Note the ending slash in cors-anywhere address - Note the ending slash in cors-anywhere address
- You can use my public instance at https://crp123-cors.herokuapp.com/ ([source](https://github.com/creeper123123321/cors-anywhere/)) too, - You can use my public instance
but proxies have a bit more chance of being seen as suspect. at https://crp123-cors.herokuapp.com/ ([source](https://github.com/creeper123123321/cors-anywhere/)) too, but proxies
have a bit more chance of being seen as suspect.
Setting up [cors-anywhere](https://www.npmjs.com/package/cors-anywhere) on local machine: Setting up [cors-anywhere](https://www.npmjs.com/package/cors-anywhere) on local machine:
```sh ```sh
git clone https://github.com/Rob--W/cors-anywhere git clone https://github.com/Rob--W/cors-anywhere
cd cors-anywhere cd cors-anywhere
npm install npm install
node server.js node server.js
``` ```
- It will be available at ```http://localhost:8080/``` - It will be available at ```http://localhost:8080/```
## Usage for players ## Usage for players
Usage for offline mode: Usage for offline mode:
- Connect to ```mc.example.net.via.localhost``` - Connect to ```mc.example.net.via.localhost```
Usage for online mode: Usage for online mode:
- You can use two accounts (avoids Bad Login error), the same account for front-end and back-end connections, or use ```_of```
- You can use two accounts (avoids Bad Login error), the same account for front-end and back-end connections, or
use ```_of```
(offline mode in frontend. May be useful if you have a client which is incompatible with online mode). (offline mode in frontend. May be useful if you have a client which is incompatible with online mode).
- Go to VIAaaS auth webpage (default is https://localhost:25543/) - Go to VIAaaS auth webpage (default is https://localhost:25543/)
- Configure CORS proxy, see above in "CORS Proxy" section - Configure CORS proxy, see above in "CORS Proxy" section
@ -65,62 +83,83 @@ Usage for online mode:
- Connect to ```mc.example.com._u(B).via.localhost``` (```_u``` can be removed if you are using the same username) - Connect to ```mc.example.com._u(B).via.localhost``` (```_u``` can be removed if you are using the same username)
- Approve the login in the webpage - Approve the login in the webpage
- If you use the same online mode account, your client may show Bad Login. You can use a mod like - If you use the same online mode account, your client may show Bad Login. You can use a mod like
[Auth Me](https://www.curseforge.com/minecraft/mc-mods/auth-me) or [ReAuth](https://www.curseforge.com/minecraft/mc-mods/reauth). [Auth Me](https://www.curseforge.com/minecraft/mc-mods/auth-me)
or [ReAuth](https://www.curseforge.com/minecraft/mc-mods/reauth).
### Address options ### Address options
Example address: Example address:
- ```server.example.net._p25565._v1_12_2._of._uBACKUSERNAME.via.example.com``` - ```server.example.net._p25565._v1_12_2._of._uBACKUSERNAME.via.example.com```
- ```server.example.net.v_1_8.via.example.com``` - ```server.example.net.v_1_8.via.example.com```
- It's inspired by [Tor2web](https://www.tor2web.org/) proxies. - It's inspired by [Tor2web](https://www.tor2web.org/) proxies.
Address parts: Address parts:
- You can use ``(option)_(value)`` too, like ``p_25565``. - You can use ``(option)_(value)`` too, like ``p_25565``.
- ```server.example.net```: backend server address - ```server.example.net```: backend server address
- ```_p```: backend port - ```_p```: backend port
- ```_v```: backend version ([protocol id](https://wiki.vg/Protocol_version_numbers) or name with underline instead of dots). ```AUTO``` is default and ``-1`` is fallback if it fails. - ```_v```: backend version ([protocol id](https://wiki.vg/Protocol_version_numbers) or name with underline instead of
- ```_o```: ```t``` to force online mode in frontend, ```f``` to disable online mode in frontend. If not set, it will be based on backend online mode. dots). ```AUTO``` is default and ``-1`` is fallback if it fails.
- ```_o```: ```t``` to force online mode in frontend, ```f``` to disable online mode in frontend. If not set, it will be
based on backend online mode.
- ```_u```: username to use in backend connection - ```_u```: username to use in backend connection
- ```via.example.com```: instance address (defined in config) - ```via.example.com```: instance address (defined in config)
## WARNING ## WARNING
- VIAaaS may trigger anti-cheats, due to block, item, movement and other differences between versions. USE AT OWN RISK - VIAaaS may trigger anti-cheats, due to block, item, movement and other differences between versions. USE AT OWN RISK
- Take care of browser local storage. Check for XSS vulnerabilities on your domain. - Take care of browser local storage. Check for XSS vulnerabilities on your domain.
- Check the security of CORS proxy, it will intermediate Mojang API calls. - Check the security of CORS proxy, it will intermediate Mojang API calls.
- Mojang may lock your account when API is called from a suspect IP address - Mojang may lock your account when API is called from a suspect IP address
## FAQ ## FAQ
### Accounts ### Accounts
My Microsoft account <18 years old is not able to log in, it's giving XSTS error: My Microsoft account <18 years old is not able to log in, it's giving XSTS error:
- Add your account to a family (see https://wiki.vg/Microsoft_Authentication_Scheme#Authenticate_with_XSTS) - Add your account to a family (see https://wiki.vg/Microsoft_Authentication_Scheme#Authenticate_with_XSTS)
Why a online webpage for online mode?: Why a online webpage for online mode?:
- It's easier to maintain in that way, because providing login via chat requires encoding and decoding more packets which change through versions.
- It's easier to maintain in that way, because providing login via chat requires encoding and decoding more packets
which change through versions.
- It allows your account password and token to be kept with you. - It allows your account password and token to be kept with you.
How to use Microsoft Account?: How to use Microsoft Account?:
- If you are using a public VIAaaS instance, use this page https://viaversion.github.io/VIAaaS/ and configure the WebSocket address.
- If you are using a public VIAaaS instance, use this page https://viaversion.github.io/VIAaaS/ and configure the
WebSocket address.
### Connection ### Connection
How to use IPv6?: How to use IPv6?:
- When listening to 0.0.0.0, it should listen on IPv6 too. - When listening to 0.0.0.0, it should listen on IPv6 too.
- To use IPv6 in backend address, you need to use a instance with IPv6 connectivity. The hostname parser currently doesn't support - To use IPv6 in backend address, you need to use a instance with IPv6 connectivity. The hostname parser currently
direct IPv6, but you can use a DNS name with https://sslip.io/ doesn't support direct IPv6, but you can use a DNS name with https://sslip.io/
I'm getting a DNS error/"Unknown host" while connecting to (...).localhost I'm getting a DNS error/"Unknown host" while connecting to (...).localhost
- Try configuring via-127-0-0-1.nip.io as hostname suffix - Try configuring via-127-0-0-1.nip.io as hostname suffix
How to use with Geyser? How to use with Geyser?
- Currently you need to set the parameters (at least the hostname) in Geyser's `address` field: - Currently you need to set the parameters (at least the hostname) in Geyser's `address` field:
```yml ```yml
remote: remote:
# The IP address of the remote (Java Edition) server # The IP address of the remote (Java Edition) server
address: 2b2t.org._v1_12_2.via.localhost address: 2b2t.org._v1_12_2.via.localhost
``` ```
- If you are using a public GeyserConnect instance: connect to a publicly available VIAaaS instance, like ```mc.example.com.via.example.net``` as a Java Edition server. - If you are using a public GeyserConnect instance: connect to a publicly available VIAaaS instance,
like ```mc.example.com.via.example.net``` as a Java Edition server.
Can I use it to connect to .onion Minecraft hidden servers? Can I use it to connect to .onion Minecraft hidden servers?
- You can use .onion addresses if the instance is proxying the backend connections to TOR.
Note that VIAaaS may log your requests. - You can use .onion addresses if the instance is proxying the backend connections to TOR. Note that VIAaaS may log your
requests.
Can you support more versions? Can you support more versions?
- See [DirtMultiVersion](https://github.com/DirtPowered/DirtMultiversion) - See [DirtMultiVersion](https://github.com/DirtPowered/DirtMultiversion)

View File

@ -102,9 +102,11 @@ tasks {
tasks.named<ProcessResources>("processResources") { tasks.named<ProcessResources>("processResources") {
filesMatching("viaaas_info.json") { filesMatching("viaaas_info.json") {
filter<org.apache.tools.ant.filters.ReplaceTokens>("tokens" to mapOf( filter<org.apache.tools.ant.filters.ReplaceTokens>(
"tokens" to mapOf(
"version" to project.property("version") "version" to project.property("version")
)) )
)
} }
} }

View File

@ -1 +1 @@
<meta http-equiv="refresh" content="0; url=https://viaversion.github.io/VIAaaS/src/main/resources/web/"> <meta content="0; url=https://viaversion.github.io/VIAaaS/src/main/resources/web/" http-equiv="refresh">

View File

@ -7,14 +7,14 @@ import com.google.common.primitives.Ints
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.viaversion.aas.config.VIAaaSConfig import com.viaversion.aas.config.VIAaaSConfig
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import com.viaversion.viaversion.api.type.Type
import io.ktor.client.request.* import io.ktor.client.request.*
import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBuf
import io.netty.channel.Channel import io.netty.channel.Channel
import io.netty.channel.ChannelFutureListener import io.netty.channel.ChannelFutureListener
import io.netty.handler.codec.DecoderException import io.netty.handler.codec.DecoderException
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import com.viaversion.viaversion.api.type.Type
import java.math.BigInteger import java.math.BigInteger
import java.net.InetAddress import java.net.InetAddress
import java.net.InetSocketAddress import java.net.InetSocketAddress

View File

@ -1,6 +1,5 @@
package com.viaversion.aas package com.viaversion.aas
import com.google.gson.JsonObject
import com.google.gson.JsonParser import com.google.gson.JsonParser
import com.viaversion.aas.command.VIAaaSConsole import com.viaversion.aas.command.VIAaaSConsole
import com.viaversion.aas.command.ViaAspirinCommand import com.viaversion.aas.command.ViaAspirinCommand
@ -11,6 +10,10 @@ import com.viaversion.aas.platform.*
import com.viaversion.aas.protocol.registerAspirinProtocols import com.viaversion.aas.protocol.registerAspirinProtocols
import com.viaversion.aas.web.ViaWebApp import com.viaversion.aas.web.ViaWebApp
import com.viaversion.aas.web.WebDashboardServer import com.viaversion.aas.web.WebDashboardServer
import com.viaversion.viaversion.ViaManagerImpl
import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.data.MappingDataLoader
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import de.gerrygames.viarewind.api.ViaRewindConfigImpl import de.gerrygames.viarewind.api.ViaRewindConfigImpl
import io.ktor.application.* import io.ktor.application.*
import io.ktor.client.* import io.ktor.client.*
@ -37,15 +40,9 @@ import io.netty.channel.socket.nio.NioSocketChannel
import io.netty.util.concurrent.Future import io.netty.util.concurrent.Future
import org.apache.logging.log4j.Level import org.apache.logging.log4j.Level
import org.apache.logging.log4j.io.IoBuilder import org.apache.logging.log4j.io.IoBuilder
import com.viaversion.viaversion.ViaManagerImpl
import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.data.MappingDataLoader
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import java.io.File import java.io.File
import java.net.InetAddress import java.net.InetAddress
import java.security.KeyPairGenerator import java.security.KeyPairGenerator
import java.security.SecureRandom
import java.util.*
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture
val viaaasVer = JsonParser.parseString( val viaaasVer = JsonParser.parseString(

View File

@ -1,10 +1,10 @@
package com.viaversion.aas.codec package com.viaversion.aas.codec
import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBuf
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.DecoderException import io.netty.handler.codec.DecoderException
import io.netty.handler.codec.MessageToMessageCodec import io.netty.handler.codec.MessageToMessageCodec
import com.viaversion.viaversion.api.type.Type
import java.util.zip.Deflater import java.util.zip.Deflater
import java.util.zip.Inflater import java.util.zip.Inflater

View File

@ -1,11 +1,11 @@
package com.viaversion.aas.codec package com.viaversion.aas.codec
import com.viaversion.aas.badLength import com.viaversion.aas.badLength
import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.exception.CancelDecoderException
import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBuf
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.ByteToMessageCodec import io.netty.handler.codec.ByteToMessageCodec
import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.exception.CancelDecoderException
class FrameCodec : ByteToMessageCodec<ByteBuf>() { class FrameCodec : ByteToMessageCodec<ByteBuf>() {
override fun decode(ctx: ChannelHandlerContext, input: ByteBuf, out: MutableList<Any>) { override fun decode(ctx: ChannelHandlerContext, input: ByteBuf, out: MutableList<Any>) {

View File

@ -4,11 +4,12 @@ import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.packet.PacketRegistry import com.viaversion.aas.packet.PacketRegistry
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import com.viaversion.viaversion.api.protocol.packet.Direction
import com.viaversion.viaversion.exception.CancelEncoderException
import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBuf
import io.netty.buffer.ByteBufAllocator import io.netty.buffer.ByteBufAllocator
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.MessageToMessageCodec import io.netty.handler.codec.MessageToMessageCodec
import com.viaversion.viaversion.exception.CancelEncoderException
class MinecraftCodec : MessageToMessageCodec<ByteBuf, Packet>() { class MinecraftCodec : MessageToMessageCodec<ByteBuf, Packet>() {
override fun encode(ctx: ChannelHandlerContext, msg: Packet, out: MutableList<Any>) { override fun encode(ctx: ChannelHandlerContext, msg: Packet, out: MutableList<Any>) {
@ -16,7 +17,12 @@ class MinecraftCodec : MessageToMessageCodec<ByteBuf, Packet>() {
val buf = ByteBufAllocator.DEFAULT.buffer() val buf = ByteBufAllocator.DEFAULT.buffer()
try { try {
val handler = ctx.pipeline().get(MinecraftHandler::class.java) val handler = ctx.pipeline().get(MinecraftHandler::class.java)
PacketRegistry.encode(msg, buf, handler.data.frontVer!!, serverBound = !handler.frontEnd) PacketRegistry.encode(
msg,
buf,
handler.data.frontVer!!,
if (handler.frontEnd) Direction.CLIENTBOUND else Direction.SERVERBOUND
)
out.add(buf.retain()) out.add(buf.retain())
} finally { } finally {
buf.release() buf.release()
@ -30,7 +36,8 @@ class MinecraftCodec : MessageToMessageCodec<ByteBuf, Packet>() {
PacketRegistry.decode( PacketRegistry.decode(
msg, msg,
handler.data.frontVer ?: 0, handler.data.frontVer ?: 0,
handler.data.state.state, handler.frontEnd handler.data.state.state,
if (handler.frontEnd) Direction.SERVERBOUND else Direction.CLIENTBOUND
) )
) )
if (msg.isReadable) throw StacklessException("Remaining bytes!!!") if (msg.isReadable) throw StacklessException("Remaining bytes!!!")

View File

@ -2,12 +2,12 @@ package com.viaversion.aas.command
import com.viaversion.aas.command.sub.StopSubCommand import com.viaversion.aas.command.sub.StopSubCommand
import com.viaversion.aas.serverFinishing import com.viaversion.aas.serverFinishing
import com.viaversion.viaversion.api.command.ViaCommandSender
import net.minecrell.terminalconsole.SimpleTerminalConsole import net.minecrell.terminalconsole.SimpleTerminalConsole
import org.jline.reader.Candidate import org.jline.reader.Candidate
import org.jline.reader.LineReader import org.jline.reader.LineReader
import org.jline.reader.LineReaderBuilder import org.jline.reader.LineReaderBuilder
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import com.viaversion.viaversion.api.command.ViaCommandSender
import java.util.* import java.util.*
object VIAaaSConsole : SimpleTerminalConsole(), ViaCommandSender { object VIAaaSConsole : SimpleTerminalConsole(), ViaCommandSender {

View File

@ -3,11 +3,11 @@ package com.viaversion.aas.handler
import com.viaversion.aas.codec.FrameCodec import com.viaversion.aas.codec.FrameCodec
import com.viaversion.aas.codec.MinecraftCodec import com.viaversion.aas.codec.MinecraftCodec
import com.viaversion.aas.handler.autoprotocol.ProtocolDetectorHandler import com.viaversion.aas.handler.autoprotocol.ProtocolDetectorHandler
import com.viaversion.viaversion.connection.UserConnectionImpl
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl
import io.netty.channel.Channel import io.netty.channel.Channel
import io.netty.channel.ChannelInitializer import io.netty.channel.ChannelInitializer
import io.netty.handler.timeout.ReadTimeoutHandler import io.netty.handler.timeout.ReadTimeoutHandler
import com.viaversion.viaversion.connection.UserConnectionImpl
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
class BackEndInit(val connectionData: ConnectionData) : ChannelInitializer<Channel>() { class BackEndInit(val connectionData: ConnectionData) : ChannelInitializer<Channel>() {

View File

@ -3,11 +3,11 @@ package com.viaversion.aas.handler
import com.viaversion.aas.mcLogger import com.viaversion.aas.mcLogger
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.setAutoRead import com.viaversion.aas.setAutoRead
import com.viaversion.viaversion.exception.CancelCodecException
import io.netty.channel.Channel import io.netty.channel.Channel
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import io.netty.channel.SimpleChannelInboundHandler import io.netty.channel.SimpleChannelInboundHandler
import io.netty.handler.proxy.Socks5ProxyHandler import io.netty.handler.proxy.Socks5ProxyHandler
import com.viaversion.viaversion.exception.CancelCodecException
import java.net.SocketAddress import java.net.SocketAddress
import java.nio.channels.ClosedChannelException import java.nio.channels.ClosedChannelException

View File

@ -3,9 +3,9 @@ package com.viaversion.aas.handler
import com.viaversion.aas.config.VIAaaSConfig import com.viaversion.aas.config.VIAaaSConfig
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.send import com.viaversion.aas.send
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import io.netty.channel.ChannelPipeline import io.netty.channel.ChannelPipeline
import io.netty.handler.proxy.Socks5ProxyHandler import io.netty.handler.proxy.Socks5ProxyHandler
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import java.net.InetSocketAddress import java.net.InetSocketAddress
fun forward(handler: MinecraftHandler, packet: Packet, flush: Boolean = false) { fun forward(handler: MinecraftHandler, packet: Packet, flush: Boolean = false) {

View File

@ -1,11 +1,11 @@
package com.viaversion.aas.handler package com.viaversion.aas.handler
import io.netty.buffer.ByteBuf
import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.MessageToMessageCodec
import com.viaversion.viaversion.api.connection.UserConnection import com.viaversion.viaversion.api.connection.UserConnection
import com.viaversion.viaversion.exception.CancelDecoderException import com.viaversion.viaversion.exception.CancelDecoderException
import com.viaversion.viaversion.exception.CancelEncoderException import com.viaversion.viaversion.exception.CancelEncoderException
import io.netty.buffer.ByteBuf
import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.MessageToMessageCodec
class ViaCodec(val info: UserConnection) : MessageToMessageCodec<ByteBuf, ByteBuf>() { class ViaCodec(val info: UserConnection) : MessageToMessageCodec<ByteBuf, ByteBuf>() {
override fun decode(ctx: ChannelHandlerContext, bytebuf: ByteBuf, out: MutableList<Any>) { override fun decode(ctx: ChannelHandlerContext, bytebuf: ByteBuf, out: MutableList<Any>) {

View File

@ -1,17 +1,16 @@
package com.viaversion.aas.handler.autoprotocol package com.viaversion.aas.handler.autoprotocol
import com.google.gson.JsonParser
import com.viaversion.aas.handler.MinecraftHandler import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.handler.state.MinecraftConnectionState import com.viaversion.aas.handler.state.MinecraftConnectionState
import com.viaversion.aas.mcLogger import com.viaversion.aas.mcLogger
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.packet.status.StatusResponse import com.viaversion.aas.packet.status.StatusResponse
import com.viaversion.aas.parseProtocol import com.viaversion.aas.parseProtocol
import com.google.gson.JsonParser
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import io.netty.channel.ChannelHandlerContext
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import com.viaversion.viaversion.api.protocol.packet.State import com.viaversion.viaversion.api.protocol.packet.State
import java.nio.channels.ClosedChannelException import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import io.netty.channel.ChannelHandlerContext
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture
class ProtocolDetectionState(val future: CompletableFuture<ProtocolVersion>) : MinecraftConnectionState { class ProtocolDetectionState(val future: CompletableFuture<ProtocolVersion>) : MinecraftConnectionState {

View File

@ -1,5 +1,7 @@
package com.viaversion.aas.handler.autoprotocol package com.viaversion.aas.handler.autoprotocol
import com.google.common.cache.CacheBuilder
import com.google.common.cache.CacheLoader
import com.viaversion.aas.channelSocketFactory import com.viaversion.aas.channelSocketFactory
import com.viaversion.aas.childLoop import com.viaversion.aas.childLoop
import com.viaversion.aas.codec.FrameCodec import com.viaversion.aas.codec.FrameCodec
@ -11,8 +13,8 @@ import com.viaversion.aas.mcLogger
import com.viaversion.aas.packet.handshake.Handshake import com.viaversion.aas.packet.handshake.Handshake
import com.viaversion.aas.packet.status.StatusRequest import com.viaversion.aas.packet.status.StatusRequest
import com.viaversion.aas.send import com.viaversion.aas.send
import com.google.common.cache.CacheBuilder import com.viaversion.viaversion.api.protocol.packet.State
import com.google.common.cache.CacheLoader import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import io.netty.bootstrap.Bootstrap import io.netty.bootstrap.Bootstrap
import io.netty.channel.Channel import io.netty.channel.Channel
import io.netty.channel.ChannelFuture import io.netty.channel.ChannelFuture
@ -21,8 +23,6 @@ import io.netty.channel.ChannelOption
import io.netty.handler.timeout.ReadTimeoutHandler import io.netty.handler.timeout.ReadTimeoutHandler
import io.netty.resolver.NoopAddressResolverGroup import io.netty.resolver.NoopAddressResolverGroup
import io.netty.util.concurrent.Future import io.netty.util.concurrent.Future
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
import com.viaversion.viaversion.api.protocol.packet.State
import java.net.InetSocketAddress import java.net.InetSocketAddress
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture
import java.util.concurrent.ExecutionException import java.util.concurrent.ExecutionException

View File

@ -3,12 +3,11 @@ package com.viaversion.aas.handler.autoprotocol
import com.viaversion.aas.handler.ConnectionData import com.viaversion.aas.handler.ConnectionData
import com.viaversion.aas.handler.MinecraftHandler import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.mcLogger import com.viaversion.aas.mcLogger
import io.netty.channel.ChannelDuplexHandler
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import io.netty.channel.ChannelPromise import io.netty.channel.ChannelPromise
import java.net.InetSocketAddress import java.net.InetSocketAddress
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import io.netty.channel.ChannelDuplexHandler
import java.lang.Exception
import java.util.function.Consumer import java.util.function.Consumer
// https://github.com/ViaVersion/ViaFabric/blob/mc-1.16/src/main/java/com/github/creeper123123321/viafabric/handler/clientside/ProtocolDetectionHandler.java // https://github.com/ViaVersion/ViaFabric/blob/mc-1.16/src/main/java/com/github/creeper123123321/viafabric/handler/clientside/ProtocolDetectionHandler.java

View File

@ -1,18 +1,18 @@
package com.viaversion.aas.handler.state package com.viaversion.aas.handler.state
import com.google.common.cache.CacheBuilder
import com.google.common.cache.CacheLoader
import com.google.common.net.HostAndPort
import com.google.common.util.concurrent.RateLimiter
import com.viaversion.aas.VIAaaSAddress import com.viaversion.aas.VIAaaSAddress
import com.viaversion.aas.config.VIAaaSConfig import com.viaversion.aas.config.VIAaaSConfig
import com.viaversion.aas.handler.MinecraftHandler import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.mcLogger import com.viaversion.aas.mcLogger
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.packet.handshake.Handshake import com.viaversion.aas.packet.handshake.Handshake
import com.google.common.cache.CacheBuilder
import com.google.common.cache.CacheLoader
import com.google.common.net.HostAndPort
import com.google.common.util.concurrent.RateLimiter
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import io.netty.channel.ChannelHandlerContext
import com.viaversion.viaversion.api.protocol.packet.State import com.viaversion.viaversion.api.protocol.packet.State
import io.netty.channel.ChannelHandlerContext
import java.net.InetAddress import java.net.InetAddress
import java.net.InetSocketAddress import java.net.InetSocketAddress
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit

View File

@ -10,13 +10,13 @@ import com.viaversion.aas.handler.forward
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.packet.login.* import com.viaversion.aas.packet.login.*
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import com.viaversion.viaversion.api.protocol.packet.State
import io.netty.channel.Channel import io.netty.channel.Channel
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.future.await import kotlinx.coroutines.future.await
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import com.viaversion.viaversion.api.protocol.packet.State
import java.util.* import java.util.*
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture
import javax.crypto.Cipher import javax.crypto.Cipher

View File

@ -1,10 +1,10 @@
package com.viaversion.aas.handler.state package com.viaversion.aas.handler.state
import com.viaversion.aas.packet.Packet
import com.viaversion.aas.handler.MinecraftHandler import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.mcLogger import com.viaversion.aas.mcLogger
import io.netty.channel.ChannelHandlerContext import com.viaversion.aas.packet.Packet
import com.viaversion.viaversion.api.protocol.packet.State import com.viaversion.viaversion.api.protocol.packet.State
import io.netty.channel.ChannelHandlerContext
interface MinecraftConnectionState { interface MinecraftConnectionState {
val state: State val state: State

View File

@ -1,5 +1,6 @@
package com.viaversion.aas.handler.state package com.viaversion.aas.handler.state
import com.google.gson.JsonPrimitive
import com.viaversion.aas.config.VIAaaSConfig import com.viaversion.aas.config.VIAaaSConfig
import com.viaversion.aas.handler.MinecraftHandler import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.handler.forward import com.viaversion.aas.handler.forward
@ -10,14 +11,13 @@ import com.viaversion.aas.packet.play.Kick
import com.viaversion.aas.packet.play.PluginMessage import com.viaversion.aas.packet.play.PluginMessage
import com.viaversion.aas.parseProtocol import com.viaversion.aas.parseProtocol
import com.viaversion.aas.readRemainingBytes import com.viaversion.aas.readRemainingBytes
import com.viaversion.aas.writeFlushClose
import com.google.gson.JsonPrimitive
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import com.viaversion.aas.writeFlushClose
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBufAllocator import io.netty.buffer.ByteBufAllocator
import io.netty.buffer.Unpooled import io.netty.buffer.Unpooled
import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelHandlerContext
import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.protocol.packet.State
object PlayState : MinecraftConnectionState { object PlayState : MinecraftConnectionState {
override val state: State override val state: State
@ -40,7 +40,8 @@ object PlayState : MinecraftConnectionState {
} else { } else {
Type.STRING.read(Unpooled.wrappedBuffer(pluginMessage.data)) Type.STRING.read(Unpooled.wrappedBuffer(pluginMessage.data))
} + " (VIAaaS C: ${handler.data.frontVer!!.parseProtocol()} S: ${ } + " (VIAaaS C: ${handler.data.frontVer!!.parseProtocol()} S: ${
handler.data.viaBackServerVer!!.parseProtocol()})" handler.data.viaBackServerVer!!.parseProtocol()
})"
if (is1_7(handler)) { if (is1_7(handler)) {
pluginMessage.data = brand.toByteArray(Charsets.UTF_8) pluginMessage.data = brand.toByteArray(Charsets.UTF_8)

View File

@ -1,5 +1,8 @@
package com.viaversion.aas.handler.state package com.viaversion.aas.handler.state
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.viaversion.aas.config.VIAaaSConfig import com.viaversion.aas.config.VIAaaSConfig
import com.viaversion.aas.handler.MinecraftHandler import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.handler.forward import com.viaversion.aas.handler.forward
@ -7,14 +10,11 @@ import com.viaversion.aas.packet.Packet
import com.viaversion.aas.packet.UnknownPacket import com.viaversion.aas.packet.UnknownPacket
import com.viaversion.aas.packet.status.StatusResponse import com.viaversion.aas.packet.status.StatusResponse
import com.viaversion.aas.parseProtocol import com.viaversion.aas.parseProtocol
import com.viaversion.aas.writeFlushClose
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import io.netty.channel.ChannelHandlerContext import com.viaversion.aas.writeFlushClose
import com.viaversion.viaversion.api.Via import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.protocol.packet.State import com.viaversion.viaversion.api.protocol.packet.State
import io.netty.channel.ChannelHandlerContext
import java.util.* import java.util.*
object StatusState : MinecraftConnectionState { object StatusState : MinecraftConnectionState {

View File

@ -8,6 +8,7 @@ import com.viaversion.aas.handler.MinecraftHandler
import com.viaversion.aas.handler.forward import com.viaversion.aas.handler.forward
import com.viaversion.aas.packet.handshake.Handshake import com.viaversion.aas.packet.handshake.Handshake
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import com.viaversion.viaversion.api.protocol.packet.State
import io.netty.bootstrap.Bootstrap import io.netty.bootstrap.Bootstrap
import io.netty.channel.ChannelFuture import io.netty.channel.ChannelFuture
import io.netty.channel.ChannelFutureListener import io.netty.channel.ChannelFutureListener
@ -17,7 +18,6 @@ import io.netty.resolver.NoopAddressResolverGroup
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import com.viaversion.viaversion.api.protocol.packet.State
import java.net.Inet4Address import java.net.Inet4Address
import java.net.InetAddress import java.net.InetAddress
import java.net.InetSocketAddress import java.net.InetSocketAddress

View File

@ -1,5 +1,6 @@
package com.viaversion.aas.packet package com.viaversion.aas.packet
import com.google.common.collect.Range
import com.viaversion.aas.packet.handshake.Handshake import com.viaversion.aas.packet.handshake.Handshake
import com.viaversion.aas.packet.login.* import com.viaversion.aas.packet.login.*
import com.viaversion.aas.packet.play.Kick import com.viaversion.aas.packet.play.Kick
@ -8,91 +9,100 @@ import com.viaversion.aas.packet.status.StatusPing
import com.viaversion.aas.packet.status.StatusPong import com.viaversion.aas.packet.status.StatusPong
import com.viaversion.aas.packet.status.StatusRequest import com.viaversion.aas.packet.status.StatusRequest
import com.viaversion.aas.packet.status.StatusResponse import com.viaversion.aas.packet.status.StatusResponse
import com.google.common.collect.Range
import com.viaversion.aas.util.StacklessException import com.viaversion.aas.util.StacklessException
import io.netty.buffer.ByteBuf import com.viaversion.viaversion.api.protocol.packet.Direction
import com.viaversion.viaversion.api.protocol.packet.State
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
import com.viaversion.viaversion.api.protocol.packet.State import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9
import io.netty.buffer.ByteBuf
import java.util.function.Supplier import java.util.function.Supplier
object PacketRegistry { object PacketRegistry {
val entries = mutableListOf<RegistryEntry>() val entries = mutableListOf<RegistryEntry>()
init { init {
// Obviosly stolen from https://github.com/VelocityPowered/Velocity/blob/dev/1.1.0/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java // Obviously stolen from https://github.com/VelocityPowered/Velocity/blob/dev/1.1.0/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java
register(Range.all(), State.HANDSHAKE, 0, true, ::Handshake) register(State.HANDSHAKE, Direction.SERVERBOUND, ::Handshake, Range.all(), 0)
register(Range.all(), State.LOGIN, 0, true, ::LoginStart)
register(Range.all(), State.LOGIN, 1, true, ::CryptoResponse) register(State.LOGIN, Direction.SERVERBOUND, ::LoginStart, Range.all(), 0)
register(Range.atLeast(ProtocolVersion.v1_13.version), State.LOGIN, 2, true, ::PluginResponse) register(State.LOGIN, Direction.SERVERBOUND, ::CryptoResponse, Range.all(), 1)
register(Range.all(), State.LOGIN, 0, false, ::LoginDisconnect) register(State.LOGIN, Direction.SERVERBOUND, ::PluginResponse, Range.atLeast(ProtocolVersion.v1_13.version), 2)
register(Range.all(), State.LOGIN, 1, false, ::CryptoRequest)
register(Range.all(), State.LOGIN, 2, false, ::LoginSuccess) register(State.LOGIN, Direction.CLIENTBOUND, ::LoginDisconnect, Range.all(), 0)
register(Range.all(), State.LOGIN, 3, false, ::SetCompression) register(State.LOGIN, Direction.CLIENTBOUND, ::CryptoRequest, Range.all(), 1)
register(Range.atLeast(ProtocolVersion.v1_13.version), State.LOGIN, 4, false, ::PluginRequest) register(State.LOGIN, Direction.CLIENTBOUND, ::LoginSuccess, Range.all(), 2)
register(Range.all(), State.STATUS, 0, true, ::StatusRequest) register(State.LOGIN, Direction.CLIENTBOUND, ::SetCompression, Range.all(), 3)
register(Range.all(), State.STATUS, 1, true, ::StatusPing) register(State.LOGIN, Direction.CLIENTBOUND, ::PluginRequest, Range.atLeast(ProtocolVersion.v1_13.version), 4)
register(Range.all(), State.STATUS, 0, false, ::StatusResponse)
register(Range.all(), State.STATUS, 1, false, ::StatusPong) register(State.STATUS, Direction.SERVERBOUND, ::StatusRequest, Range.all(), 0)
register(State.STATUS, Direction.SERVERBOUND, ::StatusPing, Range.all(), 1)
register(State.STATUS, Direction.CLIENTBOUND, ::StatusResponse, Range.all(), 0)
register(State.STATUS, Direction.CLIENTBOUND, ::StatusPong, Range.all(), 1)
// Play
register( register(
::Kick, State.PLAY, false, mapOf( State.PLAY, Direction.CLIENTBOUND, ::Kick, mapOf(
Range.closed(ProtocolVersion.v1_7_1.version, ProtocolVersion.v1_8.version) to 0x40, ProtocolVersion.v1_7_1..ProtocolVersion.v1_8 to ClientboundPackets1_8.DISCONNECT.id,
Range.closed(ProtocolVersion.v1_9.version, ProtocolVersion.v1_12_2.version) to 0x1A, ProtocolVersion.v1_9..ProtocolVersion.v1_12_2 to ClientboundPackets1_9.DISCONNECT.id,
Range.closed(ProtocolVersion.v1_13.version, ProtocolVersion.v1_13_2.version) to 0x1B, ProtocolVersion.v1_13..ProtocolVersion.v1_13_2 to ClientboundPackets1_13.DISCONNECT.id,
Range.closed(ProtocolVersion.v1_14.version, ProtocolVersion.v1_14_4.version) to 0x1A, ProtocolVersion.v1_14..ProtocolVersion.v1_14_4 to ClientboundPackets1_14.DISCONNECT.id,
Range.closed(ProtocolVersion.v1_15.version, ProtocolVersion.v1_15_2.version) to 0x1B, ProtocolVersion.v1_15..ProtocolVersion.v1_15_2 to ClientboundPackets1_15.DISCONNECT.id,
Range.closed(ProtocolVersion.v1_16.version, ProtocolVersion.v1_16_1.version) to 0x1A, ProtocolVersion.v1_16..ProtocolVersion.v1_16_1 to ClientboundPackets1_16.DISCONNECT.id,
Range.closed(ProtocolVersion.v1_16_2.version, ProtocolVersion.v1_16_4.version) to 0x19 ProtocolVersion.v1_16_2..ProtocolVersion.v1_16_4 to ClientboundPackets1_16_2.DISCONNECT.id,
Range.singleton(ProtocolVersion.v1_17.fullSnapshotVersion) to ClientboundPackets1_17.DISCONNECT.id
) )
) )
register( register(
::PluginMessage, State.PLAY, true, mapOf( State.PLAY, Direction.CLIENTBOUND, ::PluginMessage, mapOf(
Range.closed(ProtocolVersion.v1_7_1.version, ProtocolVersion.v1_8.version) to 0x17, ProtocolVersion.v1_7_1..ProtocolVersion.v1_8 to ClientboundPackets1_8.PLUGIN_MESSAGE.id,
Range.closed(ProtocolVersion.v1_9.version, ProtocolVersion.v1_11_1.version) to 0x09, ProtocolVersion.v1_9..ProtocolVersion.v1_12_2 to ClientboundPackets1_9.PLUGIN_MESSAGE.id,
Range.singleton(ProtocolVersion.v1_12.version) to 0x0A, ProtocolVersion.v1_13..ProtocolVersion.v1_13_2 to ClientboundPackets1_13.PLUGIN_MESSAGE.id,
Range.closed(ProtocolVersion.v1_12_1.version, ProtocolVersion.v1_12_2.version) to 0x09, ProtocolVersion.v1_14..ProtocolVersion.v1_14_4 to ClientboundPackets1_14.PLUGIN_MESSAGE.id,
Range.closed(ProtocolVersion.v1_13.version, ProtocolVersion.v1_13_2.version) to 0x0A, ProtocolVersion.v1_15..ProtocolVersion.v1_15_2 to ClientboundPackets1_15.PLUGIN_MESSAGE.id,
Range.closed(ProtocolVersion.v1_14.version, ProtocolVersion.v1_16_4.version) to 0x0B ProtocolVersion.v1_16..ProtocolVersion.v1_16_1 to ClientboundPackets1_16.PLUGIN_MESSAGE.id,
) ProtocolVersion.v1_16_2..ProtocolVersion.v1_16_4 to ClientboundPackets1_16_2.PLUGIN_MESSAGE.id,
) Range.singleton(ProtocolVersion.v1_17.fullSnapshotVersion) to ClientboundPackets1_17.PLUGIN_MESSAGE.id
register(
::PluginMessage, State.PLAY, false,
mapOf(
Range.closed(ProtocolVersion.v1_7_1.version, ProtocolVersion.v1_8.version) to 0x3F,
Range.closed(ProtocolVersion.v1_9.version, ProtocolVersion.v1_12_2.version) to 0x18,
Range.closed(ProtocolVersion.v1_13.version, ProtocolVersion.v1_13_2.version) to 0x19,
Range.closed(ProtocolVersion.v1_14.version, ProtocolVersion.v1_14_4.version) to 0x18,
Range.closed(ProtocolVersion.v1_15.version, ProtocolVersion.v1_15_2.version) to 0x19,
Range.closed(ProtocolVersion.v1_16.version, ProtocolVersion.v1_16_1.version) to 0x18,
Range.closed(ProtocolVersion.v1_16_2.version, ProtocolVersion.v1_16_4.version) to 0x17
) )
) )
} }
operator fun ProtocolVersion.rangeTo(o: ProtocolVersion): Range<Int> {
return Range.closed(this.originalVersion, o.originalVersion)
}
inline fun <reified P : Packet> register( inline fun <reified P : Packet> register(
protocol: Range<Int>,
state: State, state: State,
id: Int, direction: Direction,
serverBound: Boolean,
constructor: Supplier<P>
) {
entries.add(RegistryEntry(protocol, state, id, serverBound, constructor, P::class.java))
}
inline fun <reified P : Packet> register(
constructor: Supplier<P>, constructor: Supplier<P>,
state: State, idByProtocol: Map<Range<Int>, Int>,
serverBound: Boolean, klass: Class<P> = P::class.java,
idByProtocol: Map<Range<Int>, Int>
) { ) {
idByProtocol.forEach { (protocol, id) -> register(protocol, state, id, serverBound, constructor) } entries.add(RegistryEntry(idByProtocol, state, direction, constructor, klass))
}
inline fun <reified P : Packet> register(
state: State,
direction: Direction,
constructor: Supplier<P>,
protocol: Range<Int>,
id: Int
) {
register(constructor = constructor, direction = direction, state = state, idByProtocol = mapOf(protocol to id))
} }
data class RegistryEntry( data class RegistryEntry(
val versionRange: Range<Int>, val idByVersion: Map<Range<Int>, Int>,
val state: State, val state: State,
val id: Int, val direction: Direction,
val serverBound: Boolean,
val constructor: Supplier<out Packet>, val constructor: Supplier<out Packet>,
val packetClass: Class<out Packet> val packetClass: Class<out Packet>
) )
@ -101,34 +111,35 @@ object PacketRegistry {
protocolVersion: Int, protocolVersion: Int,
state: State, state: State,
id: Int, id: Int,
serverBound: Boolean direction: Direction
): Supplier<out Packet>? { ): Supplier<out Packet>? {
return entries.firstOrNull { return entries.firstOrNull {
it.serverBound == serverBound && it.state == state it.direction == direction
&& it.versionRange.contains(protocolVersion) && it.id == id && it.state == state
&& it.idByVersion.entries.firstOrNull { it.key.contains(protocolVersion) }?.value == id
}?.constructor }?.constructor
} }
fun getPacketId(packetClass: Class<out Packet>, protocolVersion: Int, serverBound: Boolean): Int? { fun getPacketId(packetClass: Class<out Packet>, protocolVersion: Int, direction: Direction): Int? {
return entries.firstOrNull { return entries.firstOrNull {
it.versionRange.contains(protocolVersion) && it.packetClass == packetClass && it.serverBound == serverBound it.packetClass == packetClass && it.direction == direction
}?.id }?.idByVersion?.entries?.firstOrNull { it.key.contains(protocolVersion) }?.value
} }
fun decode(byteBuf: ByteBuf, protocolVersion: Int, state: State, serverBound: Boolean): Packet { fun decode(byteBuf: ByteBuf, protocolVersion: Int, state: State, direction: Direction): Packet {
val packetId = Type.VAR_INT.readPrimitive(byteBuf) val packetId = Type.VAR_INT.readPrimitive(byteBuf)
val packet = val packet =
getPacketConstructor(protocolVersion, state, packetId, serverBound)?.get() ?: UnknownPacket(packetId) getPacketConstructor(protocolVersion, state, packetId, direction)?.get() ?: UnknownPacket(packetId)
packet.decode(byteBuf, protocolVersion) packet.decode(byteBuf, protocolVersion)
if (byteBuf.isReadable) throw StacklessException("Remaining bytes!") if (byteBuf.isReadable) throw StacklessException("Remaining bytes!")
return packet return packet
} }
fun encode(packet: Packet, byteBuf: ByteBuf, protocolVersion: Int, serverBound: Boolean) { fun encode(packet: Packet, byteBuf: ByteBuf, protocolVersion: Int, direction: Direction) {
val id = if (packet is UnknownPacket) { val id = if (packet is UnknownPacket) {
packet.id packet.id
} else { } else {
getPacketId(packet.javaClass, protocolVersion, serverBound)!! getPacketId(packet.javaClass, protocolVersion, direction)!!
} }
Type.VAR_INT.writePrimitive(byteBuf, id) Type.VAR_INT.writePrimitive(byteBuf, id)
packet.encode(byteBuf, protocolVersion) packet.encode(byteBuf, protocolVersion)

View File

@ -1,9 +1,9 @@
package com.viaversion.aas.packet.handshake package com.viaversion.aas.packet.handshake
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.protocol.packet.State import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
import kotlin.properties.Delegates import kotlin.properties.Delegates
class Handshake : Packet { class Handshake : Packet {

View File

@ -2,9 +2,9 @@ package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.readByteArray import com.viaversion.aas.readByteArray
import io.netty.buffer.ByteBuf
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
import io.netty.buffer.ByteBuf
import java.security.KeyFactory import java.security.KeyFactory
import java.security.PublicKey import java.security.PublicKey
import java.security.spec.X509EncodedKeySpec import java.security.spec.X509EncodedKeySpec

View File

@ -2,9 +2,9 @@ package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.readByteArray import com.viaversion.aas.readByteArray
import io.netty.buffer.ByteBuf
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
import io.netty.buffer.ByteBuf
class CryptoResponse : Packet { class CryptoResponse : Packet {
lateinit var encryptedKey: ByteArray lateinit var encryptedKey: ByteArray

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.packet.login package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
class LoginDisconnect : Packet { class LoginDisconnect : Packet {
lateinit var msg: String lateinit var msg: String

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.packet.login package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
class LoginStart : Packet { class LoginStart : Packet {
lateinit var username: String lateinit var username: String

View File

@ -2,9 +2,9 @@ package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.parseUndashedId import com.viaversion.aas.parseUndashedId
import io.netty.buffer.ByteBuf
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
import io.netty.buffer.ByteBuf
import java.util.* import java.util.*
class LoginSuccess : Packet { class LoginSuccess : Packet {

View File

@ -2,8 +2,8 @@ package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.readRemainingBytes import com.viaversion.aas.readRemainingBytes
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
import kotlin.properties.Delegates import kotlin.properties.Delegates
class PluginRequest : Packet { class PluginRequest : Packet {

View File

@ -2,8 +2,8 @@ package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.readRemainingBytes import com.viaversion.aas.readRemainingBytes
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
import kotlin.properties.Delegates import kotlin.properties.Delegates
class PluginResponse : Packet { class PluginResponse : Packet {

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.packet.login package com.viaversion.aas.packet.login
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
import kotlin.properties.Delegates import kotlin.properties.Delegates
class SetCompression : Packet { class SetCompression : Packet {

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.packet.play package com.viaversion.aas.packet.play
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
class Kick : Packet { class Kick : Packet {
lateinit var msg: String lateinit var msg: String

View File

@ -3,9 +3,9 @@ package com.viaversion.aas.packet.play
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import com.viaversion.aas.readByteArray import com.viaversion.aas.readByteArray
import com.viaversion.aas.readRemainingBytes import com.viaversion.aas.readRemainingBytes
import io.netty.buffer.ByteBuf
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
import io.netty.buffer.ByteBuf
class PluginMessage : Packet { class PluginMessage : Packet {
lateinit var channel: String lateinit var channel: String

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.packet.status package com.viaversion.aas.packet.status
import com.viaversion.aas.packet.Packet import com.viaversion.aas.packet.Packet
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import io.netty.buffer.ByteBuf
class StatusResponse : Packet { class StatusResponse : Packet {
lateinit var json: String lateinit var json: String

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.platform package com.viaversion.aas.platform
import com.viaversion.viabackwards.api.ViaBackwardsPlatform import com.viaversion.viabackwards.api.ViaBackwardsPlatform
import org.slf4j.LoggerFactory
import com.viaversion.viaversion.sponge.util.LoggerWrapper import com.viaversion.viaversion.sponge.util.LoggerWrapper
import org.slf4j.LoggerFactory
import java.io.File import java.io.File
import java.util.logging.Logger import java.util.logging.Logger

View File

@ -1,20 +1,19 @@
package com.viaversion.aas.platform package com.viaversion.aas.platform
import com.google.common.util.concurrent.ThreadFactoryBuilder
import com.viaversion.aas.config.AspirinViaConfig import com.viaversion.aas.config.AspirinViaConfig
import com.viaversion.aas.initFuture import com.viaversion.aas.initFuture
import com.viaversion.aas.viaaasVer import com.viaversion.aas.viaaasVer
import com.google.common.util.concurrent.ThreadFactoryBuilder
import io.netty.channel.DefaultEventLoop
import org.slf4j.LoggerFactory
import com.viaversion.viaversion.api.ViaAPI import com.viaversion.viaversion.api.ViaAPI
import com.viaversion.viaversion.api.configuration.ViaVersionConfig
import com.viaversion.viaversion.api.command.ViaCommandSender import com.viaversion.viaversion.api.command.ViaCommandSender
import com.viaversion.viaversion.api.configuration.ConfigurationProvider import com.viaversion.viaversion.api.configuration.ConfigurationProvider
import com.viaversion.viaversion.api.platform.PlatformTask import com.viaversion.viaversion.api.configuration.ViaVersionConfig
import com.viaversion.viaversion.api.platform.ViaPlatform import com.viaversion.viaversion.api.platform.ViaPlatform
import com.viaversion.viaversion.libs.gson.JsonObject
import com.viaversion.viaversion.sponge.util.LoggerWrapper import com.viaversion.viaversion.sponge.util.LoggerWrapper
import com.viaversion.viaversion.util.VersionInfo import com.viaversion.viaversion.util.VersionInfo
import com.viaversion.viaversion.libs.gson.JsonObject import io.netty.channel.DefaultEventLoop
import org.slf4j.LoggerFactory
import java.io.File import java.io.File
import java.util.* import java.util.*
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.platform package com.viaversion.aas.platform
import com.viaversion.viaversion.sponge.util.LoggerWrapper
import de.gerrygames.viarewind.api.ViaRewindPlatform import de.gerrygames.viarewind.api.ViaRewindPlatform
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import com.viaversion.viaversion.sponge.util.LoggerWrapper
import java.util.logging.Logger import java.util.logging.Logger
object AspirinRewind : ViaRewindPlatform { object AspirinRewind : ViaRewindPlatform {

View File

@ -8,6 +8,10 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion
// cursed 1.7 -> 1.8 from https://github.com/Gerrygames/ClientViaVersion // cursed 1.7 -> 1.8 from https://github.com/Gerrygames/ClientViaVersion
// + https://github.com/creeper123123321/ViaRewind/tree/17to18 // + https://github.com/creeper123123321/ViaRewind/tree/17to18
fun registerAspirinProtocols() { fun registerAspirinProtocols() {
Via.getManager().protocolManager.registerProtocol(Protocol1_7_6to1_7_2, ProtocolVersion.v1_7_6, ProtocolVersion.v1_7_1) Via.getManager().protocolManager.registerProtocol(
Protocol1_7_6to1_7_2,
ProtocolVersion.v1_7_6,
ProtocolVersion.v1_7_1
)
Via.getManager().protocolManager.registerProtocol(Protocol1_8To1_7_6, ProtocolVersion.v1_8, ProtocolVersion.v1_7_6) Via.getManager().protocolManager.registerProtocol(Protocol1_8To1_7_6, ProtocolVersion.v1_8, ProtocolVersion.v1_7_6)
} }

View File

@ -1,7 +1,7 @@
package com.viaversion.aas.protocol package com.viaversion.aas.protocol
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.minecraft.Position import com.viaversion.viaversion.api.minecraft.Position
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.protocol.remapper.ValueReader import com.viaversion.viaversion.api.protocol.remapper.ValueReader
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer
import com.viaversion.viaversion.api.protocol.remapper.ValueWriter import com.viaversion.viaversion.api.protocol.remapper.ValueWriter

View File

@ -4,7 +4,6 @@ import com.viaversion.aas.protocol.id47toid5.packets.*
import com.viaversion.aas.protocol.id47toid5.storage.* import com.viaversion.aas.protocol.id47toid5.storage.*
import com.viaversion.viaversion.api.connection.UserConnection import com.viaversion.viaversion.api.connection.UserConnection
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol
import java.util.*
// Based on https://github.com/Gerrygames/ClientViaVersion // Based on https://github.com/Gerrygames/ClientViaVersion
object Protocol1_8To1_7_6 : AbstractSimpleProtocol() { object Protocol1_8To1_7_6 : AbstractSimpleProtocol() {

View File

@ -1,10 +1,10 @@
package com.viaversion.aas.protocol.id47toid5.chunks package com.viaversion.aas.protocol.id47toid5.chunks
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8 import com.viaversion.viaversion.api.minecraft.BlockChangeRecord1_8
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.type.types.CustomByteType import com.viaversion.viaversion.api.type.types.CustomByteType
import io.netty.buffer.ByteBuf
import java.io.IOException import java.io.IOException
import java.util.stream.IntStream import java.util.stream.IntStream
import java.util.zip.DataFormatException import java.util.zip.DataFormatException
@ -102,7 +102,8 @@ object ChunkPacketTransformer {
} }
val chunks = arrayOfNulls<Chunk1_8to1_7_6_10>(columnCount) val chunks = arrayOfNulls<Chunk1_8to1_7_6_10>(columnCount)
(0 until columnCount).forEach { (0 until columnCount).forEach {
chunks[it] = Chunk1_8to1_7_6_10(inflatedBuffers[it]!!, primaryBitMask[it], addBitMask[it], skyLightSent, true) chunks[it] =
Chunk1_8to1_7_6_10(inflatedBuffers[it]!!, primaryBitMask[it], addBitMask[it], skyLightSent, true)
} }
packetWrapper.write(Type.BOOLEAN, skyLightSent) packetWrapper.write(Type.BOOLEAN, skyLightSent)
packetWrapper.write(Type.VAR_INT, columnCount) packetWrapper.write(Type.VAR_INT, columnCount)

View File

@ -1,11 +1,10 @@
package com.viaversion.aas.protocol.id47toid5.metadata package com.viaversion.aas.protocol.id47toid5.metadata
import de.gerrygames.viarewind.protocol.protocol1_8to1_7_6_10.metadata.MetaIndex1_8to1_7_6_10
import com.viaversion.viaversion.api.Via import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types
import com.viaversion.viaversion.api.minecraft.metadata.Metadata import com.viaversion.viaversion.api.minecraft.metadata.Metadata
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_8 import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_8
import java.util.* import de.gerrygames.viarewind.protocol.protocol1_8to1_7_6_10.metadata.MetaIndex1_8to1_7_6_10
object MetadataRewriter { object MetadataRewriter {
fun transform(type: Entity1_10Types.EntityType?, list: MutableList<Metadata>) { fun transform(type: Entity1_10Types.EntityType?, list: MutableList<Metadata>) {

View File

@ -5,13 +5,13 @@ import com.viaversion.aas.protocol.id47toid5.metadata.MetadataRewriter
import com.viaversion.aas.protocol.id47toid5.storage.EntityTracker import com.viaversion.aas.protocol.id47toid5.storage.EntityTracker
import com.viaversion.aas.protocol.id47toid5.type.CustomIntType import com.viaversion.aas.protocol.id47toid5.type.CustomIntType
import com.viaversion.aas.protocol.xyzToPosition import com.viaversion.aas.protocol.xyzToPosition
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper
import com.viaversion.viaversion.api.protocol.remapper.TypeRemapper import com.viaversion.viaversion.api.protocol.remapper.TypeRemapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.type.types.version.Types1_8 import com.viaversion.viaversion.api.type.types.version.Types1_8
import com.viaversion.viaversion.api.protocol.packet.State import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10
import kotlin.experimental.and import kotlin.experimental.and
fun Protocol1_8To1_7_6.registerEntityPackets() { fun Protocol1_8To1_7_6.registerEntityPackets() {
@ -36,7 +36,10 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
packetWrapper.write(Type.VAR_INT, entityId) //Entity Id packetWrapper.write(Type.VAR_INT, entityId) //Entity Id
packetWrapper.write(Type.UNSIGNED_BYTE, 0.toShort()) //Index packetWrapper.write(Type.UNSIGNED_BYTE, 0.toShort()) //Index
packetWrapper.write(Type.UNSIGNED_BYTE, 0.toShort()) //Type packetWrapper.write(Type.UNSIGNED_BYTE, 0.toShort()) //Type
packetWrapper.write(Type.BYTE, (if (animation.toInt() == 104) 0x02 else 0x00).toByte()) //Value (sneaking/not sneaking) packetWrapper.write(
Type.BYTE,
(if (animation.toInt() == 104) 0x02 else 0x00).toByte()
) //Value (sneaking/not sneaking)
packetWrapper.write(Type.UNSIGNED_BYTE, 255.toShort()) //end packetWrapper.write(Type.UNSIGNED_BYTE, 255.toShort()) //end
} else { } else {
packetWrapper.write(Type.VAR_INT, entityId) //Entity Id packetWrapper.write(Type.VAR_INT, entityId) //Entity Id
@ -381,7 +384,12 @@ fun Protocol1_8To1_7_6.registerEntityPackets() {
this.registerServerbound(State.PLAY, 0x0B, 0x0B, object : PacketRemapper() { this.registerServerbound(State.PLAY, 0x0B, 0x0B, object : PacketRemapper() {
override fun registerMap() { override fun registerMap() {
map(Type.VAR_INT, Type.INT) //Entity Id map(Type.VAR_INT, Type.INT) //Entity Id
handler { packetWrapper -> packetWrapper.write(Type.BYTE, (packetWrapper.read(Type.VAR_INT) + 1).toByte()) } //Action Id handler { packetWrapper ->
packetWrapper.write(
Type.BYTE,
(packetWrapper.read(Type.VAR_INT) + 1).toByte()
)
} //Action Id
map(Type.VAR_INT, Type.INT) //Action Paramter map(Type.VAR_INT, Type.INT) //Action Paramter
} }
}) })

View File

@ -2,14 +2,14 @@ package com.viaversion.aas.protocol.id47toid5.packets
import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6 import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6
import com.viaversion.aas.protocol.id47toid5.storage.Windows import com.viaversion.aas.protocol.id47toid5.storage.Windows
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10
import com.viaversion.viaversion.api.minecraft.item.Item import com.viaversion.viaversion.api.minecraft.item.Item
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.libs.kyori.adventure.text.Component import com.viaversion.viaversion.libs.kyori.adventure.text.Component
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10
fun Protocol1_8To1_7_6.registerInventoryPackets() { fun Protocol1_8To1_7_6.registerInventoryPackets() {

View File

@ -1,9 +1,9 @@
package com.viaversion.aas.protocol.id47toid5.packets package com.viaversion.aas.protocol.id47toid5.packets
import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6 import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.protocol.packet.State
fun Protocol1_8To1_7_6.registerLoginPackets() { fun Protocol1_8To1_7_6.registerLoginPackets() {
//Encryption Request //Encryption Request

View File

@ -9,24 +9,23 @@ import com.viaversion.aas.protocol.id47toid5.storage.Scoreboard
import com.viaversion.aas.protocol.id47toid5.storage.Tablist import com.viaversion.aas.protocol.id47toid5.storage.Tablist
import com.viaversion.aas.protocol.xyzToPosition import com.viaversion.aas.protocol.xyzToPosition
import com.viaversion.aas.protocol.xyzUBytePos import com.viaversion.aas.protocol.xyzUBytePos
import com.viaversion.aas.readRemainingBytes
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.CustomStringType
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10
import de.gerrygames.viarewind.utils.ChatUtil
import io.netty.buffer.Unpooled
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.Via import com.viaversion.viaversion.api.Via
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types
import com.viaversion.viaversion.api.minecraft.item.Item import com.viaversion.viaversion.api.minecraft.item.Item
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper
import com.viaversion.viaversion.api.protocol.remapper.TypeRemapper import com.viaversion.viaversion.api.protocol.remapper.TypeRemapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.type.types.CustomByteType import com.viaversion.viaversion.api.type.types.CustomByteType
import com.viaversion.viaversion.api.type.types.version.Types1_8 import com.viaversion.viaversion.api.type.types.version.Types1_8
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.util.ChatColorUtil
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag
import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag
import com.viaversion.viaversion.util.ChatColorUtil
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.CustomStringType
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10
import de.gerrygames.viarewind.utils.ChatUtil
import io.netty.buffer.Unpooled
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.util.* import java.util.*
import kotlin.experimental.and import kotlin.experimental.and

View File

@ -5,14 +5,14 @@ import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6
import com.viaversion.aas.protocol.id47toid5.chunks.ChunkPacketTransformer import com.viaversion.aas.protocol.id47toid5.chunks.ChunkPacketTransformer
import com.viaversion.aas.protocol.id47toid5.data.Particle1_8to1_7 import com.viaversion.aas.protocol.id47toid5.data.Particle1_8to1_7
import com.viaversion.aas.protocol.id47toid5.storage.MapStorage import com.viaversion.aas.protocol.id47toid5.storage.MapStorage
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10 import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper
import com.viaversion.viaversion.api.protocol.remapper.TypeRemapper import com.viaversion.viaversion.api.protocol.remapper.TypeRemapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer
import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer import com.viaversion.viaversion.libs.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8
import de.gerrygames.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10
import kotlin.experimental.and import kotlin.experimental.and
fun Protocol1_8To1_7_6.registerWorldPackets() { fun Protocol1_8To1_7_6.registerWorldPackets() {

View File

@ -2,14 +2,13 @@ package com.viaversion.aas.protocol.id47toid5.storage
import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6 import com.viaversion.aas.protocol.id47toid5.Protocol1_8To1_7_6
import com.viaversion.aas.protocol.id47toid5.metadata.MetadataRewriter import com.viaversion.aas.protocol.id47toid5.metadata.MetadataRewriter
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.connection.StoredObject import com.viaversion.viaversion.api.connection.StoredObject
import com.viaversion.viaversion.api.connection.UserConnection import com.viaversion.viaversion.api.connection.UserConnection
import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types import com.viaversion.viaversion.api.minecraft.entities.Entity1_10Types
import com.viaversion.viaversion.api.minecraft.metadata.Metadata import com.viaversion.viaversion.api.minecraft.metadata.Metadata
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.type.types.version.Types1_8 import com.viaversion.viaversion.api.type.types.version.Types1_8
import java.lang.Exception
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
class EntityTracker(user: UserConnection) : StoredObject(user) { class EntityTracker(user: UserConnection) : StoredObject(user) {

View File

@ -2,7 +2,6 @@ package com.viaversion.aas.protocol.id47toid5.storage
import com.viaversion.viaversion.api.connection.StoredObject import com.viaversion.viaversion.api.connection.StoredObject
import com.viaversion.viaversion.api.connection.UserConnection import com.viaversion.viaversion.api.connection.UserConnection
import java.util.*
class MapStorage(user: UserConnection) : StoredObject(user) { class MapStorage(user: UserConnection) : StoredObject(user) {
private val maps: MutableMap<Int, MapData> = HashMap() private val maps: MutableMap<Int, MapData> = HashMap()
@ -18,5 +17,6 @@ class MapStorage(user: UserConnection) : StoredObject(user) {
var scale: Byte = 0 var scale: Byte = 0
var mapIcons = emptyArray<MapIcon>() var mapIcons = emptyArray<MapIcon>()
} }
class MapIcon(var direction: Byte, var type: Byte, var x: Byte, var z: Byte) class MapIcon(var direction: Byte, var type: Byte, var x: Byte, var z: Byte)
} }

View File

@ -2,7 +2,6 @@ package com.viaversion.aas.protocol.id47toid5.storage
import com.viaversion.viaversion.api.connection.StoredObject import com.viaversion.viaversion.api.connection.StoredObject
import com.viaversion.viaversion.api.connection.UserConnection import com.viaversion.viaversion.api.connection.UserConnection
import java.util.*
class Scoreboard(user: UserConnection) : StoredObject(user) { class Scoreboard(user: UserConnection) : StoredObject(user) {
private val objectives = HashMap<String, String>() private val objectives = HashMap<String, String>()

View File

@ -1,7 +1,7 @@
package com.viaversion.aas.protocol.id47toid5.type package com.viaversion.aas.protocol.id47toid5.type
import io.netty.buffer.ByteBuf
import com.viaversion.viaversion.api.type.PartialType import com.viaversion.viaversion.api.type.PartialType
import io.netty.buffer.ByteBuf
class CustomIntType(amount: Int) : PartialType<IntArray, Int>(amount, IntArray::class.java) { class CustomIntType(amount: Int) : PartialType<IntArray, Int>(amount, IntArray::class.java) {
override fun read(p0: ByteBuf, p1: Int): IntArray { override fun read(p0: ByteBuf, p1: Int): IntArray {

View File

@ -3,9 +3,9 @@ package com.viaversion.aas.protocol.id5toid4
import com.viaversion.aas.protocol.INSERT_DASHES import com.viaversion.aas.protocol.INSERT_DASHES
import com.viaversion.viaversion.api.connection.UserConnection import com.viaversion.viaversion.api.connection.UserConnection
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol
import com.viaversion.viaversion.api.protocol.packet.State
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper
import com.viaversion.viaversion.api.type.Type import com.viaversion.viaversion.api.type.Type
import com.viaversion.viaversion.api.protocol.packet.State
// Based on https://github.com/Gerrygames/ClientViaVersion // Based on https://github.com/Gerrygames/ClientViaVersion
object Protocol1_7_6to1_7_2 : AbstractSimpleProtocol() { object Protocol1_7_6to1_7_2 : AbstractSimpleProtocol() {

View File

@ -1,8 +1,8 @@
package com.viaversion.aas.web package com.viaversion.aas.web
import com.viaversion.aas.config.VIAaaSConfig
import com.google.common.collect.Sets import com.google.common.collect.Sets
import com.google.common.util.concurrent.RateLimiter import com.google.common.util.concurrent.RateLimiter
import com.viaversion.aas.config.VIAaaSConfig
import io.ktor.features.* import io.ktor.features.*
import io.ktor.websocket.* import io.ktor.websocket.*
import java.util.* import java.util.*

View File

@ -26,7 +26,8 @@ class WebLogin : WebState {
"offline_login" -> { "offline_login" -> {
if (!sha512Hex(msg.toByteArray(Charsets.UTF_8)).startsWith("00000")) throw StacklessException("PoW failed") if (!sha512Hex(msg.toByteArray(Charsets.UTF_8)).startsWith("00000")) throw StacklessException("PoW failed")
if ((obj.getAsJsonPrimitive("date").asLong - System.currentTimeMillis()).absoluteValue if ((obj.getAsJsonPrimitive("date").asLong - System.currentTimeMillis()).absoluteValue
> Duration.ofMinutes(2).toMillis()) { > Duration.ofMinutes(2).toMillis()
) {
throw StacklessException("Invalid PoW date") throw StacklessException("Invalid PoW date")
} }
val username = obj.get("username").asString.trim() val username = obj.get("username").asString.trim()

View File

@ -2,56 +2,75 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta content="width=device-width, initial-scale=1" name="viewport">
<title>VIAaaS</title> <title>VIAaaS</title>
<meta name="application-name" content="VIAaaS"> <meta content="VIAaaS" name="application-name">
<meta property="og:site_name" content="VIAaaS"> <meta content="VIAaaS" property="og:site_name">
<meta name="description" content="VIAaaS - ViaVersion as a Service - ViaVersion standalone proxy"> <meta content="VIAaaS - ViaVersion as a Service - ViaVersion standalone proxy" name="description">
<meta property="og:title" content="VIAaaS"> <meta content="VIAaaS" property="og:title">
<meta property="og:description" content="VIAaaS - ViaVersion as a Service - ViaVersion standalone proxy"> <meta content="VIAaaS - ViaVersion as a Service - ViaVersion standalone proxy" property="og:description">
<meta property="og:type" content="game"> <meta content="game" property="og:type">
<meta property="og:image" content="https://cdn.discordapp.com/attachments/698483428915675186/821487447664885770/unknown.png"> <meta content="https://cdn.discordapp.com/attachments/698483428915675186/821487447664885770/unknown.png"
<link rel="icon" href="https://cdn.discordapp.com/attachments/698483428915675186/821487447664885770/unknown.png"> property="og:image">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; <link href="https://cdn.discordapp.com/attachments/698483428915675186/821487447664885770/unknown.png" rel="icon">
<meta content="default-src 'self';
style-src https://cdnjs.cloudflare.com/ 'self'; style-src https://cdnjs.cloudflare.com/ 'self';
img-src data: https://cdn.discordapp.com/ https://crafthead.net/ https://crafatar.com/; img-src data: https://cdn.discordapp.com/ https://crafthead.net/ https://crafatar.com/;
connect-src 'self' http://localhost:*/ https: wss:; connect-src 'self' http://localhost:*/ https: wss:;
script-src 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' 'self' https://ajax.cloudflare.com/ https://cdnjs.cloudflare.com/ https://alcdn.msauth.net/"> script-src 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' 'self' https://ajax.cloudflare.com/ https://cdnjs.cloudflare.com/ https://alcdn.msauth.net/" http-equiv="Content-Security-Policy">
<meta name="referrer" content="no-referrer"> <meta content="no-referrer" name="referrer">
<meta name="robots" content="noindex"> <meta content="noindex" name="robots">
<meta name="theme-color" content="#0468a1"> <meta content="#0468a1" name="theme-color">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-beta1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous"> <link crossorigin="anonymous"
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-beta1/js/bootstrap.bundle.min.js" integrity="sha512-q2vREMvON/xrz1KuOj5QKWmdvcHtM4XNbNer+Qbf4TOj+RMDnul0Fg3VmmYprdf3fnL1gZgzKhZszsp62r5Ugg==" crossorigin="anonymous"></script> href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-beta1/css/bootstrap.min.css" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.js" integrity="sha512-1lagjLfnC1I0iqH9plHYIUq3vDMfjhZsLy9elfK89RBcpcRcx4l+kRJBSnHh2Mh6kLxRHoObD1M5UTUbgFy6nA==" crossorigin="anonymous"></script> rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuid.min.js" integrity="sha512-UNM1njAgOFUa74Z0bADwAq8gbTcqZC8Ej4xPSzpnh0l6KMevwvkBvbldF9uR++qKeJ+MOZHRjV1HZjoRvjDfNQ==" crossorigin="anonymous"></script> <script crossorigin="anonymous"
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js" integrity="sha512-/yIGjYJZIXZx10ig0yhbK41OiwcqBUxIj0xQJe+NwkMIdS/u07b6Mwo0nvXB4o7A6WiKnKOf92JwE5Ezo27u9Q==" crossorigin="anonymous"></script> integrity="sha512-q2vREMvON/xrz1KuOj5QKWmdvcHtM4XNbNer+Qbf4TOj+RMDnul0Fg3VmmYprdf3fnL1gZgzKhZszsp62r5Ugg=="
<script src="https://alcdn.msauth.net/browser/2.7.0/js/msal-browser.js" integrity="sha384-5Fqyq1ncNYhL2mXCdWAFXkf2wWtKeA0mXYp++ryAX1lowD0ctAHFdity37L/ULXh" crossorigin="anonymous"></script> src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-beta1/js/bootstrap.bundle.min.js"></script>
<script crossorigin="anonymous"
integrity="sha512-1lagjLfnC1I0iqH9plHYIUq3vDMfjhZsLy9elfK89RBcpcRcx4l+kRJBSnHh2Mh6kLxRHoObD1M5UTUbgFy6nA=="
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.js"></script>
<script crossorigin="anonymous"
integrity="sha512-UNM1njAgOFUa74Z0bADwAq8gbTcqZC8Ej4xPSzpnh0l6KMevwvkBvbldF9uR++qKeJ+MOZHRjV1HZjoRvjDfNQ=="
src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuid.min.js"></script>
<script crossorigin="anonymous"
integrity="sha512-/yIGjYJZIXZx10ig0yhbK41OiwcqBUxIj0xQJe+NwkMIdS/u07b6Mwo0nvXB4o7A6WiKnKOf92JwE5Ezo27u9Q=="
src="https://cdnjs.cloudflare.com/ajax/libs/jsSHA/3.2.0/sha.min.js"></script>
<script crossorigin="anonymous"
integrity="sha384-5Fqyq1ncNYhL2mXCdWAFXkf2wWtKeA0mXYp++ryAX1lowD0ctAHFdity37L/ULXh"
src="https://alcdn.msauth.net/browser/2.7.0/js/msal-browser.js"></script>
<link href="style.css" rel="stylesheet"> <link href="style.css" rel="stylesheet">
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="javascript:">VIAaaS</a> <a class="navbar-brand" href="javascript:">VIAaaS</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler"
data-bs-target="#navbarSupportedContent" data-bs-toggle="collapse" type="button">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav nav" role="tablist"> <ul class="navbar-nav nav" role="tablist">
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link active" id="home-tab" data-bs-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Status</a> <a aria-controls="home" aria-selected="true" class="nav-link active" data-bs-toggle="tab" href="#home"
id="home-tab" role="tab">Status</a>
</li> </li>
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link" id="accounts-tab" data-bs-toggle="tab" href="#accounts" role="tab" aria-controls="accounts" aria-selected="false">Accounts</a> <a aria-controls="accounts" aria-selected="false" class="nav-link" data-bs-toggle="tab" href="#accounts"
id="accounts-tab" role="tab">Accounts</a>
</li> </li>
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a class="nav-link" id="settings-tab" data-bs-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a> <a aria-controls="settings" aria-selected="false" class="nav-link" data-bs-toggle="tab" href="#settings"
id="settings-tab" role="tab">Settings</a>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="aboutDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <a aria-expanded="false" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#"
id="aboutDropdown" role="button">
About About
</a> </a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="aboutDropdown"> <ul aria-labelledby="aboutDropdown" class="dropdown-menu dropdown-menu-dark">
<li><a class="dropdown-item" data-bs-toggle="modal" href="#aboutModal" role="tab">About VIAaaS</a></li> <li><a class="dropdown-item" data-bs-toggle="modal" href="#aboutModal" role="tab">About
VIAaaS</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -59,80 +78,92 @@
</div> </div>
</nav> </nav>
<div class="container tab-content" id="content"> <div class="container tab-content" id="content">
<div id="home" class="tab-pane fade show active" aria-labelledby="home-tab"> <div aria-labelledby="home-tab" class="tab-pane fade show active" id="home">
<p>WebSocket connection status: <span id="connection_status" class="text-white bg-dark">?</span></p> <p>WebSocket connection status: <span class="text-white bg-dark" id="connection_status">?</span></p>
<p>CORS Proxy status: <span id="cors_status" class="text-white bg-dark">?</span></p> <p>CORS Proxy status: <span class="text-white bg-dark" id="cors_status">?</span></p>
<hr> <hr>
<p><span id="actions"></span></p> <p><span id="actions"></span></p>
<p>Listening to logins from: <span id="listening"></span></p> <p>Listening to logins from: <span id="listening"></span></p>
</div> </div>
<div id="settings" class="tab-pane fade" aria-labelledby="settings-tab"> <div aria-labelledby="settings-tab" class="tab-pane fade" id="settings">
<div class="mb-3"> <div class="mb-3">
<label for="cors-proxy" class="form-label">CORS Proxy URL Prefix</label> <label class="form-label" for="cors-proxy">CORS Proxy URL Prefix</label>
<p>See <a href="https://github.com/ViaVersion/VIAaaS#cors-proxy">README</a> <p>See <a href="https://github.com/ViaVersion/VIAaaS#cors-proxy">README</a>
for setting up one. Mojang APIs are called through this proxy, and a remote IP address may look suspicious and block your account. for setting up one. Mojang APIs are called through this proxy, and a remote IP address may look
It will receive sensitive data like email, passwords and tokens. HTTPS is required for non-localhost addresses.</p> suspicious and block your account.
<input type="url" class="form-control" id="cors-proxy" placeholder="http://localhost:8080/"> It will receive sensitive data like email, passwords and tokens. HTTPS is required for non-localhost
addresses.</p>
<input class="form-control" id="cors-proxy" placeholder="http://localhost:8080/" type="url">
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="ws-url" class="form-label">WebSocket URL</label> <label class="form-label" for="ws-url">WebSocket URL</label>
<p>It exchanges sensitive data like minecraft.id tokens, server session hashes and usernames. WSS is required.</p> <p>It exchanges sensitive data like minecraft.id tokens, server session hashes and usernames. WSS is
<input type="url" class="form-control" id="ws-url" placeholder="wss://viaaas.example.com/ws"> required.</p>
<input class="form-control" id="ws-url" placeholder="wss://viaaas.example.com/ws" type="url">
</div> </div>
</div> </div>
<div id="accounts" class="tab-pane fade" aria-labelledby="accounts-tab"> <div aria-labelledby="accounts-tab" class="tab-pane fade" id="accounts">
<div> <div>
<p>Browser Minecraft accounts:</p> <p>Browser Minecraft accounts:</p>
<div id="accounts-list"></div> <div id="accounts-list"></div>
<hr> <hr>
</div> </div>
<div id="add-account"> <div id="add-account">
<label for="form_add_ms" class="mb-3">Add Microsoft account:</label> <label class="mb-3" for="form_add_ms">Add Microsoft account:</label>
<form id="form_add_ms" class="row"> <form class="row" id="form_add_ms">
<div class="col-auto"> <div class="col-auto">
<button id="login_submit_ms" type="submit" class="btn btn-primary mb-3">Login with Microsoft</button> <button class="btn btn-primary mb-3" id="login_submit_ms" type="submit">Login with Microsoft
</button>
</div> </div>
</form> </form>
<label for="form_add_mc" class="mb-3">Add Mojang account:</label> <label class="mb-3" for="form_add_mc">Add Mojang account:</label>
<form id="form_add_mc" class="row g-3"> <form class="row g-3" id="form_add_mc">
<div class="col-auto"> <div class="col-auto">
<label for="email" class="visually-hidden">Username/Email</label> <label class="visually-hidden" for="email">Username/Email</label>
<input type="text" id="email" name="email" class="form-control" placeholder="mc@example.com"> <input class="form-control" id="email" name="email" placeholder="mc@example.com" type="text">
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="password" class="visually-hidden">Password</label> <label class="visually-hidden" for="password">Password</label>
<input type="password" id="password" name="password" class="form-control" placeholder="password"> <input class="form-control" id="password" name="password" placeholder="password" type="password">
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button id="login_submit_mc" type="submit" class="btn btn-primary mb-3">Login with Minecraft</button> <button class="btn btn-primary mb-3" id="login_submit_mc" type="submit">Login with Minecraft
</button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="aboutModal" tabindex="-1" aria-labelledby="aboutModalLabel" aria-hidden="true"> <div aria-hidden="true" aria-labelledby="aboutModalLabel" class="modal fade" id="aboutModal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="aboutModalLabel">About</h5> <h5 class="modal-title" id="aboutModalLabel">About</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button aria-label="Close" class="btn-close" data-bs-dismiss="modal" type="button"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>Copyright © 2020-2021 <a href="https://github.com/creeper123123321">creeper123123321</a></p> <p>Copyright © 2020-2021 <a href="https://github.com/creeper123123321">creeper123123321</a></p>
<p>Copyright © 2021 <a href="https://github.com/ViaVersion/VIAaaS/graphs/contributors">contributors</a></p> <p>Copyright © 2021 <a href="https://github.com/ViaVersion/VIAaaS/graphs/contributors">contributors</a>
<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by </p>
the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p> <p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of Affero General Public License as published by
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.</p> the Free Software Foundation, either version 3 of the License, or (at your option) any later
<p>You should have received a copy of the GNU Affero General Public License along with this program. If not, see version.</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.</p>
<p>You should have received a copy of the GNU Affero General Public License along with this program. If
not, see
<a href="https://gnu.org/licenses">http://www.gnu.org/licenses/</a>.</p> <a href="https://gnu.org/licenses">http://www.gnu.org/licenses/</a>.</p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a role="button" type="button" class="btn btn-secondary" href="https://github.com/ViaVersion/VIAaaS/">Source Code</a> <a class="btn btn-secondary" href="https://github.com/ViaVersion/VIAaaS/" role="button" type="button">Source
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">Close</button> Code</a>
<button class="btn btn-primary" data-bs-dismiss="modal" type="button">Close</button>
</div> </div>
</div> </div>
</div> </div>