mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
signed chat message s2cp test (23w40a)
This commit is contained in:
parent
d143b98a63
commit
fdd90cefc1
@ -22,6 +22,7 @@ import de.bixilon.minosoft.config.profile.ProfileTestUtil.createProfiles
|
||||
import de.bixilon.minosoft.data.accounts.types.test.TestAccount
|
||||
import de.bixilon.minosoft.data.entities.entities.player.local.LocalPlayerEntity
|
||||
import de.bixilon.minosoft.data.entities.entities.player.local.SignatureKeyManagement
|
||||
import de.bixilon.minosoft.data.language.lang.LanguageList
|
||||
import de.bixilon.minosoft.data.registries.registries.Registries
|
||||
import de.bixilon.minosoft.data.world.WorldTestUtil.createWorld
|
||||
import de.bixilon.minosoft.data.world.WorldTestUtil.initialize
|
||||
@ -47,6 +48,7 @@ object ConnectionTestUtil {
|
||||
|
||||
fun createConnection(worldSize: Int = 0, light: Boolean = false, version: String? = null): PlayConnection {
|
||||
val connection = IT.OBJENESIS.newInstance(PlayConnection::class.java)
|
||||
connection::language.forceSet(LanguageList(mutableListOf()))
|
||||
val version = if (version == null) IT.VERSION else Versions[version] ?: throw IllegalArgumentException("Can not find version: $version")
|
||||
connection::sequence.forceSet(AtomicInteger(1))
|
||||
connection::account.forceSet(TestAccount)
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* 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 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.protocol.packets.s2c.play.chat
|
||||
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.forceSet
|
||||
import de.bixilon.kutil.uuid.UUIDUtil.toUUID
|
||||
import de.bixilon.minosoft.data.chat.ChatTextPositions
|
||||
import de.bixilon.minosoft.data.chat.sender.UnknownMessageSender
|
||||
import de.bixilon.minosoft.data.entities.entities.player.tab.TabList
|
||||
import de.bixilon.minosoft.data.language.lang.LanguageList
|
||||
import de.bixilon.minosoft.data.registries.chat.ChatMessageType
|
||||
import de.bixilon.minosoft.data.registries.chat.TypeProperties
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.ConnectionTestUtil.createConnection
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import de.bixilon.minosoft.protocol.packets.s2c.play.PacketReadingTestUtil
|
||||
import org.testng.Assert.assertEquals
|
||||
import org.testng.annotations.Test
|
||||
|
||||
@Test(groups = ["packet"])
|
||||
class SignedChatMessageS2CPTest {
|
||||
|
||||
private fun connection(): PlayConnection {
|
||||
val connection = createConnection()
|
||||
connection::language.forceSet(LanguageList(mutableListOf()))
|
||||
connection::tabList.forceSet(TabList())
|
||||
connection.registries.messageType[0] = ChatMessageType(minecraft("dummy"), TypeProperties("test", emptyList(), emptyMap()), null, ChatTextPositions.CHAT)
|
||||
|
||||
return connection
|
||||
}
|
||||
|
||||
fun vanilla_23w40a() {
|
||||
val packet = PacketReadingTestUtil.read("signed_chat_message/vanilla_23w40a", "23w40a", connection(), constructor = ::SignedChatMessageS2CP)
|
||||
assertEquals(packet.message.message, "abc")
|
||||
assertEquals(packet.message.sender, UnknownMessageSender("a21a6c65-bbd4-48ca-9d79-e07139e1780d".toUUID()))
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 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 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.type
|
||||
|
||||
import de.bixilon.minosoft.data.registries.chat.ChatMessageType
|
||||
import de.bixilon.minosoft.data.text.ChatComponent
|
||||
|
||||
@Deprecated("Refactor")
|
||||
class MessageType(
|
||||
val type: ChatMessageType,
|
||||
val text: ChatComponent,
|
||||
val targetName: ChatComponent?,
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user