mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-24 22:14:32 +00:00
1 parent
acf871f934
commit
9ef34a9f1a
1 file changed
+13
-1
@@ -28,7 +28,19 @@ import java.util.List;
|
||||
public class TextComponentMessageFormatHandler {
|
||||
public static int handle(final TranslationTextComponent parent, final List<ITextProperties> children, final Object[] formatArgs, final String format) {
|
||||
try {
|
||||
StringTextComponent component = new StringTextComponent(ForgeI18n.parseFormat(format, formatArgs));
|
||||
final String formattedString = ForgeI18n.parseFormat(format, formatArgs);
|
||||
|
||||
// See MinecraftForge/MinecraftForge#7396
|
||||
if (format.indexOf('\'') != -1) {
|
||||
final boolean onlyMissingQuotes = format.chars()
|
||||
.filter(ch -> formattedString.indexOf((char) ch) == -1)
|
||||
.allMatch(ch -> ch == '\'');
|
||||
if (onlyMissingQuotes) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
StringTextComponent component = new StringTextComponent(formattedString);
|
||||
component.getStyle().applyTo(parent.getStyle());
|
||||
children.add(component);
|
||||
return format.length();
|
||||
|
||||
Reference in new issue
Block a user