mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-11 16:36:58 -04:00
legacy chat component reading: remove quotes around text + test
This commit is contained in:
parent
84e9c897aa
commit
dddd0ebde4
@ -121,7 +121,7 @@ interface ChatComponent {
|
||||
}
|
||||
}
|
||||
|
||||
return LegacyComponentReader.parse(parent, string, restricted).trim() ?: EmptyComponent
|
||||
return LegacyComponentReader.parse(parent, string.removeSurrounding("\""), restricted).trim() ?: EmptyComponent
|
||||
}
|
||||
|
||||
fun String.chat(): ChatComponent {
|
||||
|
@ -319,12 +319,16 @@ internal class ChatComponentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun something() { // tree.ac
|
||||
fun `remove quotes around legacy text`() { // tree.ac
|
||||
val string = """"§2Join the Other Server? Find it at §6Port 25566§2!""""
|
||||
val chat = ChatComponent.of(string)
|
||||
|
||||
TODO()
|
||||
val text = ChatComponent.of(string)
|
||||
|
||||
val expected = BaseComponent(
|
||||
TextComponent("Join the Other Server? Find it at ").color(ChatColors.DARK_GREEN),
|
||||
TextComponent("Port 25566").color(ChatColors.GOLD),
|
||||
TextComponent("!").color(ChatColors.DARK_GREEN),
|
||||
)
|
||||
assertEquals(text, expected)
|
||||
}
|
||||
|
||||
private fun assertEquals(expected: ChatComponent, actual: ChatComponent) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user