From ea460eed12af99b030823e501abcac11c818b9b2 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 5 May 2023 16:06:29 +0700 Subject: [PATCH] some sus --- .../chipmunkmod/modules/CustomChat.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java index 661d6c5..0f39dfc 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java @@ -2,13 +2,10 @@ package land.chipmunk.chipmunkmod.modules; import com.google.gson.JsonElement; import land.chipmunk.chipmunkmod.ChipmunkMod; -import land.chipmunk.chipmunkmod.data.MutablePlayerListEntry; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.JoinConfiguration; import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; @@ -45,24 +42,17 @@ public class CustomChat { try { // final MutablePlayerListEntry entry = Players.INSTANCE.getEntry(client.getNetworkHandler().getProfile().getId()); -// + // 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))); - String sanitizedFormat; - try { - sanitizedFormat = format + final String sanitizedFormat = format // .replace("\"PREFIX\"", prefix) // .replace("\"DISPLAYNAME\"", displayName) - .replace("USERNAME", username) - .replace("MESSAGE", sanitizedMessage); - } catch (Exception e) { - sanitizedFormat = format - .replace("USERNAME", username) - .replace("MESSAGE", sanitizedMessage); - } + .replace("USERNAME", username) + .replace("MESSAGE", sanitizedMessage); CommandCore.INSTANCE.run("minecraft:tellraw @a " + sanitizedFormat); } catch (Exception e) {