mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-15 23:06:07 -04:00
Ignore all color formatting in world name.
This commit is contained in:
parent
aa013a86dd
commit
2dce675fe2
@ -35,6 +35,7 @@ import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.jackhuang.hmcl.util.StringUtils.parseColorEscapes;
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
|
||||
public class WorldListItem extends Control {
|
||||
@ -48,7 +49,7 @@ public class WorldListItem extends Control {
|
||||
this.world = world;
|
||||
this.simpleDateFormat = new SimpleDateFormat(i18n("world.time"));
|
||||
|
||||
title.set(world.getWorldName());
|
||||
title.set(parseColorEscapes(world.getWorldName()));
|
||||
subtitle.set(i18n("world.description", world.getFileName(), simpleDateFormat.format(new Date(world.getLastPlayed())), world.getGameVersion() == null ? i18n("message.unknown") : world.getGameVersion()));
|
||||
}
|
||||
|
||||
|
@ -213,4 +213,8 @@ public final class StringUtils {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String parseColorEscapes(String original) {
|
||||
return original.replaceAll("\u00A7\\d", "");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user