From 29c23c8a6f5cfe5b9eeeb9feca7675dfa7761cef Mon Sep 17 00:00:00 2001 From: routersys Date: Sat, 12 Sep 2026 09:21:26 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9B=B8=E5=BC=8F=E3=81=AB=E5=90=AB=E3=81=BE?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E9=83=A8=E5=93=81=E3=81=AE=E7=9B=AE=E5=8D=B0?= =?UTF-8?q?=E3=82=92=E5=8F=96=E3=82=8A=E9=99=A4=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/ucchyocean/lc3/util/ClickableFormat.java | 4 ++-- .../ucchyocean/lc3/util/ClickableFormatTest.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/ucchyocean/lc3/util/ClickableFormat.java b/src/main/java/com/github/ucchyocean/lc3/util/ClickableFormat.java index 2556c45..9df9a07 100644 --- a/src/main/java/com/github/ucchyocean/lc3/util/ClickableFormat.java +++ b/src/main/java/com/github/ucchyocean/lc3/util/ClickableFormat.java @@ -71,7 +71,7 @@ public class ClickableFormat { LunaChatAPI api = LunaChat.getAPI(); - ClickableFormat msg = new ClickableFormat(new KeywordReplacer(Utility.replaceColorCode(format))); + ClickableFormat msg = new ClickableFormat(new KeywordReplacer(Utility.replaceColorCode(withoutPartMarkers(format)))); if ( channel != null ) { @@ -141,7 +141,7 @@ public class ClickableFormat { */ public static ClickableFormat makeChannelClickableMessage(String format, String channelName) { - ClickableFormat msg = new ClickableFormat(new KeywordReplacer(Utility.replaceColorCode(format))); + ClickableFormat msg = new ClickableFormat(new KeywordReplacer(Utility.replaceColorCode(withoutPartMarkers(format)))); String stripped = Utility.stripColorCode(channelName); msg.replaceWithRunCommand("%channel%", channelName, diff --git a/src/test/java/com/github/ucchyocean/lc3/util/ClickableFormatTest.java b/src/test/java/com/github/ucchyocean/lc3/util/ClickableFormatTest.java index 6b7ff03..9cae156 100644 --- a/src/test/java/com/github/ucchyocean/lc3/util/ClickableFormatTest.java +++ b/src/test/java/com/github/ucchyocean/lc3/util/ClickableFormatTest.java @@ -121,6 +121,16 @@ public class ClickableFormatTest extends TestCase { assertNotNull(findByClickEvent(comps, ClickEvent.runCommand("/lunachat join r"))); } + public void testTemplateMarkersAreDropped() { + + ClickableFormat f = ClickableFormat.makeFormat("\uE0009\uE001%username: %msg", new ChannelMemberDummy()); + f.replaceMessage("%msg", "hello"); + Component comps = f.makeComponent(); + + assertEquals("9うっちぃ: hello", plain(comps)); + assertEquals(1, countClickEvents(comps)); + } + public void testChannelMessage() { Component comps = Messages.joinMessage("&b", "r", "ucchy");