diff --git a/src/main/java/de/bixilon/minosoft/data/chat/filter/ChatFilter.kt b/src/main/java/de/bixilon/minosoft/data/chat/filter/ChatFilter.kt
new file mode 100644
index 000000000..75f1c79e7
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/data/chat/filter/ChatFilter.kt
@@ -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 .
+ *
+ * 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 {
+ override val VALUES: Array = values()
+ override val NAME_MAP: Map = EnumUtil.getEnumValues(VALUES)
+ }
+}
diff --git a/src/main/java/de/bixilon/minosoft/data/chat/filter/Filter.kt b/src/main/java/de/bixilon/minosoft/data/chat/filter/Filter.kt
new file mode 100644
index 000000000..c3c657d4f
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/data/chat/filter/Filter.kt
@@ -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 .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.data.chat.filter
+
+interface Filter
diff --git a/src/main/java/de/bixilon/minosoft/data/chat/filter/FullFilter.kt b/src/main/java/de/bixilon/minosoft/data/chat/filter/FullFilter.kt
new file mode 100644
index 000000000..0e654f865
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/data/chat/filter/FullFilter.kt
@@ -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 .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.data.chat.filter
+
+class FullFilter : Filter
diff --git a/src/main/java/de/bixilon/minosoft/data/chat/filter/PassFilter.kt b/src/main/java/de/bixilon/minosoft/data/chat/filter/PassFilter.kt
new file mode 100644
index 000000000..d9bff68d0
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/data/chat/filter/PassFilter.kt
@@ -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 .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.data.chat.filter
+
+class PassFilter : Filter
diff --git a/src/main/java/de/bixilon/minosoft/data/chat/filter/SemiFilter.kt b/src/main/java/de/bixilon/minosoft/data/chat/filter/SemiFilter.kt
new file mode 100644
index 000000000..f5b7dbdb4
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/data/chat/filter/SemiFilter.kt
@@ -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 .
+ *
+ * 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
diff --git a/src/main/java/de/bixilon/minosoft/data/chat/signature/MessageChain.kt b/src/main/java/de/bixilon/minosoft/data/chat/signature/MessageChain.kt
index 45c1ee7c7..c44220803 100644
--- a/src/main/java/de/bixilon/minosoft/data/chat/signature/MessageChain.kt
+++ b/src/main/java/de/bixilon/minosoft/data/chat/signature/MessageChain.kt
@@ -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)
diff --git a/src/main/java/de/bixilon/minosoft/data/chat/signature/SignedMessage.kt b/src/main/java/de/bixilon/minosoft/data/chat/signature/SignedMessage.kt
index 5d6dc05f9..1cdddbb6f 100644
--- a/src/main/java/de/bixilon/minosoft/data/chat/signature/SignedMessage.kt
+++ b/src/main/java/de/bixilon/minosoft/data/chat/signature/SignedMessage.kt
@@ -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,
)
diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/PlayStatusS2CP.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/PlayStatusS2CP.kt
index 4f08fb2bc..e83d5b199 100644
--- a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/PlayStatusS2CP.kt
+++ b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/PlayStatusS2CP.kt
@@ -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)" }
}
}
diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/chat/ChatMessageS2CP.kt b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/chat/ChatMessageS2CP.kt
index 24f6524c0..6cb6306a3 100644
--- a/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/chat/ChatMessageS2CP.kt
+++ b/src/main/java/de/bixilon/minosoft/protocol/packets/s2c/play/chat/ChatMessageS2CP.kt
@@ -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()
diff --git a/src/main/java/de/bixilon/minosoft/protocol/protocol/PlayInByteBuffer.kt b/src/main/java/de/bixilon/minosoft/protocol/protocol/PlayInByteBuffer.kt
index 773921387..7f60607d8 100644
--- a/src/main/java/de/bixilon/minosoft/protocol/protocol/PlayInByteBuffer.kt
+++ b/src/main/java/de/bixilon/minosoft/protocol/protocol/PlayInByteBuffer.kt
@@ -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)
}
}
diff --git a/src/main/java/de/bixilon/minosoft/protocol/protocol/ProtocolVersions.kt b/src/main/java/de/bixilon/minosoft/protocol/protocol/ProtocolVersions.kt
index 7526f0384..0c2b8aafa 100644
--- a/src/main/java/de/bixilon/minosoft/protocol/protocol/ProtocolVersions.kt
+++ b/src/main/java/de/bixilon/minosoft/protocol/protocol/ProtocolVersions.kt
@@ -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
diff --git a/src/main/resources/assets/minosoft/mapping/versions.json b/src/main/resources/assets/minosoft/mapping/versions.json
index 4e2a7fcbe..b8fa566cd 100644
--- a/src/main/resources/assets/minosoft/mapping/versions.json
+++ b/src/main/resources/assets/minosoft/mapping/versions.json
@@ -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,