forked from ChomeNS/chipmunkmod
some sus
This commit is contained in:
parent
cb2fd9401e
commit
ea460eed12
1 changed files with 4 additions and 14 deletions
|
@ -2,13 +2,10 @@ package land.chipmunk.chipmunkmod.modules;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import land.chipmunk.chipmunkmod.ChipmunkMod;
|
import land.chipmunk.chipmunkmod.ChipmunkMod;
|
||||||
import land.chipmunk.chipmunkmod.data.MutablePlayerListEntry;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.JoinConfiguration;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
|
|
||||||
|
@ -45,24 +42,17 @@ public class CustomChat {
|
||||||
|
|
||||||
try {
|
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 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 displayName = GsonComponentSerializer.gson().serialize(Component.join(JoinConfiguration.separator(Component.empty()), displayNameComponent.children().get(1)));
|
||||||
|
|
||||||
String sanitizedFormat;
|
final String sanitizedFormat = format
|
||||||
try {
|
|
||||||
sanitizedFormat = format
|
|
||||||
// .replace("\"PREFIX\"", prefix)
|
// .replace("\"PREFIX\"", prefix)
|
||||||
// .replace("\"DISPLAYNAME\"", displayName)
|
// .replace("\"DISPLAYNAME\"", displayName)
|
||||||
.replace("USERNAME", username)
|
.replace("USERNAME", username)
|
||||||
.replace("MESSAGE", sanitizedMessage);
|
.replace("MESSAGE", sanitizedMessage);
|
||||||
} catch (Exception e) {
|
|
||||||
sanitizedFormat = format
|
|
||||||
.replace("USERNAME", username)
|
|
||||||
.replace("MESSAGE", sanitizedMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandCore.INSTANCE.run("minecraft:tellraw @a " + sanitizedFormat);
|
CommandCore.INSTANCE.run("minecraft:tellraw @a " + sanitizedFormat);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in a new issue