mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 18:05:51 -04:00
rename protocol state: HANDSHAKING
to HANDSHAKE
This commit is contained in:
parent
291e747805
commit
f4552eb644
@ -59,7 +59,7 @@ import de.bixilon.minosoft.protocol.network.connection.play.channel.DefaultChann
|
|||||||
import de.bixilon.minosoft.protocol.network.connection.play.settings.ClientSettingsManager
|
import de.bixilon.minosoft.protocol.network.connection.play.settings.ClientSettingsManager
|
||||||
import de.bixilon.minosoft.protocol.network.connection.play.tick.ConnectionTicker
|
import de.bixilon.minosoft.protocol.network.connection.play.tick.ConnectionTicker
|
||||||
import de.bixilon.minosoft.protocol.network.connection.play.util.ConnectionUtil
|
import de.bixilon.minosoft.protocol.network.connection.play.util.ConnectionUtil
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.handshaking.HandshakeC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.handshake.HandshakeC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.login.StartC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.login.StartC2SP
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
|
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
|
||||||
import de.bixilon.minosoft.protocol.versions.Version
|
import de.bixilon.minosoft.protocol.versions.Version
|
||||||
@ -148,7 +148,7 @@ class PlayConnection(
|
|||||||
}
|
}
|
||||||
network::state.observe(this) { state ->
|
network::state.observe(this) { state ->
|
||||||
when (state) {
|
when (state) {
|
||||||
ProtocolStates.HANDSHAKING, ProtocolStates.STATUS -> throw IllegalStateException("Invalid state!")
|
ProtocolStates.HANDSHAKE, ProtocolStates.STATUS -> throw IllegalStateException("Invalid state!")
|
||||||
ProtocolStates.LOGIN -> {
|
ProtocolStates.LOGIN -> {
|
||||||
this.state = PlayConnectionStates.LOGGING_IN
|
this.state = PlayConnectionStates.LOGGING_IN
|
||||||
this.network.send(StartC2SP(this.player, this.sessionId))
|
this.network.send(StartC2SP(this.player, this.sessionId))
|
||||||
|
@ -19,7 +19,7 @@ import de.bixilon.minosoft.modding.event.events.connection.status.StatusConnecti
|
|||||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||||
import de.bixilon.minosoft.protocol.address.ServerAddress
|
import de.bixilon.minosoft.protocol.address.ServerAddress
|
||||||
import de.bixilon.minosoft.protocol.network.connection.Connection
|
import de.bixilon.minosoft.protocol.network.connection.Connection
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.handshaking.HandshakeC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.handshake.HandshakeC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.status.StatusRequestC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.status.StatusRequestC2SP
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
|
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
|
||||||
import de.bixilon.minosoft.protocol.status.ServerStatus
|
import de.bixilon.minosoft.protocol.status.ServerStatus
|
||||||
@ -75,7 +75,7 @@ class StatusConnection(
|
|||||||
|
|
||||||
network::state.observe(this) {
|
network::state.observe(this) {
|
||||||
when (it) {
|
when (it) {
|
||||||
ProtocolStates.HANDSHAKING -> {}
|
ProtocolStates.HANDSHAKE -> {}
|
||||||
ProtocolStates.PLAY, ProtocolStates.LOGIN -> throw IllegalStateException("Invalid state!")
|
ProtocolStates.PLAY, ProtocolStates.LOGIN -> throw IllegalStateException("Invalid state!")
|
||||||
ProtocolStates.STATUS -> {
|
ProtocolStates.STATUS -> {
|
||||||
state = StatusConnectionStates.QUERYING_STATUS
|
state = StatusConnectionStates.QUERYING_STATUS
|
||||||
|
@ -51,7 +51,7 @@ class NettyClient(
|
|||||||
) : SimpleChannelInboundHandler<Any>(), ClientNetwork {
|
) : SimpleChannelInboundHandler<Any>(), ClientNetwork {
|
||||||
override var connected by observed(false)
|
override var connected by observed(false)
|
||||||
private set
|
private set
|
||||||
override var state by observed(ProtocolStates.HANDSHAKING)
|
override var state by observed(ProtocolStates.HANDSHAKE)
|
||||||
override var compressionThreshold = -1
|
override var compressionThreshold = -1
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
@ -86,7 +86,7 @@ class NettyClient(
|
|||||||
private var sendingPaused = false
|
private var sendingPaused = false
|
||||||
|
|
||||||
override fun connect(address: ServerAddress, native: Boolean) {
|
override fun connect(address: ServerAddress, native: Boolean) {
|
||||||
state = ProtocolStates.HANDSHAKING
|
state = ProtocolStates.HANDSHAKE
|
||||||
val natives = if (native) TransportNatives.get() else NioNatives
|
val natives = if (native) TransportNatives.get() else NioNatives
|
||||||
val bootstrap = Bootstrap()
|
val bootstrap = Bootstrap()
|
||||||
.group(natives.pool)
|
.group(natives.pool)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
*/
|
*/
|
||||||
package de.bixilon.minosoft.protocol.packets.c2s.handshaking
|
package de.bixilon.minosoft.protocol.packets.c2s.handshake
|
||||||
|
|
||||||
import de.bixilon.minosoft.protocol.address.ServerAddress
|
import de.bixilon.minosoft.protocol.address.ServerAddress
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.C2SPacket
|
import de.bixilon.minosoft.protocol.packets.c2s.C2SPacket
|
||||||
@ -22,7 +22,7 @@ import de.bixilon.minosoft.util.logging.Log
|
|||||||
import de.bixilon.minosoft.util.logging.LogLevels
|
import de.bixilon.minosoft.util.logging.LogLevels
|
||||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
|
|
||||||
@LoadPacket(state = ProtocolStates.HANDSHAKING)
|
@LoadPacket(state = ProtocolStates.HANDSHAKE)
|
||||||
class HandshakeC2SP(
|
class HandshakeC2SP(
|
||||||
val address: ServerAddress,
|
val address: ServerAddress,
|
||||||
val action: Actions = Actions.STATUS,
|
val action: Actions = Actions.STATUS,
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -30,6 +30,6 @@ class C2SPacketType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val EMPTY = { C2SPacketType(ProtocolStates.HANDSHAKING, C2SPacket::class.java, null, threadSafe = false, lowPriority = false) }
|
val EMPTY = { C2SPacketType(ProtocolStates.HANDSHAKE, C2SPacket::class.java, null, threadSafe = false, lowPriority = false) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -20,7 +20,7 @@ import de.bixilon.minosoft.protocol.packets.factory.factories.PacketFactory
|
|||||||
import de.bixilon.minosoft.protocol.packets.s2c.S2CPacket
|
import de.bixilon.minosoft.protocol.packets.s2c.S2CPacket
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
|
import de.bixilon.minosoft.protocol.protocol.ProtocolStates
|
||||||
|
|
||||||
class S2CPacketType constructor(
|
class S2CPacketType(
|
||||||
val state: ProtocolStates,
|
val state: ProtocolStates,
|
||||||
val clazz: Class<out S2CPacket>,
|
val clazz: Class<out S2CPacket>,
|
||||||
private val packetErrorHandler: PacketErrorHandler?,
|
private val packetErrorHandler: PacketErrorHandler?,
|
||||||
@ -47,6 +47,6 @@ class S2CPacketType constructor(
|
|||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val EMPTY = { S2CPacketType(ProtocolStates.HANDSHAKING, S2CPacket::class.java, null, null, null, threadSafe = false, lowPriority = false) }
|
val EMPTY = { S2CPacketType(ProtocolStates.HANDSHAKE, S2CPacket::class.java, null, null, null, threadSafe = false, lowPriority = false) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -14,7 +14,7 @@ package de.bixilon.minosoft.protocol.protocol
|
|||||||
|
|
||||||
import de.bixilon.kutil.collections.CollectionUtil.biMapOf
|
import de.bixilon.kutil.collections.CollectionUtil.biMapOf
|
||||||
import de.bixilon.kutil.collections.map.bi.BiMap
|
import de.bixilon.kutil.collections.map.bi.BiMap
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.handshaking.HandshakeC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.handshake.HandshakeC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.login.ChannelC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.login.ChannelC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.login.EncryptionC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.login.EncryptionC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.login.StartC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.login.StartC2SP
|
||||||
@ -29,7 +29,7 @@ import de.bixilon.minosoft.protocol.packets.s2c.status.StatusS2CP
|
|||||||
|
|
||||||
object Protocol {
|
object Protocol {
|
||||||
val C2S_PACKET_MAPPING: Map<ProtocolStates, BiMap<C2SPacketType, Int>> = mapOf(
|
val C2S_PACKET_MAPPING: Map<ProtocolStates, BiMap<C2SPacketType, Int>> = mapOf(
|
||||||
ProtocolStates.HANDSHAKING to biMapOf(
|
ProtocolStates.HANDSHAKE to biMapOf(
|
||||||
PacketTypeRegistry.getC2S(HandshakeC2SP::class.java)!! to 0x00,
|
PacketTypeRegistry.getC2S(HandshakeC2SP::class.java)!! to 0x00,
|
||||||
),
|
),
|
||||||
ProtocolStates.STATUS to biMapOf(
|
ProtocolStates.STATUS to biMapOf(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020 Moritz Zwerger
|
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -16,7 +16,7 @@ import de.bixilon.kutil.enums.EnumUtil
|
|||||||
import de.bixilon.kutil.enums.ValuesEnum
|
import de.bixilon.kutil.enums.ValuesEnum
|
||||||
|
|
||||||
enum class ProtocolStates {
|
enum class ProtocolStates {
|
||||||
HANDSHAKING,
|
HANDSHAKE,
|
||||||
STATUS,
|
STATUS,
|
||||||
LOGIN,
|
LOGIN,
|
||||||
PLAY,
|
PLAY,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user