Skip to content

Commit

Permalink
FormattedTextHelper: track another special vanilla edge case format
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 16, 2023
1 parent 3ebd338 commit 178fdd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -55,7 +55,7 @@ public TeleportCommand() {
// Optionally specify "relative" to use relative teleportation (Paper only). This is primarily useful only for players, but available for all entities.
// Relative teleports are smoother for the client when teleporting over short distances.
// Optionally, you may use "relative_axes:" to specify a set of axes to move relative on (and other axes will be treated as absolute), as any of "X", "Y", "Z", "YAW", "PITCH".
// Optionally, you may use "offthread_repeat:" with the relative arg to smooth out the teleport with a specified number of extra async packets sent within a single tick.
// Optionally, you may use "offthread_repeat:" with the relative arg when teleporting a player to smooth out the teleport with a specified number of extra async packets sent within a single tick.
// Optionally, specify "offthread_yaw" or "offthread_pitch" while using offthread_repeat to smooth the player's yaw/pitch to the new location's yaw/pitch.
//
// Optionally, specify additional teleport options using the 'entity_options:' arguments (Paper only).
Expand Down
Expand Up @@ -504,6 +504,12 @@ public static BaseComponent[] parseInternal(String str, ChatColor baseColor, boo
if (str.startsWith(ChatColor.COLOR_CHAR + "[translate=") && str.indexOf(']') == str.length() - 1) {
return new BaseComponent[] {parseTranslatable(str.substring("&[translate=".length(), str.length() - 1), baseColor, optimize)};
}
if (str.length() > 3 && str.startsWith((ChatColor.COLOR_CHAR + "")) && hexMatcher.isMatch(str.charAt(1))
&& str.startsWith(ChatColor.COLOR_CHAR + "[translate=", 2) && str.indexOf(']') == str.length() - 1) { // eg "&6&[translate=block.minecraft.ominous_banner]"
TranslatableComponent component = parseTranslatable(str.substring("&[translate=".length() + 2, str.length() - 1), baseColor, optimize);
component.setColor(ChatColor.getByChar(str.charAt(1)));
return new BaseComponent[] {component};
}
}
if (!optimize) {
optimize = str.contains(ChatColor.COLOR_CHAR + "[optimize=true]");
Expand Down

0 comments on commit 178fdd0

Please sign in to comment.