Skip to content

Commit

Permalink
Able to show verified icon on client if No Chat Report installed and …
Browse files Browse the repository at this point in the history
…message signature disabled
  • Loading branch information
Dreeam-qwq committed Oct 12, 2024
1 parent b7a090e commit dfcae93
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ index f962e82e2c70f328a23dc99193d072f8dd7ad949..8ec7cb984ef4c45a14292388c0268bcc
}
}

diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 0cd6a50837efce87ca052a0e1e24db2b75761196..e104383015865d14afce96a2c3030ffc133f9413 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -129,6 +129,16 @@ public class FriendlyByteBuf extends ByteBuf {
// Paper end - Adventure; add max length parameter
DataResult<JsonElement> dataresult = codec.encodeStart(JsonOps.INSTANCE, value);

+ // Leaf start - Configurable chat message signatures
+ if (!org.dreeam.leaf.config.modules.network.ChatMessageSignature.enabled && codec == net.minecraft.network.protocol.status.ServerStatus.CODEC) {
+ JsonElement element = dataresult.getOrThrow(string -> new EncoderException("Failed to encode: " + string + " " + value));
+ element.getAsJsonObject().addProperty("preventsChatReports", true);
+
+ this.writeUtf(GSON.toJson(element));
+ return;
+ }
+ // Leaf end - Configurable chat message signatures
+
this.writeUtf(FriendlyByteBuf.GSON.toJson((JsonElement) dataresult.getOrThrow((s) -> {
return new EncoderException("Failed to encode: " + s + " " + String.valueOf(value));
})), maxLength); // Paper - Adventure; add max length parameter
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java
index 667d1da3b6332737d7382d383bf15b53bd726442..f37ee137a40df4e9d7c0d8c76bb0ddc65f11a7fd 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java
Expand Down Expand Up @@ -84,7 +105,7 @@ index 50dc68a005490415b88780397ef6c26859596dd5..162115048cffc824376e54b7f60ae071
public static record Favicon(byte[] iconBytes) {
private static final String PREFIX = "data:image/png;base64,";
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 0e6d92f450613b1c617ecf723d44d17743f521e2..af820999e45aba5f62b9a89bf3753ea0556647f8 100644
index 9fab5cb1ea35766d12a826569b900245695ee597..f7489e3f606e564c757f395201230f883ed91355 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -711,6 +711,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Expand Down

0 comments on commit dfcae93

Please sign in to comment.