network: 1.19.1-pre6, 1.19.1-rc2, 1.19.1-rc3, 1.19.1, 1.19.2-rc1, 1.19.2-rc2, 1.19.2

This commit is contained in:
Bixilon 2022-10-16 21:37:11 +02:00
parent 5e9dd15f0b
commit 743a7b5c68
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
12 changed files with 158 additions and 4 deletions

View File

@ -0,0 +1,30 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger and contributors
*
* 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.data.chat.filter
import de.bixilon.kutil.enums.EnumUtil
import de.bixilon.kutil.enums.ValuesEnum
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
enum class ChatFilter(val reader: (buffer: PlayInByteBuffer) -> Filter) {
UNFILTERED({ PassFilter() }),
FILTERED({ FullFilter() }),
SEMI_FILTERED({ SemiFilter(it.readBitSet()) }),
;
companion object : ValuesEnum<ChatFilter> {
override val VALUES: Array<ChatFilter> = values()
override val NAME_MAP: Map<String, ChatFilter> = EnumUtil.getEnumValues(VALUES)
}
}

View File

@ -0,0 +1,16 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger and contributors
*
* 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.data.chat.filter
interface Filter

View File

@ -0,0 +1,16 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger and contributors
*
* 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.data.chat.filter
class FullFilter : Filter

View File

@ -0,0 +1,16 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger and contributors
*
* 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.data.chat.filter
class PassFilter : Filter

View File

@ -0,0 +1,20 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger and contributors
*
* 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.data.chat.filter
import java.util.*
class SemiFilter(
val bitset: BitSet,
) : Filter

View File

@ -44,11 +44,16 @@ class MessageChain {
val buffer = OutByteBuffer()
buffer.writeLong(salt)
buffer.writeLong(time.epochSecond)
buffer.writeBareByteArray(message.getSignatureBytes())
if (version.versionId >= ProtocolVersions.V_1_19_2) { // ToDo: This changed somewhere after 1.19.1-pre5
buffer.writeBareString(message)
} else {
buffer.writeBareByteArray(message.getSignatureBytes())
}
if (version.versionId >= ProtocolVersions.V_1_19_1_PRE5) {
buffer.writeByte(0x46)
// ToDo: send preview text (optional)
for (entry in lastSeen.messages) {
buffer.writeByte(0x46)
buffer.writeUUID(entry.profile)

View File

@ -13,6 +13,7 @@
package de.bixilon.minosoft.data.chat.signature
import de.bixilon.minosoft.data.chat.filter.Filter
import de.bixilon.minosoft.data.chat.type.MessageType
import de.bixilon.minosoft.data.text.ChatComponent
@ -22,4 +23,5 @@ data class SignedMessage(
val body: MessageBody,
val unsigned: ChatComponent? = null,
val type: MessageType? = null,
val filter: Filter? = null,
)

View File

@ -16,6 +16,7 @@ import de.bixilon.kutil.image.ImageEncodingUtil.toFavicon
import de.bixilon.minosoft.protocol.packets.factory.LoadPacket
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.protocol.protocol.ProtocolVersions
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
@ -25,8 +26,9 @@ class PlayStatusS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
val motd = buffer.readOptional { buffer.readChatComponent() }
val favicon = buffer.readOptional { buffer.readString().toFavicon() }
val previewsChat = buffer.readBoolean()
val forcesSecureChat = if (buffer.versionId >= ProtocolVersions.V_1_19_1_RC2) buffer.readBoolean() else null
override fun log(reducedLog: Boolean) {
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Play status (motd=\"$motd§r\", favicon=$favicon, previewsChat=$previewsChat)" }
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Play status (motd=\"$motd§r\", favicon=$favicon, previewsChat=$previewsChat, forcesSecureChat=$forcesSecureChat)" }
}
}

View File

@ -37,7 +37,6 @@ class ChatMessageS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
private set
init {
val text = buffer.readChatComponent()
if (buffer.versionId >= ProtocolVersions.V_14W04A) {
if (buffer.versionId >= ProtocolVersions.V_1_19_1_PRE2) {
overlay = buffer.readBoolean()

View File

@ -22,6 +22,8 @@ import de.bixilon.minosoft.commands.nodes.builder.CommandNodeBuilder
import de.bixilon.minosoft.commands.parser.factory.ArgumentParserFactories
import de.bixilon.minosoft.commands.parser.minosoft.dummy.DummyParser
import de.bixilon.minosoft.commands.suggestion.factory.SuggestionFactories
import de.bixilon.minosoft.data.chat.filter.ChatFilter
import de.bixilon.minosoft.data.chat.filter.Filter
import de.bixilon.minosoft.data.chat.signature.*
import de.bixilon.minosoft.data.chat.type.DefaultMessageTypes
import de.bixilon.minosoft.data.chat.type.MessageType
@ -397,6 +399,15 @@ class PlayInByteBuffer : InByteBuffer {
TODO("return message, refactor")
}
return SignedMessage(readMessageHeader(), readByteArray(), readMessageBody(), readOptional { readChatComponent() }, readMessageType())
val header = readMessageHeader()
val signature = readByteArray()
val body = readMessageBody()
val unsigned = readOptional { readChatComponent() }
var filter: Filter? = null
if (versionId >= ProtocolVersions.V_1_19_1_RC3) {
filter = ChatFilter[readVarInt()].reader.invoke(this)
}
val type = readMessageType()
return SignedMessage(header, signature, body, unsigned, type, filter)
}
}

View File

@ -14,6 +14,13 @@ package de.bixilon.minosoft.protocol.protocol
@Suppress("UNUSED")
object ProtocolVersions {
const val V_1_19_2 = 862
const val V_1_19_2_RC2 = 861
const val V_1_19_2_RC1 = 860
@Deprecated("Same PVN as 1.19.2", level = DeprecationLevel.ERROR) const val V_1_19_1 = 859
const val V_1_19_1_RC3 = 858
const val V_1_19_1_RC2 = 857
const val V_1_19_1_PRE6 = 856
const val V_1_19_1_PRE5 = 855
const val V_1_19_1_PRE4 = 854
const val V_1_19_1_PRE3 = 853

View File

@ -1,4 +1,34 @@
{
"862": {
"name": "1.19.2",
"protocol_id": 760,
"packets": 855
},
"861": {
"name": "1.19.2-rc2",
"protocol_id": 1073741927,
"packets": 855
},
"860": {
"name": "1.19.2-rc1",
"protocol_id": 1073741926,
"packets": 855
},
"858": {
"name": "1.19.1-rc3",
"protocol_id": 1073741925,
"packets": 855
},
"857": {
"name": "1.19.1-rc2",
"protocol_id": 1073741924,
"packets": 855
},
"856": {
"name": "1.19.1-pre6",
"protocol_id": 1073741923,
"packets": 855
},
"855": {
"name": "1.19.1-pre5",
"protocol_id": 1073741922,