diff --git a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_kick.java b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_kick.java index 52f5cd807..58484ad0b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_kick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_kick.java @@ -33,7 +33,7 @@ public void kick(CommandSender sender, Player player, @Greedy String reason, @Sw if (!silent) { - adminAction(sender, reason == null ? "Kicking " : "Kicking - Reason: ", + adminAction(sender, reason == null ? "Kicking " : "Kicking - Reason: ", Placeholder.unparsed("player", player.getName()), MessageUtils.parsed("reason", reason != null ? reason : "")); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_lockup.java b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_lockup.java index 50a7e3c6f..26d2f7656 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_lockup.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_lockup.java @@ -21,7 +21,7 @@ public class Command_lockup extends FCommand @Subcommand("all") public void lockAll(CommandSender sender) { - adminAction(sender, "Locking up all players"); + adminAction(sender, "Locking up all players"); server().getOnlinePlayers().forEach(this::startLockup); @@ -52,7 +52,7 @@ public void toggle(CommandSender sender, String name, String state) if (state.equalsIgnoreCase("on")) { - adminAction(sender, "Locking up ", Placeholder.unparsed("player", player.getName())); + adminAction(sender, "Locking up ", Placeholder.unparsed("player", player.getName())); startLockup(player); msg(sender, "Locked up .", Placeholder.unparsed("player", player.getName())); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_smite.java b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_smite.java index dbee5b43d..69ca37ffb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_smite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_smite.java @@ -62,11 +62,10 @@ public void smite(CommandSender sender, Player player, @Greedy String reason) if (reason != null) msg( - player, - // We take advantage of the String blocks newline byte here because it's encoded by MiniMessage and preserved in display. + player, """ - You have been smitten. - Reason: + You have been smitten. + Reason: \ """, MessageUtils.parsed("reason", reason) ); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_stfu.java b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_stfu.java index c96dcbdcf..9c5c7452f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_stfu.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/cmd/Command_stfu.java @@ -49,7 +49,7 @@ public void list(CommandSender sender) @Subcommand("purge") public void purge(CommandSender sender) { - adminAction(sender, "Unmuting all players"); + adminAction(sender, "Unmuting all players"); final List players = server().getOnlinePlayers() .stream() @@ -96,7 +96,7 @@ public void mutePlayerWithReason(CommandSender sender, Player player, @Greedy St if (fplayer.isMuted()) { - adminAction(sender, "Unmuting ", Placeholder.unparsed("player", player.getName())); + adminAction(sender, "Unmuting ", Placeholder.unparsed("player", player.getName())); fplayer.setMuted(false); msg(player, "You have been unmuted."); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/cmd/MessageUtils.java b/src/main/java/me/totalfreedom/totalfreedommod/cmd/MessageUtils.java index 434d074d9..8ccd4eb42 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/cmd/MessageUtils.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/cmd/MessageUtils.java @@ -147,17 +147,22 @@ public static TagResolver joinedComponents(String key, List items) } /** - * Parses a MiniMessage string into a Component. + * Parses a MiniMessage string into a Component. * Automatically escapes angle brackets that are not valid MiniMessage tags (e.g., , ). - * + *

+ * Multi-line messages built with a Java text block ({@code """..."""}) keep their embedded + * newline bytes, which MiniMessage preserves and renders as line breaks in the output. To + * omit the newline before the closing {@code """} (e.g. when only using the text block for + * indentation), end the last line with a trailing {@code \}. + * * @param miniMessage MiniMessage string to be parsed * @return Parsed Component */ - public static Component parse(String miniMessage) + public static Component parse(String miniMessage) { - if (miniMessage == null) + if (miniMessage == null) throw new IllegalArgumentException("MiniMessage string cannot be null"); - + final String escaped = escapeUnknownTags(miniMessage); return AdventureUtil.addLinks(MM.deserialize(escaped)); } @@ -166,12 +171,17 @@ public static Component parse(String miniMessage) * Parses a MiniMessage string with additional TagResolvers. * Automatically escapes angle brackets that are not valid MiniMessage tags (e.g., , ). * Useful for including placeholders in the MiniMessage string. - * + *

+ * Multi-line messages built with a Java text block ({@code """..."""}) keep their embedded + * newline bytes, which MiniMessage preserves and renders as line breaks in the output. To + * omit the newline before the closing {@code """} (e.g. when only using the text block for + * indentation), end the last line with a trailing {@code \}. + * * @param miniMessage MiniMessage string to be parsed * @param resolvers Additional TagResolvers to resolve placeholders in the MiniMessage * @return Parsed Component with placeholders resolved */ - public static Component parse(String miniMessage, TagResolver... resolvers) + public static Component parse(String miniMessage, TagResolver... resolvers) { if (miniMessage == null) throw new IllegalArgumentException("MiniMessage string cannot be null");