Fix how attachment placeholder gets the delimiter

This commit is contained in:
Vankka 2023-05-30 23:49:14 +03:00
parent c7466202b9
commit 5d63417fbb
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
2 changed files with 5 additions and 2 deletions

View File

@ -39,7 +39,7 @@ public class DiscordToMinecraftChatConfig {
@Comment("The Discord to Minecraft message format for webhook messages (if enabled)") @Comment("The Discord to Minecraft message format for webhook messages (if enabled)")
@Untranslated(Untranslated.Type.VALUE) @Untranslated(Untranslated.Type.VALUE)
public String webhookFormat = "[&#5865F2Discord&r] [hover:show_text:Webhook message]%user_name%&r » %message%%message_attachments_ %"; public String webhookFormat = "[&#5865F2Discord&r] [hover:show_text:Webhook message]%user_name%&r » %message%%message_attachments:' '%";
@Comment("Attachment format") @Comment("Attachment format")
@Untranslated(Untranslated.Type.VALUE) @Untranslated(Untranslated.Type.VALUE)

View File

@ -324,11 +324,14 @@ public class ReceivedDiscordMessageImpl implements ReceivedDiscordMessage {
@Placeholder("message_attachments") @Placeholder("message_attachments")
public Component _attachments(BaseChannelConfig config, @PlaceholderRemainder String suffix) { public Component _attachments(BaseChannelConfig config, @PlaceholderRemainder String suffix) {
if (suffix.startsWith("_")) { if (suffix.startsWith(":")) {
suffix = suffix.substring(1); suffix = suffix.substring(1);
} else if (!suffix.isEmpty()) { } else if (!suffix.isEmpty()) {
return null; return null;
} }
if (suffix.startsWith("'") && suffix.endsWith("'")) {
suffix = suffix.substring(1, suffix.length() - 1);
}
String attachmentFormat = config.discordToMinecraft.attachmentFormat; String attachmentFormat = config.discordToMinecraft.attachmentFormat;
List<Component> components = new ArrayList<>(); List<Component> components = new ArrayList<>();