mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 08:58:02 -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 {
|
fun String.chat(): ChatComponent {
|
||||||
|
@ -319,12 +319,16 @@ internal class ChatComponentTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 string = """"§2Join the Other Server? Find it at §6Port 25566§2!""""
|
||||||
val chat = ChatComponent.of(string)
|
val text = ChatComponent.of(string)
|
||||||
|
|
||||||
TODO()
|
|
||||||
|
|
||||||
|
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) {
|
private fun assertEquals(expected: ChatComponent, actual: ChatComponent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user