This commit is contained in:
Chayapak 2023-05-05 11:13:19 +07:00
parent 8edc6cf395
commit 3b34eaf9cb

View file

@ -44,18 +44,18 @@ public class CustomChat {
.replace("\"", "\\\"");
try {
final MutablePlayerListEntry entry = Players.INSTANCE.getEntry(client.getNetworkHandler().getProfile().getId());
// final MutablePlayerListEntry entry = Players.INSTANCE.getEntry(client.getNetworkHandler().getProfile().getId());
//
// final Component displayNameComponent = entry.displayName().asComponent();
final Component displayNameComponent = entry.displayName().asComponent();
final String prefix = GsonComponentSerializer.gson().serialize(Component.join(JoinConfiguration.separator(Component.empty()), displayNameComponent.children().get(0)));
final String displayName = GsonComponentSerializer.gson().serialize(Component.join(JoinConfiguration.separator(Component.empty()), displayNameComponent.children().get(1)));
// final String prefix = GsonComponentSerializer.gson().serialize(Component.join(JoinConfiguration.separator(Component.empty()), displayNameComponent.children().get(0)));
// final String displayName = GsonComponentSerializer.gson().serialize(Component.join(JoinConfiguration.separator(Component.empty()), displayNameComponent.children().get(1)));
String sanitizedFormat;
try {
sanitizedFormat = format
.replace("\"PREFIX\"", prefix)
.replace("\"DISPLAYNAME\"", displayName)
// .replace("\"PREFIX\"", prefix)
// .replace("\"DISPLAYNAME\"", displayName)
.replace("USERNAME", username)
.replace("MESSAGE", sanitizedMessage);
} catch (Exception e) {