rename protocol state: HANDSHAKING to HANDSHAKE

This commit is contained in:
Bixilon 2023-09-16 01:58:35 +02:00
parent 291e747805
commit f4552eb644
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
8 changed files with 18 additions and 18 deletions

View File

@ -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.tick.ConnectionTicker
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.protocol.ProtocolStates
import de.bixilon.minosoft.protocol.versions.Version
@ -148,7 +148,7 @@ class PlayConnection(
}
network::state.observe(this) { state ->
when (state) {
ProtocolStates.HANDSHAKING, ProtocolStates.STATUS -> throw IllegalStateException("Invalid state!")
ProtocolStates.HANDSHAKE, ProtocolStates.STATUS -> throw IllegalStateException("Invalid state!")
ProtocolStates.LOGIN -> {
this.state = PlayConnectionStates.LOGGING_IN
this.network.send(StartC2SP(this.player, this.sessionId))

View File

@ -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.protocol.address.ServerAddress
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.protocol.ProtocolStates
import de.bixilon.minosoft.protocol.status.ServerStatus
@ -75,7 +75,7 @@ class StatusConnection(
network::state.observe(this) {
when (it) {
ProtocolStates.HANDSHAKING -> {}
ProtocolStates.HANDSHAKE -> {}
ProtocolStates.PLAY, ProtocolStates.LOGIN -> throw IllegalStateException("Invalid state!")
ProtocolStates.STATUS -> {
state = StatusConnectionStates.QUERYING_STATUS

View File

@ -51,7 +51,7 @@ class NettyClient(
) : SimpleChannelInboundHandler<Any>(), ClientNetwork {
override var connected by observed(false)
private set
override var state by observed(ProtocolStates.HANDSHAKING)
override var state by observed(ProtocolStates.HANDSHAKE)
override var compressionThreshold = -1
set(value) {
field = value
@ -86,7 +86,7 @@ class NettyClient(
private var sendingPaused = false
override fun connect(address: ServerAddress, native: Boolean) {
state = ProtocolStates.HANDSHAKING
state = ProtocolStates.HANDSHAKE
val natives = if (native) TransportNatives.get() else NioNatives
val bootstrap = Bootstrap()
.group(natives.pool)

View File

@ -10,7 +10,7 @@
*
* 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.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.LogMessageType
@LoadPacket(state = ProtocolStates.HANDSHAKING)
@LoadPacket(state = ProtocolStates.HANDSHAKE)
class HandshakeC2SP(
val address: ServerAddress,
val action: Actions = Actions.STATUS,

View File

@ -1,6 +1,6 @@
/*
* 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.
*
@ -30,6 +30,6 @@ class C2SPacketType(
}
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) }
}
}

View File

@ -1,6 +1,6 @@
/*
* 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.
*
@ -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.protocol.ProtocolStates
class S2CPacketType constructor(
class S2CPacketType(
val state: ProtocolStates,
val clazz: Class<out S2CPacket>,
private val packetErrorHandler: PacketErrorHandler?,
@ -47,6 +47,6 @@ class S2CPacketType constructor(
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) }
}
}

View File

@ -1,6 +1,6 @@
/*
* 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.
*
@ -14,7 +14,7 @@ package de.bixilon.minosoft.protocol.protocol
import de.bixilon.kutil.collections.CollectionUtil.biMapOf
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.EncryptionC2SP
import de.bixilon.minosoft.protocol.packets.c2s.login.StartC2SP
@ -29,7 +29,7 @@ import de.bixilon.minosoft.protocol.packets.s2c.status.StatusS2CP
object Protocol {
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,
),
ProtocolStates.STATUS to biMapOf(

View File

@ -1,6 +1,6 @@
/*
* 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.
*
@ -16,7 +16,7 @@ import de.bixilon.kutil.enums.EnumUtil
import de.bixilon.kutil.enums.ValuesEnum
enum class ProtocolStates {
HANDSHAKING,
HANDSHAKE,
STATUS,
LOGIN,
PLAY,