From df937d7fa04cb3c1439b6a22155a4e42d7199ef4 Mon Sep 17 00:00:00 2001 From: andyksaw Date: Fri, 6 Dec 2024 21:51:15 +0900 Subject: [PATCH] Don't log empty sign edits --- .../watchdog/listeners/ItemTextListener.kt | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pcbridge-paper/src/main/kotlin/com/projectcitybuild/pcbridge/paper/features/watchdog/listeners/ItemTextListener.kt b/pcbridge-paper/src/main/kotlin/com/projectcitybuild/pcbridge/paper/features/watchdog/listeners/ItemTextListener.kt index bd4fbfea..649a5904 100644 --- a/pcbridge-paper/src/main/kotlin/com/projectcitybuild/pcbridge/paper/features/watchdog/listeners/ItemTextListener.kt +++ b/pcbridge-paper/src/main/kotlin/com/projectcitybuild/pcbridge/paper/features/watchdog/listeners/ItemTextListener.kt @@ -31,6 +31,8 @@ class ItemTextListener( val serializer = PlainTextComponentSerializer.plainText() val lines = event.lines().map { serializer.serialize(it) } + if (lines.isEmpty()) return + val embed = DiscordEmbed( title = "Sign Edited", author = event.player.toDiscordEmbed(), @@ -76,16 +78,20 @@ class ItemTextListener( timestamp = time.now().toISO8601(), fields = mutableListOf().also { if (nextMeta.title != null) { - it.add(DiscordFieldEmbed( - name = "Title", - value = nextMeta.title, - )) + it.add( + DiscordFieldEmbed( + name = "Title", + value = nextMeta.title, + ) + ) } if (nextMeta.author != null) { - it.add(DiscordFieldEmbed( - name = "Book Author", - value = nextMeta.author, - )) + it.add( + DiscordFieldEmbed( + name = "Book Author", + value = nextMeta.author, + ) + ) } }, )