mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-21 11:55:15 +01:00
use Aspirin prefix instead of Cloud, use subcommand, add force online mode
This commit is contained in:
parent
58e8f689d9
commit
428d47a9b9
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.creeper123123321.viaaas
|
package com.github.creeper123123321.viaaas
|
||||||
|
|
||||||
import com.github.creeper123123321.viaaas.command.CloudCommands
|
import com.github.creeper123123321.viaaas.command.AspirinCommands
|
||||||
import com.github.creeper123123321.viaaas.command.VIAaaSConsole
|
import com.github.creeper123123321.viaaas.command.VIAaaSConsole
|
||||||
import com.github.creeper123123321.viaaas.config.VIAaaSConfig
|
import com.github.creeper123123321.viaaas.config.VIAaaSConfig
|
||||||
import com.github.creeper123123321.viaaas.handler.FrontEndInit
|
import com.github.creeper123123321.viaaas.handler.FrontEndInit
|
||||||
@ -12,7 +12,6 @@ import io.ktor.application.*
|
|||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import io.ktor.client.features.*
|
import io.ktor.client.features.*
|
||||||
import io.ktor.client.features.json.*
|
import io.ktor.client.features.json.*
|
||||||
import io.ktor.client.request.*
|
|
||||||
import io.ktor.network.tls.certificates.*
|
import io.ktor.network.tls.certificates.*
|
||||||
import io.ktor.server.engine.*
|
import io.ktor.server.engine.*
|
||||||
import io.ktor.server.netty.*
|
import io.ktor.server.netty.*
|
||||||
@ -45,7 +44,7 @@ import java.security.KeyPairGenerator
|
|||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
val viaaasVer = GsonUtil.getGson().fromJson(
|
val viaaasVer = GsonUtil.getGson().fromJson(
|
||||||
CloudPlatform::class.java.classLoader.getResourceAsStream("viaaas_info.json")!!.reader(Charsets.UTF_8).readText(),
|
AspirinPlatform::class.java.classLoader.getResourceAsStream("viaaas_info.json")!!.reader(Charsets.UTF_8).readText(),
|
||||||
JsonObject::class.java
|
JsonObject::class.java
|
||||||
).get("version").asString
|
).get("version").asString
|
||||||
val viaWebServer = WebDashboardServer()
|
val viaWebServer = WebDashboardServer()
|
||||||
@ -103,15 +102,15 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
Via.init(
|
Via.init(
|
||||||
ViaManager.builder()
|
ViaManager.builder()
|
||||||
.injector(CloudInjector)
|
.injector(AspirinInjector)
|
||||||
.loader(CloudLoader)
|
.loader(AspirinLoader)
|
||||||
.commandHandler(CloudCommands)
|
.commandHandler(AspirinCommands)
|
||||||
.platform(CloudPlatform).build()
|
.platform(AspirinPlatform).build()
|
||||||
)
|
)
|
||||||
MappingDataLoader.enableMappingsCache()
|
MappingDataLoader.enableMappingsCache()
|
||||||
Via.getManager().init()
|
Via.getManager().init()
|
||||||
CloudRewind.init(ViaRewindConfigImpl(File("config/viarewind.yml")))
|
AspirinRewind.init(ViaRewindConfigImpl(File("config/viarewind.yml")))
|
||||||
CloudBackwards.init(File("config/viabackwards"))
|
AspirinBackwards.init(File("config/viabackwards"))
|
||||||
|
|
||||||
val parent = eventLoopGroup()
|
val parent = eventLoopGroup()
|
||||||
val child = eventLoopGroup()
|
val child = eventLoopGroup()
|
||||||
@ -135,7 +134,7 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
initFuture.complete(Unit)
|
initFuture.complete(Unit)
|
||||||
|
|
||||||
VIAaaSConsole().start()
|
VIAaaSConsole.start()
|
||||||
|
|
||||||
ktorServer?.stop(1000, 1000)
|
ktorServer?.stop(1000, 1000)
|
||||||
httpClient.close()
|
httpClient.close()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.github.creeper123123321.viaaas.codec
|
package com.github.creeper123123321.viaaas.codec
|
||||||
|
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
import com.github.creeper123123321.viaaas.packet.Packet
|
import com.github.creeper123123321.viaaas.packet.Packet
|
||||||
import com.github.creeper123123321.viaaas.packet.PacketRegistry
|
import com.github.creeper123123321.viaaas.packet.PacketRegistry
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
@ -13,7 +13,7 @@ class MinecraftCodec : MessageToMessageCodec<ByteBuf, Packet>() {
|
|||||||
if (!ctx.channel().isActive) return
|
if (!ctx.channel().isActive) return
|
||||||
val buf = ByteBufAllocator.DEFAULT.buffer()
|
val buf = ByteBufAllocator.DEFAULT.buffer()
|
||||||
try {
|
try {
|
||||||
val handler = ctx.pipeline().get(CloudMinecraftHandler::class.java)
|
val handler = ctx.pipeline().get(MinecraftHandler::class.java)
|
||||||
PacketRegistry.encode(msg, buf, handler.data.frontVer!!)
|
PacketRegistry.encode(msg, buf, handler.data.frontVer!!)
|
||||||
out.add(buf.retain())
|
out.add(buf.retain())
|
||||||
} finally {
|
} finally {
|
||||||
@ -23,7 +23,7 @@ class MinecraftCodec : MessageToMessageCodec<ByteBuf, Packet>() {
|
|||||||
|
|
||||||
override fun decode(ctx: ChannelHandlerContext, msg: ByteBuf, out: MutableList<Any>) {
|
override fun decode(ctx: ChannelHandlerContext, msg: ByteBuf, out: MutableList<Any>) {
|
||||||
if (!ctx.channel().isActive || !msg.isReadable) return
|
if (!ctx.channel().isActive || !msg.isReadable) return
|
||||||
val handler = ctx.pipeline().get(CloudMinecraftHandler::class.java)
|
val handler = ctx.pipeline().get(MinecraftHandler::class.java)
|
||||||
out.add(
|
out.add(
|
||||||
PacketRegistry.decode(
|
PacketRegistry.decode(
|
||||||
msg,
|
msg,
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.github.creeper123123321.viaaas.command
|
||||||
|
|
||||||
|
import com.github.creeper123123321.viaaas.command.sub.ConnectionsSubCommand
|
||||||
|
import com.github.creeper123123321.viaaas.command.sub.EndSubCommand
|
||||||
|
import com.github.creeper123123321.viaaas.command.sub.VIAaaSSubCommand
|
||||||
|
import us.myles.ViaVersion.commands.ViaCommandHandler
|
||||||
|
|
||||||
|
object AspirinCommands : ViaCommandHandler() {
|
||||||
|
init {
|
||||||
|
registerSubCommand(EndSubCommand)
|
||||||
|
registerSubCommand(VIAaaSSubCommand)
|
||||||
|
registerSubCommand(ConnectionsSubCommand)
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
package com.github.creeper123123321.viaaas.command
|
|
||||||
|
|
||||||
import us.myles.ViaVersion.commands.ViaCommandHandler
|
|
||||||
|
|
||||||
object CloudCommands : ViaCommandHandler()
|
|
@ -1,9 +1,7 @@
|
|||||||
package com.github.creeper123123321.viaaas.command
|
package com.github.creeper123123321.viaaas.command
|
||||||
|
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
|
||||||
import com.github.creeper123123321.viaaas.runningServer
|
import com.github.creeper123123321.viaaas.runningServer
|
||||||
import com.github.creeper123123321.viaaas.viaaasLogger
|
import com.github.creeper123123321.viaaas.viaaasLogger
|
||||||
import com.github.creeper123123321.viaaas.viaaasVer
|
|
||||||
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
|
||||||
@ -11,16 +9,13 @@ import org.jline.reader.LineReaderBuilder
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import us.myles.ViaVersion.api.Via
|
import us.myles.ViaVersion.api.Via
|
||||||
import us.myles.ViaVersion.api.command.ViaCommandSender
|
import us.myles.ViaVersion.api.command.ViaCommandSender
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class VIAaaSConsole : SimpleTerminalConsole(), ViaCommandSender {
|
object VIAaaSConsole : SimpleTerminalConsole(), ViaCommandSender {
|
||||||
val commands = hashMapOf<String, (MutableList<String>?, String, Array<String>) -> Unit>()
|
val commands = hashMapOf<String, (MutableList<String>?, String, Array<String>) -> Unit>()
|
||||||
override fun isRunning(): Boolean = runningServer
|
override fun isRunning(): Boolean = runningServer
|
||||||
|
|
||||||
init {
|
init {
|
||||||
commands["stop"] = { suggestion, _, _ -> if (suggestion == null) this.shutdown() }
|
|
||||||
commands["end"] = commands["stop"]!!
|
|
||||||
commands["viaversion"] = { suggestion, _, args ->
|
commands["viaversion"] = { suggestion, _, args ->
|
||||||
if (suggestion == null) {
|
if (suggestion == null) {
|
||||||
Via.getManager().commandHandler.onCommand(this, args)
|
Via.getManager().commandHandler.onCommand(this, args)
|
||||||
@ -30,34 +25,15 @@ class VIAaaSConsole : SimpleTerminalConsole(), ViaCommandSender {
|
|||||||
}
|
}
|
||||||
commands["viaver"] = commands["viaversion"]!!
|
commands["viaver"] = commands["viaversion"]!!
|
||||||
commands["vvcloud"] = commands["viaversion"]!!
|
commands["vvcloud"] = commands["viaversion"]!!
|
||||||
|
commands["vvaas"] = commands["viaversion"]!!
|
||||||
|
commands["vvaspirin"] = commands["viaversion"]!!
|
||||||
|
commands["viaaas"] = commands["viaversion"]!!
|
||||||
commands["help"] = { suggestion, _, _ ->
|
commands["help"] = { suggestion, _, _ ->
|
||||||
if (suggestion == null) sendMessage(commands.entries.groupBy { it.value }.entries.joinToString(", ") {
|
if (suggestion == null) sendMessage(commands.entries.groupBy { it.value }.entries.joinToString(", ") {
|
||||||
it.value.joinToString("/") { it.key }
|
it.value.joinToString("/") { it.key }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
commands["?"] = commands["help"]!!
|
commands["?"] = commands["help"]!!
|
||||||
commands["ver"] = { suggestion, _, _ ->
|
|
||||||
if (suggestion == null) sendMessage(viaaasVer)
|
|
||||||
}
|
|
||||||
commands["list"] = { suggestion, _, _ ->
|
|
||||||
if (suggestion == null) {
|
|
||||||
sendMessage("List of player connections: ")
|
|
||||||
Via.getPlatform().connectionManager.connections.forEach {
|
|
||||||
val backAddr = it.channel?.remoteAddress()
|
|
||||||
val pVer = it.protocolInfo?.protocolVersion?.let {
|
|
||||||
ProtocolVersion.getProtocol(it)
|
|
||||||
}
|
|
||||||
val backName = it.protocolInfo?.username
|
|
||||||
val backVer = it.protocolInfo?.serverProtocolVersion?.let {
|
|
||||||
ProtocolVersion.getProtocol(it)
|
|
||||||
}
|
|
||||||
val pAddr =
|
|
||||||
it.channel?.pipeline()?.get(CloudMinecraftHandler::class.java)?.other?.remoteAddress()
|
|
||||||
val pName = it.channel?.pipeline()?.get(CloudMinecraftHandler::class.java)?.data?.frontName
|
|
||||||
sendMessage("$pAddr $pVer ($pName) -> $backVer ($backName) $backAddr")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildReader(builder: LineReaderBuilder): LineReader {
|
override fun buildReader(builder: LineReaderBuilder): LineReader {
|
||||||
@ -100,7 +76,7 @@ class VIAaaSConsole : SimpleTerminalConsole(), ViaCommandSender {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun shutdown() {
|
public override fun shutdown() {
|
||||||
viaaasLogger.info("Shutting down...")
|
viaaasLogger.info("Shutting down...")
|
||||||
runningServer = false
|
runningServer = false
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.github.creeper123123321.viaaas.command.sub
|
||||||
|
|
||||||
|
import com.github.creeper123123321.viaaas.command.VIAaaSConsole
|
||||||
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
|
import us.myles.ViaVersion.api.Via
|
||||||
|
import us.myles.ViaVersion.api.command.ViaCommandSender
|
||||||
|
import us.myles.ViaVersion.api.command.ViaSubCommand
|
||||||
|
import us.myles.ViaVersion.api.protocol.ProtocolVersion
|
||||||
|
|
||||||
|
object ConnectionsSubCommand : ViaSubCommand() {
|
||||||
|
override fun name(): String = "connections"
|
||||||
|
override fun description(): String = "Lists VIAaaS connections"
|
||||||
|
override fun execute(p0: ViaCommandSender, p1: Array<out String>): Boolean {
|
||||||
|
p0.sendMessage("List of player connections: ")
|
||||||
|
Via.getPlatform().connectionManager.connections.forEach {
|
||||||
|
val backAddr = it.channel?.remoteAddress()
|
||||||
|
val pVer = it.protocolInfo?.protocolVersion?.let {
|
||||||
|
ProtocolVersion.getProtocol(it)
|
||||||
|
}
|
||||||
|
val backName = it.protocolInfo?.username
|
||||||
|
val backVer = it.protocolInfo?.serverProtocolVersion?.let {
|
||||||
|
ProtocolVersion.getProtocol(it)
|
||||||
|
}
|
||||||
|
val pAddr =
|
||||||
|
it.channel?.pipeline()?.get(MinecraftHandler::class.java)?.other?.remoteAddress()
|
||||||
|
val pName = it.channel?.pipeline()?.get(MinecraftHandler::class.java)?.data?.frontName
|
||||||
|
p0.sendMessage("$pAddr $pVer ($pName) -> $backVer ($backName) $backAddr")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.github.creeper123123321.viaaas.command.sub
|
||||||
|
|
||||||
|
import com.github.creeper123123321.viaaas.command.VIAaaSConsole
|
||||||
|
import us.myles.ViaVersion.api.command.ViaCommandSender
|
||||||
|
import us.myles.ViaVersion.api.command.ViaSubCommand
|
||||||
|
|
||||||
|
object EndSubCommand : ViaSubCommand() {
|
||||||
|
override fun name() = "stop"
|
||||||
|
override fun description(): String = "Stops VIAaaS"
|
||||||
|
override fun execute(p0: ViaCommandSender?, p1: Array<out String>?): Boolean {
|
||||||
|
VIAaaSConsole.shutdown()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.github.creeper123123321.viaaas.command.sub
|
||||||
|
|
||||||
|
import com.github.creeper123123321.viaaas.viaaasVer
|
||||||
|
import us.myles.ViaVersion.api.command.ViaCommandSender
|
||||||
|
import us.myles.ViaVersion.api.command.ViaSubCommand
|
||||||
|
|
||||||
|
object VIAaaSSubCommand : ViaSubCommand() {
|
||||||
|
override fun name(): String = "viaaas"
|
||||||
|
override fun description(): String = "Info about VIAaaS"
|
||||||
|
override fun execute(p0: ViaCommandSender, p1: Array<out String>): Boolean {
|
||||||
|
p0.sendMessage("VIAaaS version $viaaasVer")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ import us.myles.ViaVersion.AbstractViaConfig
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
object CloudViaConfig : AbstractViaConfig(File("config/viaversion.yml")) {
|
object AspirinViaConfig : AbstractViaConfig(File("config/viaversion.yml")) {
|
||||||
// https://github.com/ViaVersion/ViaFabric/blob/mc-1.16/src/main/java/com/github/creeper123123321/viafabric/platform/VRViaConfig.java
|
// https://github.com/ViaVersion/ViaFabric/blob/mc-1.16/src/main/java/com/github/creeper123123321/viafabric/platform/VRViaConfig.java
|
||||||
override fun getDefaultConfigURL(): URL = javaClass.classLoader.getResource("assets/viaversion/config.yml")!!
|
override fun getDefaultConfigURL(): URL = javaClass.classLoader.getResource("assets/viaversion/config.yml")!!
|
||||||
|
|
@ -34,4 +34,5 @@ object VIAaaSConfig : Config(File("config/viaaas.yml")) {
|
|||||||
List::class.java,
|
List::class.java,
|
||||||
emptyList<String>()
|
emptyList<String>()
|
||||||
)!!.map { it as String }
|
)!!.map { it as String }
|
||||||
|
val forceOnlineMode: Boolean get() = this.getBoolean("force-online-mode", false)
|
||||||
}
|
}
|
@ -17,8 +17,8 @@ class BackEndInit(val connectionData: ConnectionData) : ChannelInitializer<Chann
|
|||||||
// "crypto"
|
// "crypto"
|
||||||
.addLast("frame", FrameCodec())
|
.addLast("frame", FrameCodec())
|
||||||
// compress
|
// compress
|
||||||
.addLast("via-codec", CloudViaCodec(user))
|
.addLast("via-codec", ViaCodec(user))
|
||||||
.addLast("mc", MinecraftCodec())
|
.addLast("mc", MinecraftCodec())
|
||||||
.addLast("handler", CloudMinecraftHandler(connectionData, connectionData.frontChannel, frontEnd = false))
|
.addLast("handler", MinecraftHandler(connectionData, connectionData.frontChannel, frontEnd = false))
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,6 @@ class ConnectionData(
|
|||||||
var frontVer: Int? = null,
|
var frontVer: Int? = null,
|
||||||
var backVer: Int? = null,
|
var backVer: Int? = null,
|
||||||
) {
|
) {
|
||||||
val frontHandler get() = frontChannel.pipeline().get(CloudMinecraftHandler::class.java)
|
val frontHandler get() = frontChannel.pipeline().get(MinecraftHandler::class.java)
|
||||||
val backHandler get() = backChannel?.pipeline()?.get(CloudMinecraftHandler::class.java)
|
val backHandler get() = backChannel?.pipeline()?.get(MinecraftHandler::class.java)
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ object FrontEndInit : ChannelInitializer<Channel>() {
|
|||||||
.addLast("flow-handler", FlowControlHandler())
|
.addLast("flow-handler", FlowControlHandler())
|
||||||
.addLast("mc", MinecraftCodec())
|
.addLast("mc", MinecraftCodec())
|
||||||
.addLast(
|
.addLast(
|
||||||
"handler", CloudMinecraftHandler(
|
"handler", MinecraftHandler(
|
||||||
ConnectionData(frontChannel = ch), other = null, frontEnd = true
|
ConnectionData(frontChannel = ch), other = null, frontEnd = true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,7 @@ import io.netty.channel.SimpleChannelInboundHandler
|
|||||||
import us.myles.ViaVersion.exception.CancelCodecException
|
import us.myles.ViaVersion.exception.CancelCodecException
|
||||||
import java.net.SocketAddress
|
import java.net.SocketAddress
|
||||||
|
|
||||||
class CloudMinecraftHandler(
|
class MinecraftHandler(
|
||||||
val data: ConnectionData,
|
val data: ConnectionData,
|
||||||
var other: Channel?,
|
var other: Channel?,
|
||||||
val frontEnd: Boolean
|
val frontEnd: Boolean
|
@ -4,6 +4,6 @@ import com.github.creeper123123321.viaaas.packet.Packet
|
|||||||
import com.github.creeper123123321.viaaas.send
|
import com.github.creeper123123321.viaaas.send
|
||||||
|
|
||||||
|
|
||||||
fun forward(handler: CloudMinecraftHandler, packet: Packet, flush: Boolean = false) {
|
fun forward(handler: MinecraftHandler, packet: Packet, flush: Boolean = false) {
|
||||||
send(handler.other!!, packet, flush)
|
send(handler.other!!, packet, flush)
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ import us.myles.ViaVersion.api.data.UserConnection
|
|||||||
import us.myles.ViaVersion.exception.CancelDecoderException
|
import us.myles.ViaVersion.exception.CancelDecoderException
|
||||||
import us.myles.ViaVersion.exception.CancelEncoderException
|
import us.myles.ViaVersion.exception.CancelEncoderException
|
||||||
|
|
||||||
class CloudViaCodec(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>) {
|
||||||
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null)
|
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null)
|
||||||
if (!info.shouldTransformPacket()) {
|
if (!info.shouldTransformPacket()) {
|
@ -5,7 +5,7 @@ import com.github.creeper123123321.viaaas.packet.handshake.Handshake
|
|||||||
import com.github.creeper123123321.viaaas.packet.Packet
|
import com.github.creeper123123321.viaaas.packet.Packet
|
||||||
import com.github.creeper123123321.viaaas.config.VIAaaSConfig
|
import com.github.creeper123123321.viaaas.config.VIAaaSConfig
|
||||||
import com.github.creeper123123321.viaaas.handler.BackEndInit
|
import com.github.creeper123123321.viaaas.handler.BackEndInit
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
import com.github.creeper123123321.viaaas.handler.forward
|
import com.github.creeper123123321.viaaas.handler.forward
|
||||||
import io.netty.bootstrap.Bootstrap
|
import io.netty.bootstrap.Bootstrap
|
||||||
import io.netty.channel.ChannelFuture
|
import io.netty.channel.ChannelFuture
|
||||||
@ -20,7 +20,7 @@ import java.net.InetAddress
|
|||||||
import java.net.InetSocketAddress
|
import java.net.InetSocketAddress
|
||||||
|
|
||||||
class HandshakeState : MinecraftConnectionState {
|
class HandshakeState : MinecraftConnectionState {
|
||||||
fun connectBack(handler: CloudMinecraftHandler, socketAddr: InetSocketAddress): ChannelFuture {
|
fun connectBack(handler: MinecraftHandler, socketAddr: InetSocketAddress): ChannelFuture {
|
||||||
return Bootstrap()
|
return Bootstrap()
|
||||||
.handler(BackEndInit(handler.data))
|
.handler(BackEndInit(handler.data))
|
||||||
.channelFactory(channelSocketFactory())
|
.channelFactory(channelSocketFactory())
|
||||||
@ -34,7 +34,7 @@ class HandshakeState : MinecraftConnectionState {
|
|||||||
override val state: State
|
override val state: State
|
||||||
get() = State.HANDSHAKE
|
get() = State.HANDSHAKE
|
||||||
|
|
||||||
override fun handlePacket(handler: CloudMinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
override fun handlePacket(handler: MinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
||||||
if (packet !is Handshake) throw IllegalArgumentException("Invalid packet!")
|
if (packet !is Handshake) throw IllegalArgumentException("Invalid packet!")
|
||||||
|
|
||||||
handler.data.frontVer = packet.protocolId
|
handler.data.frontVer = packet.protocolId
|
||||||
@ -57,6 +57,7 @@ class HandshakeState : MinecraftConnectionState {
|
|||||||
|
|
||||||
handler.data.backVer = backProto
|
handler.data.backVer = backProto
|
||||||
handler.data.frontOnline = parsed.online
|
handler.data.frontOnline = parsed.online
|
||||||
|
if (VIAaaSConfig.forceOnlineMode) handler.data.frontOnline = true
|
||||||
handler.data.backName = parsed.username
|
handler.data.backName = parsed.username
|
||||||
|
|
||||||
val playerAddr = handler.data.frontHandler.remoteAddress
|
val playerAddr = handler.data.frontHandler.remoteAddress
|
||||||
@ -108,11 +109,11 @@ class HandshakeState : MinecraftConnectionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun disconnect(handler: CloudMinecraftHandler, msg: String) {
|
override fun disconnect(handler: MinecraftHandler, msg: String) {
|
||||||
handler.data.frontChannel.close() // Not worth logging
|
handler.data.frontChannel.close() // Not worth logging
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInactivated(handler: CloudMinecraftHandler) {
|
override fun onInactivated(handler: MinecraftHandler) {
|
||||||
// Not worth logging
|
// Not worth logging
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ import com.github.creeper123123321.viaaas.codec.CompressionCodec
|
|||||||
import com.github.creeper123123321.viaaas.codec.CryptoCodec
|
import com.github.creeper123123321.viaaas.codec.CryptoCodec
|
||||||
import com.github.creeper123123321.viaaas.packet.*
|
import com.github.creeper123123321.viaaas.packet.*
|
||||||
import com.github.creeper123123321.viaaas.packet.login.*
|
import com.github.creeper123123321.viaaas.packet.login.*
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
import com.github.creeper123123321.viaaas.handler.forward
|
import com.github.creeper123123321.viaaas.handler.forward
|
||||||
import com.google.common.net.UrlEscapers
|
import com.google.common.net.UrlEscapers
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
@ -27,7 +27,7 @@ class LoginState : MinecraftConnectionState {
|
|||||||
override val state: State
|
override val state: State
|
||||||
get() = State.LOGIN
|
get() = State.LOGIN
|
||||||
|
|
||||||
override fun handlePacket(handler: CloudMinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
override fun handlePacket(handler: MinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
||||||
when (packet) {
|
when (packet) {
|
||||||
is LoginStart -> handleLoginStart(handler, packet)
|
is LoginStart -> handleLoginStart(handler, packet)
|
||||||
is CryptoResponse -> handleCryptoResponse(handler, packet)
|
is CryptoResponse -> handleCryptoResponse(handler, packet)
|
||||||
@ -41,16 +41,16 @@ class LoginState : MinecraftConnectionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleLoginSuccess(handler: CloudMinecraftHandler, loginSuccess: LoginSuccess) {
|
private fun handleLoginSuccess(handler: MinecraftHandler, loginSuccess: LoginSuccess) {
|
||||||
handler.data.state = PlayState
|
handler.data.state = PlayState
|
||||||
forward(handler, loginSuccess)
|
forward(handler, loginSuccess)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleCompression(handler: CloudMinecraftHandler, setCompression: SetCompression) {
|
private fun handleCompression(handler: MinecraftHandler, setCompression: SetCompression) {
|
||||||
val pipe = handler.data.frontChannel.pipeline()
|
val pipe = handler.data.frontChannel.pipeline()
|
||||||
val threshold = setCompression.threshold
|
val threshold = setCompression.threshold
|
||||||
|
|
||||||
val backPipe = pipe.get(CloudMinecraftHandler::class.java).other!!.pipeline()
|
val backPipe = pipe.get(MinecraftHandler::class.java).other!!.pipeline()
|
||||||
if (threshold != -1) {
|
if (threshold != -1) {
|
||||||
backPipe.addAfter("frame", "compress", CompressionCodec(threshold))
|
backPipe.addAfter("frame", "compress", CompressionCodec(threshold))
|
||||||
} else if (backPipe.get("compress") != null) {
|
} else if (backPipe.get("compress") != null) {
|
||||||
@ -67,7 +67,7 @@ class LoginState : MinecraftConnectionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun authenticateOnlineFront(frontHandler: CloudMinecraftHandler) {
|
fun authenticateOnlineFront(frontHandler: MinecraftHandler) {
|
||||||
val id = "VIAaaS" + ByteArray(10).let {
|
val id = "VIAaaS" + ByteArray(10).let {
|
||||||
secureRandom.nextBytes(it)
|
secureRandom.nextBytes(it)
|
||||||
Base64.getEncoder().withoutPadding().encodeToString(it)
|
Base64.getEncoder().withoutPadding().encodeToString(it)
|
||||||
@ -89,7 +89,7 @@ class LoginState : MinecraftConnectionState {
|
|||||||
send(frontHandler.data.frontChannel, cryptoRequest, true)
|
send(frontHandler.data.frontChannel, cryptoRequest, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleCryptoRequest(handler: CloudMinecraftHandler, cryptoRequest: CryptoRequest) {
|
fun handleCryptoRequest(handler: MinecraftHandler, cryptoRequest: CryptoRequest) {
|
||||||
val data = handler.data
|
val data = handler.data
|
||||||
val backServerId = cryptoRequest.serverId
|
val backServerId = cryptoRequest.serverId
|
||||||
val backPublicKey = cryptoRequest.publicKey
|
val backPublicKey = cryptoRequest.publicKey
|
||||||
@ -140,7 +140,7 @@ class LoginState : MinecraftConnectionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleCryptoResponse(handler: CloudMinecraftHandler, cryptoResponse: CryptoResponse) {
|
fun handleCryptoResponse(handler: MinecraftHandler, cryptoResponse: CryptoResponse) {
|
||||||
val frontHash = let {
|
val frontHash = let {
|
||||||
val frontKey = decryptRsa(mcCryptoKey.private, cryptoResponse.encryptedKey)
|
val frontKey = decryptRsa(mcCryptoKey.private, cryptoResponse.encryptedKey)
|
||||||
// RSA token - wat??? why is it encrypted with RSA if it was sent unencrypted?
|
// RSA token - wat??? why is it encrypted with RSA if it was sent unencrypted?
|
||||||
@ -175,7 +175,7 @@ class LoginState : MinecraftConnectionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleLoginStart(handler: CloudMinecraftHandler, loginStart: LoginStart) {
|
fun handleLoginStart(handler: MinecraftHandler, loginStart: LoginStart) {
|
||||||
if (loginStart.username.length > 16) throw badLength
|
if (loginStart.username.length > 16) throw badLength
|
||||||
if (handler.data.frontName != null) throw IllegalStateException("Login already started")
|
if (handler.data.frontName != null) throw IllegalStateException("Login already started")
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ class LoginState : MinecraftConnectionState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun disconnect(handler: CloudMinecraftHandler, msg: String) {
|
override fun disconnect(handler: MinecraftHandler, msg: String) {
|
||||||
super.disconnect(handler, msg)
|
super.disconnect(handler, msg)
|
||||||
|
|
||||||
val packet = LoginDisconnect()
|
val packet = LoginDisconnect()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.github.creeper123123321.viaaas.handler.state
|
package com.github.creeper123123321.viaaas.handler.state
|
||||||
|
|
||||||
import com.github.creeper123123321.viaaas.packet.Packet
|
import com.github.creeper123123321.viaaas.packet.Packet
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
import com.github.creeper123123321.viaaas.mcLogger
|
import com.github.creeper123123321.viaaas.mcLogger
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import us.myles.ViaVersion.packets.State
|
import us.myles.ViaVersion.packets.State
|
||||||
@ -9,15 +9,15 @@ import us.myles.ViaVersion.packets.State
|
|||||||
interface MinecraftConnectionState {
|
interface MinecraftConnectionState {
|
||||||
val state: State
|
val state: State
|
||||||
fun handlePacket(
|
fun handlePacket(
|
||||||
handler: CloudMinecraftHandler, ctx: ChannelHandlerContext,
|
handler: MinecraftHandler, ctx: ChannelHandlerContext,
|
||||||
packet: Packet
|
packet: Packet
|
||||||
)
|
)
|
||||||
|
|
||||||
fun disconnect(handler: CloudMinecraftHandler, msg: String) {
|
fun disconnect(handler: MinecraftHandler, msg: String) {
|
||||||
mcLogger.info("Disconnected ${handler.remoteAddress}: $msg")
|
mcLogger.info("Disconnected ${handler.remoteAddress}: $msg")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onInactivated(handler: CloudMinecraftHandler) {
|
fun onInactivated(handler: MinecraftHandler) {
|
||||||
mcLogger.info(handler.remoteAddress?.toString() + " inactivated")
|
mcLogger.info(handler.remoteAddress?.toString() + " inactivated")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@ package com.github.creeper123123321.viaaas.handler.state
|
|||||||
|
|
||||||
import com.github.creeper123123321.viaaas.packet.Packet
|
import com.github.creeper123123321.viaaas.packet.Packet
|
||||||
import com.github.creeper123123321.viaaas.packet.UnknownPacket
|
import com.github.creeper123123321.viaaas.packet.UnknownPacket
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
import com.github.creeper123123321.viaaas.handler.forward
|
import com.github.creeper123123321.viaaas.handler.forward
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import us.myles.ViaVersion.packets.State
|
import us.myles.ViaVersion.packets.State
|
||||||
@ -11,12 +11,12 @@ object PlayState : MinecraftConnectionState {
|
|||||||
override val state: State
|
override val state: State
|
||||||
get() = State.PLAY
|
get() = State.PLAY
|
||||||
|
|
||||||
override fun handlePacket(handler: CloudMinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
override fun handlePacket(handler: MinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
||||||
if ((packet as UnknownPacket).id !in 0..127) throw IllegalArgumentException("Invalid packet id!")
|
if ((packet as UnknownPacket).id !in 0..127) throw IllegalArgumentException("Invalid packet id!")
|
||||||
forward(handler, packet)
|
forward(handler, packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun disconnect(handler: CloudMinecraftHandler, msg: String) {
|
override fun disconnect(handler: MinecraftHandler, msg: String) {
|
||||||
super.disconnect(handler, msg)
|
super.disconnect(handler, msg)
|
||||||
handler.data.frontChannel.close()
|
handler.data.frontChannel.close()
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.github.creeper123123321.viaaas.handler.state
|
|||||||
import com.github.creeper123123321.viaaas.packet.Packet
|
import com.github.creeper123123321.viaaas.packet.Packet
|
||||||
import com.github.creeper123123321.viaaas.packet.status.StatusResponse
|
import com.github.creeper123123321.viaaas.packet.status.StatusResponse
|
||||||
import com.github.creeper123123321.viaaas.packet.UnknownPacket
|
import com.github.creeper123123321.viaaas.packet.UnknownPacket
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
import com.github.creeper123123321.viaaas.handler.forward
|
import com.github.creeper123123321.viaaas.handler.forward
|
||||||
import com.github.creeper123123321.viaaas.writeFlushClose
|
import com.github.creeper123123321.viaaas.writeFlushClose
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
@ -14,12 +14,12 @@ object StatusState : MinecraftConnectionState {
|
|||||||
override val state: State
|
override val state: State
|
||||||
get() = State.STATUS
|
get() = State.STATUS
|
||||||
|
|
||||||
override fun handlePacket(handler: CloudMinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
override fun handlePacket(handler: MinecraftHandler, ctx: ChannelHandlerContext, packet: Packet) {
|
||||||
if (packet is UnknownPacket) throw IllegalArgumentException("Invalid packet")
|
if (packet is UnknownPacket) throw IllegalArgumentException("Invalid packet")
|
||||||
forward(handler, packet)
|
forward(handler, packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun disconnect(handler: CloudMinecraftHandler, msg: String) {
|
override fun disconnect(handler: MinecraftHandler, msg: String) {
|
||||||
super.disconnect(handler, msg)
|
super.disconnect(handler, msg)
|
||||||
|
|
||||||
val packet = StatusResponse()
|
val packet = StatusResponse()
|
||||||
|
@ -6,7 +6,7 @@ import us.myles.ViaVersion.sponge.util.LoggerWrapper
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
object CloudBackwards : ViaBackwardsPlatform {
|
object AspirinBackwards : ViaBackwardsPlatform {
|
||||||
val log = LoggerWrapper(LoggerFactory.getLogger("ViaBackwards"))
|
val log = LoggerWrapper(LoggerFactory.getLogger("ViaBackwards"))
|
||||||
override fun getDataFolder() = File("config/viabackwards")
|
override fun getDataFolder() = File("config/viabackwards")
|
||||||
override fun getLogger(): Logger = log
|
override fun getLogger(): Logger = log
|
@ -4,5 +4,5 @@ import us.myles.ViaVersion.api.boss.BossColor
|
|||||||
import us.myles.ViaVersion.api.boss.BossStyle
|
import us.myles.ViaVersion.api.boss.BossStyle
|
||||||
import us.myles.ViaVersion.boss.CommonBoss
|
import us.myles.ViaVersion.boss.CommonBoss
|
||||||
|
|
||||||
class CloudBossBar(title: String, health: Float, style: BossStyle, color: BossColor) :
|
class AspirinBossBar(title: String, health: Float, style: BossStyle, color: BossColor) :
|
||||||
CommonBoss<Unit>(title, health, color, style)
|
CommonBoss<Unit>(title, health, color, style)
|
@ -3,17 +3,15 @@ package com.github.creeper123123321.viaaas.platform
|
|||||||
import us.myles.ViaVersion.api.platform.ViaInjector
|
import us.myles.ViaVersion.api.platform.ViaInjector
|
||||||
import us.myles.viaversion.libs.gson.JsonObject
|
import us.myles.viaversion.libs.gson.JsonObject
|
||||||
|
|
||||||
object CloudInjector : ViaInjector {
|
object AspirinInjector : ViaInjector {
|
||||||
override fun getEncoderName(): String = "via-codec"
|
override fun getEncoderName(): String = "via-codec"
|
||||||
override fun getDecoderName() = "via-codec"
|
override fun getDecoderName() = "via-codec"
|
||||||
override fun getDump(): JsonObject = JsonObject()
|
override fun getDump(): JsonObject = JsonObject()
|
||||||
|
override fun getServerProtocolVersion() = 47 // Dummy
|
||||||
|
|
||||||
override fun uninject() {
|
override fun uninject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun inject() {
|
override fun inject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun getServerProtocolVersion() = 47 // Dummy
|
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
package com.github.creeper123123321.viaaas.platform
|
package com.github.creeper123123321.viaaas.platform
|
||||||
|
|
||||||
import com.github.creeper123123321.viaaas.provider.CloudVersionProvider
|
import com.github.creeper123123321.viaaas.provider.AspirinVersionProvider
|
||||||
import us.myles.ViaVersion.api.Via
|
import us.myles.ViaVersion.api.Via
|
||||||
import us.myles.ViaVersion.api.platform.ViaPlatformLoader
|
import us.myles.ViaVersion.api.platform.ViaPlatformLoader
|
||||||
import us.myles.ViaVersion.bungee.providers.BungeeMovementTransmitter
|
import us.myles.ViaVersion.bungee.providers.BungeeMovementTransmitter
|
||||||
import us.myles.ViaVersion.protocols.base.VersionProvider
|
import us.myles.ViaVersion.protocols.base.VersionProvider
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider
|
||||||
|
|
||||||
object CloudLoader : ViaPlatformLoader {
|
object AspirinLoader : ViaPlatformLoader {
|
||||||
override fun unload() {
|
override fun unload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun load() {
|
override fun load() {
|
||||||
Via.getManager().providers.use(MovementTransmitterProvider::class.java, BungeeMovementTransmitter())
|
Via.getManager().providers.use(MovementTransmitterProvider::class.java, BungeeMovementTransmitter())
|
||||||
Via.getManager().providers.use(VersionProvider::class.java, CloudVersionProvider)
|
Via.getManager().providers.use(VersionProvider::class.java, AspirinVersionProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
package com.github.creeper123123321.viaaas.platform
|
package com.github.creeper123123321.viaaas.platform
|
||||||
|
|
||||||
import com.github.creeper123123321.viaaas.*
|
import com.github.creeper123123321.viaaas.config.AspirinViaConfig
|
||||||
import com.github.creeper123123321.viaaas.config.CloudViaConfig
|
import com.github.creeper123123321.viaaas.initFuture
|
||||||
|
import com.github.creeper123123321.viaaas.viaaasVer
|
||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder
|
import com.google.common.util.concurrent.ThreadFactoryBuilder
|
||||||
import io.netty.channel.DefaultEventLoop
|
import io.netty.channel.DefaultEventLoop
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
@ -22,7 +23,7 @@ import java.util.concurrent.Executors
|
|||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
object CloudPlatform : ViaPlatform<Unit> {
|
object AspirinPlatform : ViaPlatform<Unit> {
|
||||||
val connMan = ViaConnectionManager()
|
val connMan = ViaConnectionManager()
|
||||||
val executor = Executors.newCachedThreadPool(ThreadFactoryBuilder().setNameFormat("Via-%d").setDaemon(true).build())
|
val executor = Executors.newCachedThreadPool(ThreadFactoryBuilder().setNameFormat("Via-%d").setDaemon(true).build())
|
||||||
val eventLoop = DefaultEventLoop(executor)
|
val eventLoop = DefaultEventLoop(executor)
|
||||||
@ -35,32 +36,31 @@ object CloudPlatform : ViaPlatform<Unit> {
|
|||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun kickPlayer(p0: UUID, p1: String): Boolean = false // todo
|
|
||||||
override fun getApi(): ViaAPI<Unit> = CloudViaAPI
|
|
||||||
override fun getDataFolder(): File = File("viaversion")
|
|
||||||
override fun getConf(): ViaVersionConfig = CloudViaConfig
|
|
||||||
override fun onReload() {
|
override fun onReload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun runSync(runnable: Runnable): TaskId = AspirinTask(eventLoop.submit(runnable))
|
||||||
|
override fun runSync(p0: Runnable, p1: Long): TaskId =
|
||||||
|
AspirinTask(eventLoop.schedule(p0, p1 * 50L, TimeUnit.MILLISECONDS))
|
||||||
|
|
||||||
|
override fun runRepeatingSync(p0: Runnable, p1: Long): TaskId =
|
||||||
|
AspirinTask(eventLoop.scheduleAtFixedRate(p0, 0, p1 * 50L, TimeUnit.MILLISECONDS))
|
||||||
|
|
||||||
|
override fun cancelTask(p0: TaskId?) {
|
||||||
|
(p0 as AspirinTask).obj.cancel(false)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getDump(): JsonObject = JsonObject()
|
override fun getDump(): JsonObject = JsonObject()
|
||||||
override fun runSync(runnable: Runnable): TaskId = CloudTask(eventLoop.submit(runnable))
|
override fun kickPlayer(p0: UUID, p1: String): Boolean = false
|
||||||
override fun runSync(p0: Runnable, p1: Long): TaskId =
|
override fun getApi(): ViaAPI<Unit> = AspirinViaAPI
|
||||||
CloudTask(eventLoop.schedule(p0, p1 * 50L, TimeUnit.MILLISECONDS))
|
override fun getDataFolder(): File = File("viaversion")
|
||||||
|
override fun getConf(): ViaVersionConfig = AspirinViaConfig
|
||||||
override fun runRepeatingSync(p0: Runnable, p1: Long): TaskId =
|
override fun runAsync(p0: Runnable): TaskId = AspirinTask(CompletableFuture.runAsync(p0, executor))
|
||||||
CloudTask(eventLoop.scheduleAtFixedRate(p0, 0, p1 * 50L, TimeUnit.MILLISECONDS))
|
|
||||||
|
|
||||||
override fun runAsync(p0: Runnable): TaskId = CloudTask(CompletableFuture.runAsync(p0, executor))
|
|
||||||
override fun getLogger(): Logger = LoggerWrapper(LoggerFactory.getLogger("ViaVersion"))
|
override fun getLogger(): Logger = LoggerWrapper(LoggerFactory.getLogger("ViaVersion"))
|
||||||
override fun getConnectionManager(): ViaConnectionManager = connMan
|
override fun getConnectionManager(): ViaConnectionManager = connMan
|
||||||
override fun getOnlinePlayers(): Array<ViaCommandSender> = arrayOf()
|
override fun getOnlinePlayers(): Array<ViaCommandSender> = arrayOf()
|
||||||
override fun cancelTask(p0: TaskId?) {
|
|
||||||
(p0 as CloudTask).obj.cancel(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isPluginEnabled(): Boolean = true
|
override fun isPluginEnabled(): Boolean = true
|
||||||
override fun getConfigurationProvider(): ConfigurationProvider = CloudViaConfig
|
override fun getConfigurationProvider(): ConfigurationProvider = AspirinViaConfig
|
||||||
|
|
||||||
override fun getPlatformName(): String = "VIAaaS"
|
override fun getPlatformName(): String = "VIAaaS"
|
||||||
override fun getPlatformVersion(): String = viaaasVer
|
override fun getPlatformVersion(): String = viaaasVer
|
||||||
override fun getPluginVersion(): String = VersionInfo.VERSION
|
override fun getPluginVersion(): String = VersionInfo.VERSION
|
@ -5,7 +5,7 @@ import org.slf4j.LoggerFactory
|
|||||||
import us.myles.ViaVersion.sponge.util.LoggerWrapper
|
import us.myles.ViaVersion.sponge.util.LoggerWrapper
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
object CloudRewind : ViaRewindPlatform {
|
object AspirinRewind : ViaRewindPlatform {
|
||||||
val log = LoggerWrapper(LoggerFactory.getLogger("ViaRewind"))
|
val log = LoggerWrapper(LoggerFactory.getLogger("ViaRewind"))
|
||||||
override fun getLogger(): Logger = log
|
override fun getLogger(): Logger = log
|
||||||
}
|
}
|
@ -3,6 +3,6 @@ package com.github.creeper123123321.viaaas.platform
|
|||||||
import us.myles.ViaVersion.api.platform.TaskId
|
import us.myles.ViaVersion.api.platform.TaskId
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
|
|
||||||
class CloudTask(val obj: Future<*>) : TaskId {
|
class AspirinTask(val obj: Future<*>) : TaskId {
|
||||||
override fun getObject(): Any = obj
|
override fun getObject(): Any = obj
|
||||||
}
|
}
|
@ -9,14 +9,14 @@ import us.myles.ViaVersion.api.protocol.ProtocolRegistry
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.UnsupportedOperationException
|
import kotlin.UnsupportedOperationException
|
||||||
|
|
||||||
object CloudViaAPI : ViaAPI<Unit> {
|
object AspirinViaAPI : ViaAPI<Unit> {
|
||||||
override fun isInjected(p0: UUID): Boolean = false
|
override fun isInjected(p0: UUID): Boolean = false
|
||||||
override fun createBossBar(p0: String, p1: BossColor, p2: BossStyle): BossBar<*> = CloudBossBar(p0, 0f, p2, p1)
|
override fun createBossBar(p0: String, p1: BossColor, p2: BossStyle): BossBar<*> = AspirinBossBar(p0, 0f, p2, p1)
|
||||||
override fun createBossBar(p0: String, p1: Float, p2: BossColor, p3: BossStyle): BossBar<*> = CloudBossBar(p0, p1, p3, p2)
|
override fun createBossBar(p0: String, p1: Float, p2: BossColor, p3: BossStyle): BossBar<*> = AspirinBossBar(p0, p1, p3, p2)
|
||||||
override fun sendRawPacket(p0: Unit?, p1: ByteBuf?) = throw UnsupportedOperationException()
|
override fun sendRawPacket(p0: Unit?, p1: ByteBuf?) = throw UnsupportedOperationException()
|
||||||
override fun sendRawPacket(p0: UUID?, p1: ByteBuf?) = throw UnsupportedOperationException()
|
override fun sendRawPacket(p0: UUID?, p1: ByteBuf?) = throw UnsupportedOperationException()
|
||||||
override fun getPlayerVersion(p0: Unit?): Int = throw UnsupportedOperationException()
|
override fun getPlayerVersion(p0: Unit?): Int = throw UnsupportedOperationException()
|
||||||
override fun getPlayerVersion(p0: UUID?): Int = throw UnsupportedOperationException()
|
override fun getPlayerVersion(p0: UUID?): Int = throw UnsupportedOperationException()
|
||||||
override fun getVersion(): String = CloudPlatform.pluginVersion
|
override fun getVersion(): String = AspirinPlatform.pluginVersion
|
||||||
override fun getSupportedVersions(): SortedSet<Int> = ProtocolRegistry.getSupportedVersions()
|
override fun getSupportedVersions(): SortedSet<Int> = ProtocolRegistry.getSupportedVersions()
|
||||||
}
|
}
|
@ -1,12 +1,12 @@
|
|||||||
package com.github.creeper123123321.viaaas.provider
|
package com.github.creeper123123321.viaaas.provider
|
||||||
|
|
||||||
import com.github.creeper123123321.viaaas.handler.CloudMinecraftHandler
|
import com.github.creeper123123321.viaaas.handler.MinecraftHandler
|
||||||
import us.myles.ViaVersion.api.data.UserConnection
|
import us.myles.ViaVersion.api.data.UserConnection
|
||||||
import us.myles.ViaVersion.protocols.base.VersionProvider
|
import us.myles.ViaVersion.protocols.base.VersionProvider
|
||||||
|
|
||||||
object CloudVersionProvider : VersionProvider() {
|
object AspirinVersionProvider : VersionProvider() {
|
||||||
override fun getServerProtocol(connection: UserConnection): Int {
|
override fun getServerProtocol(connection: UserConnection): Int {
|
||||||
val ver = connection.channel!!.pipeline().get(CloudMinecraftHandler::class.java).data.backVer
|
val ver = connection.channel!!.pipeline().get(MinecraftHandler::class.java).data.backVer
|
||||||
if (ver != null) return ver
|
if (ver != null) return ver
|
||||||
return super.getServerProtocol(connection)
|
return super.getServerProtocol(connection)
|
||||||
}
|
}
|
@ -25,4 +25,6 @@ default-backend-port: 25565
|
|||||||
# If some server is in this list, it will be blocked. This has priority over allowed-back-addresses
|
# If some server is in this list, it will be blocked. This has priority over allowed-back-addresses
|
||||||
blocked-back-addresses: ["*.hypixel.net", "hypixel.net"]
|
blocked-back-addresses: ["*.hypixel.net", "hypixel.net"]
|
||||||
# VIAaaS will only allow if it matches an address in this list
|
# VIAaaS will only allow if it matches an address in this list
|
||||||
allowed-back-addresses: ["*"]
|
allowed-back-addresses: ["*"]
|
||||||
|
# Requires online mode for front-end connections. May be useful for stopping bots.
|
||||||
|
force-online-mode: false
|
Loading…
Reference in New Issue
Block a user