mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-22 08:19:19 +00:00
move some patches
This commit is contained in:
@@ -2105,3 +2105,76 @@ index 632c4961515f5052551f841cfa840e60bba7a257..00000000000000000000000000000000
|
|||||||
- super.stopTiming();
|
- super.stopTiming();
|
||||||
- }
|
- }
|
||||||
-}
|
-}
|
||||||
|
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||||
|
deleted file mode 100644
|
||||||
|
index 6e361e97c62b93589bba834b3106ed92574ec603..0000000000000000000000000000000000000000
|
||||||
|
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,67 +0,0 @@
|
||||||
|
-/*
|
||||||
|
- * This file is licensed under the MIT License (MIT).
|
||||||
|
- *
|
||||||
|
- * Copyright (c) 2014 Daniel Ennis <http://aikar.co>
|
||||||
|
- *
|
||||||
|
- * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
- * of this software and associated documentation files (the "Software"), to deal
|
||||||
|
- * in the Software without restriction, including without limitation the rights
|
||||||
|
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
- * copies of the Software, and to permit persons to whom the Software is
|
||||||
|
- * furnished to do so, subject to the following conditions:
|
||||||
|
- *
|
||||||
|
- * The above copyright notice and this permission notice shall be included in
|
||||||
|
- * all copies or substantial portions of the Software.
|
||||||
|
- *
|
||||||
|
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
- * THE SOFTWARE.
|
||||||
|
- */
|
||||||
|
-package org.spigotmc;
|
||||||
|
-
|
||||||
|
-import org.bukkit.Bukkit;
|
||||||
|
-import org.jetbrains.annotations.NotNull;
|
||||||
|
-import org.bukkit.plugin.AuthorNagException;
|
||||||
|
-import co.aikar.timings.Timing;
|
||||||
|
-import co.aikar.timings.Timings;
|
||||||
|
-import co.aikar.timings.TimingsManager;
|
||||||
|
-
|
||||||
|
-import java.lang.reflect.Method;
|
||||||
|
-import java.util.logging.Level;
|
||||||
|
-
|
||||||
|
-/**
|
||||||
|
- * This is here for legacy purposes incase any plugin used it.
|
||||||
|
- *
|
||||||
|
- * If you use this, migrate ASAP as this will be removed in the future!
|
||||||
|
- *
|
||||||
|
- * @deprecated
|
||||||
|
- * @see co.aikar.timings.Timings#of
|
||||||
|
- */
|
||||||
|
-@Deprecated(forRemoval = true)
|
||||||
|
-public final class CustomTimingsHandler {
|
||||||
|
- private final Timing handler;
|
||||||
|
-
|
||||||
|
- public CustomTimingsHandler(@NotNull String name) {
|
||||||
|
- Timing timing;
|
||||||
|
-
|
||||||
|
- new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
|
||||||
|
- try {
|
||||||
|
- final Method ofSafe = TimingsManager.class.getDeclaredMethod("getHandler", String.class, String.class, Timing.class);
|
||||||
|
- ofSafe.setAccessible(true);
|
||||||
|
- timing = (Timing) ofSafe.invoke(null,"Minecraft", "(Deprecated API) " + name, null);
|
||||||
|
- } catch (Exception e) {
|
||||||
|
- e.printStackTrace();
|
||||||
|
- Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered");
|
||||||
|
- timing = Timings.NULL_HANDLER;
|
||||||
|
- }
|
||||||
|
- handler = timing;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public void startTiming() { /*handler.startTiming();*/ } // Purpur - Remove Timings
|
||||||
|
- public void stopTiming() { /*handler.stopTiming();*/ } // Purpur - Remove Timings
|
||||||
|
-
|
||||||
|
-}
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||||
|
Date: Mon, 13 Jan 2025 19:35:57 +0300
|
||||||
|
Subject: [PATCH] No chat sign
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/net/minecraft/commands/arguments/ArgumentSignatures.java b/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||||
|
index 47cb25aa9c37bd84d156288c397321009f1d9ae2..9db90d39aa16208e421ba915270661668ec7773b 100644
|
||||||
|
--- a/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||||
|
+++ b/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||||
|
@@ -14,9 +14,16 @@ public record ArgumentSignatures(List<ArgumentSignatures.Entry> entries) {
|
||||||
|
private static final int MAX_ARGUMENT_NAME_LENGTH = 16;
|
||||||
|
|
||||||
|
public ArgumentSignatures(FriendlyByteBuf buffer) {
|
||||||
|
- this(buffer.readCollection(FriendlyByteBuf.<List<ArgumentSignatures.Entry>>limitValue(ArrayList::new, 8), ArgumentSignatures.Entry::new));
|
||||||
|
+ this(readSign(buffer)); // DivineMC - No chat sign
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // DivineMC start - No chat sign
|
||||||
|
+ private static List<ArgumentSignatures.Entry> readSign(FriendlyByteBuf buf) {
|
||||||
|
+ var entries = buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), Entry::new);
|
||||||
|
+ return space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign ? List.of() : entries;
|
||||||
|
+ }
|
||||||
|
+ // DivineMC end - No chat sign
|
||||||
|
+
|
||||||
|
public void write(FriendlyByteBuf buffer) {
|
||||||
|
buffer.writeCollection(this.entries, (buffer1, entry) -> entry.write(buffer1));
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/network/FriendlyByteBuf.java b/net/minecraft/network/FriendlyByteBuf.java
|
||||||
|
index e5e5d9bc095ccd9fbf1c8aaa09e5c4ebb1d1c920..d864f894a2a609a6d74e5d655f8408b55021e0a2 100644
|
||||||
|
--- a/net/minecraft/network/FriendlyByteBuf.java
|
||||||
|
+++ b/net/minecraft/network/FriendlyByteBuf.java
|
||||||
|
@@ -114,6 +114,17 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||||
|
public <T> void writeJsonWithCodec(Codec<T> codec, T value, int maxLength) {
|
||||||
|
// Paper end - Adventure; add max length parameter
|
||||||
|
DataResult<JsonElement> dataResult = codec.encodeStart(JsonOps.INSTANCE, value);
|
||||||
|
+
|
||||||
|
+ // DivineMC start - No chat sign
|
||||||
|
+ if (codec == net.minecraft.network.protocol.status.ServerStatus.CODEC) {
|
||||||
|
+ JsonElement element = dataResult.getOrThrow(string -> new EncoderException("Failed to encode: " + string + " " + value));
|
||||||
|
+ element.getAsJsonObject().addProperty("preventsChatReports", space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign);
|
||||||
|
+
|
||||||
|
+ this.writeUtf(GSON.toJson(element));
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // DivineMC end - No chat sign
|
||||||
|
+
|
||||||
|
this.writeUtf(GSON.toJson(dataResult.getOrThrow(exception -> new EncoderException("Failed to encode: " + exception + " " + value))), maxLength); // Paper - Adventure; add max length parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||||
|
index b5afc05924ae899e020c303c8b86398e1d4ab8a0..db3bc1cc33be082f708615a1f9957c6f92dcbcfa 100644
|
||||||
|
--- a/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||||
|
+++ b/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||||
|
@@ -16,7 +16,7 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt
|
||||||
|
);
|
||||||
|
|
||||||
|
private ServerboundChatPacket(FriendlyByteBuf buffer) {
|
||||||
|
- this(buffer.readUtf(256), buffer.readInstant(), buffer.readLong(), buffer.readNullable(MessageSignature::read), new LastSeenMessages.Update(buffer));
|
||||||
|
+ this(buffer.readUtf(256), buffer.readInstant(), buffer.readLong(), buffer.readNullable(ServerboundChatPacket::readSign), new LastSeenMessages.Update(buffer)); // DivineMC - No chat sign
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(FriendlyByteBuf buffer) {
|
||||||
|
@@ -27,6 +27,14 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt
|
||||||
|
this.lastSeenMessages.write(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // DivineMC start - No chat sign
|
||||||
|
+ private static MessageSignature readSign(FriendlyByteBuf buf) {
|
||||||
|
+ byte[] bs = new byte[256];
|
||||||
|
+ buf.readBytes(bs);
|
||||||
|
+ return space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign ? null : new MessageSignature(bs);
|
||||||
|
+ }
|
||||||
|
+ // DivineMC end - No chat sign
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public PacketType<ServerboundChatPacket> type() {
|
||||||
|
return GamePacketTypes.SERVERBOUND_CHAT;
|
||||||
|
diff --git a/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java b/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
||||||
|
index 1df628ac0b414511aaed6e09d78f884c4170f730..598a46662a64b1e8ba37977b67c8311881acc84d 100644
|
||||||
|
--- a/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
||||||
|
+++ b/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
||||||
|
@@ -26,6 +26,11 @@ public record ServerboundChatSessionUpdatePacket(RemoteChatSession.Data chatSess
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(ServerGamePacketListener handler) {
|
||||||
|
+ // DivineMC start - No chat sign
|
||||||
|
+ if (space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // DivineMC end - No chat sign
|
||||||
|
handler.handleChatSessionUpdate(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
index 5ec864a48aa2582458f741b9e81be8805d55913c..db08fe9ad7789876efb657c4274b84b11b6dad72 100644
|
||||||
|
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
@@ -662,7 +662,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
|
// Paper start - Add setting for proxy online mode status
|
||||||
|
return properties.enforceSecureProfile
|
||||||
|
&& io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||||
|
- && this.services.canValidateProfileKeys();
|
||||||
|
+ && this.services.canValidateProfileKeys() && !space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign; // DivineMC - No chat sign
|
||||||
|
// Paper end - Add setting for proxy online mode status
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
|
index 9fe0f9004066522df8eaf9b77968755c9e69a6bd..84bd8a066bc5e89f657118748eee232a4a824a83 100644
|
||||||
|
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
|
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
|
@@ -310,10 +310,24 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||||
|
}
|
||||||
|
|
||||||
|
public void send(Packet<?> packet) {
|
||||||
|
+ // DivineMC start - No chat sign
|
||||||
|
+ if (space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign) {
|
||||||
|
+ if (this instanceof ServerGamePacketListenerImpl && packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat) {
|
||||||
|
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(chat.chatType().decorate(chat.unsignedContent() != null ? chat.unsignedContent() : Component.literal(chat.body().content())), false);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // DivineMC end - No chat sign
|
||||||
|
this.send(packet, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void send(Packet<?> packet, @Nullable PacketSendListener listener) {
|
||||||
|
+ // DivineMC start - No chat sign
|
||||||
|
+ if (space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign) {
|
||||||
|
+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat && listener != null) {
|
||||||
|
+ listener = null;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // DivineMC end - No chat sign
|
||||||
|
// CraftBukkit start
|
||||||
|
if (packet == null || this.processedDisconnect) { // Spigot
|
||||||
|
return;
|
||||||
|
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||||
|
index 94abb9d8f6381aee000dbd0720477db8b7ca279c..f8ad9aa0355c9f85a314f198666cb5fa376dabae 100644
|
||||||
|
--- a/net/minecraft/server/players/PlayerList.java
|
||||||
|
+++ b/net/minecraft/server/players/PlayerList.java
|
||||||
|
@@ -1319,7 +1319,7 @@ public abstract class PlayerList {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||||
|
- return message.hasSignature() && !message.hasExpiredServer(Instant.now());
|
||||||
|
+ return space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign || (message.hasSignature() && !message.hasExpiredServer(Instant.now())); // DivineMC - No chat sign
|
||||||
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
--- a/net/minecraft/world/level/biome/BiomeManager.java
|
|
||||||
+++ b/net/minecraft/world/level/biome/BiomeManager.java
|
|
||||||
@@ -7,7 +_,8 @@
|
|
||||||
import net.minecraft.util.LinearCongruentialGenerator;
|
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
|
|
||||||
-public class BiomeManager {
|
|
||||||
+public class
|
|
||||||
+BiomeManager {
|
|
||||||
public static final int CHUNK_CENTER_QUART = QuartPos.fromBlock(8);
|
|
||||||
private static final int ZOOM_BITS = 2;
|
|
||||||
private static final int ZOOM = 4;
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||||
|
@@ -317,7 +_,7 @@
|
||||||
|
|
||||||
|
private void sendToServer(final ChatType.Bound chatType, final @Nullable Function<Audience, net.minecraft.network.chat.Component> msgFunction) {
|
||||||
|
final PlayerChatMessage toConsoleMessage = msgFunction == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(msgFunction.apply(ChatProcessor.this.server.console));
|
||||||
|
- ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure");
|
||||||
|
+ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) || space.bxteam.divinemc.configuration.DivineGlobalConfiguration.get().chat.noChatSign ? null : "Not Secure"); // DivineMC - No chat sign
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -21,6 +21,12 @@ public class DivineGlobalConfiguration extends ConfigurationPart {
|
|||||||
@Setting(Configuration.VERSION_FIELD)
|
@Setting(Configuration.VERSION_FIELD)
|
||||||
public int version = CURRENT_VERSION;
|
public int version = CURRENT_VERSION;
|
||||||
|
|
||||||
|
public Chat chat;
|
||||||
|
|
||||||
|
public class Chat extends ConfigurationPart {
|
||||||
|
public boolean noChatSign = true;
|
||||||
|
}
|
||||||
|
|
||||||
public Misc misc;
|
public Misc misc;
|
||||||
|
|
||||||
public class Misc extends ConfigurationPart {
|
public class Misc extends ConfigurationPart {
|
||||||
|
|||||||
@@ -1,175 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
||||||
Date: Sun, 12 May 2024 19:49:57 +0300
|
|
||||||
Subject: [PATCH] No chat sign
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
||||||
index 14e412ebf75b0e06ab53a1c8f9dd1be6ad1e2680..a643f3fb7bf6ae8394fa43adf5a2149137d46c4b 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
|
||||||
@@ -317,7 +317,7 @@ public final class ChatProcessor {
|
|
||||||
|
|
||||||
private void sendToServer(final ChatType.Bound chatType, final @Nullable Function<Audience, net.minecraft.network.chat.Component> msgFunction) {
|
|
||||||
final PlayerChatMessage toConsoleMessage = msgFunction == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(msgFunction.apply(ChatProcessor.this.server.console));
|
|
||||||
- ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure");
|
|
||||||
+ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) || space.bxteam.divinemc.configuration.DivineConfig.noChatSign ? null : "Not Secure"); // DivineMC - No chat sign
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
|
||||||
index 479e6e2aa88a22ef7f8fccb06add6806f5b71d9d..370543f7f710971a37a0d05da8ef484a91d79f01 100644
|
|
||||||
--- a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
|
||||||
+++ b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
|
||||||
@@ -14,9 +14,16 @@ public record ArgumentSignatures(List<ArgumentSignatures.Entry> entries) {
|
|
||||||
private static final int MAX_ARGUMENT_NAME_LENGTH = 16;
|
|
||||||
|
|
||||||
public ArgumentSignatures(FriendlyByteBuf buf) {
|
|
||||||
- this(buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), ArgumentSignatures.Entry::new));
|
|
||||||
+ this(readSign(buf)); // DivineMC - No chat sign
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // DivineMC start - No chat sign
|
|
||||||
+ private static List<ArgumentSignatures.Entry> readSign(FriendlyByteBuf buf) {
|
|
||||||
+ var entries = buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), Entry::new);
|
|
||||||
+ return space.bxteam.divinemc.configuration.DivineConfig.noChatSign ? List.of() : entries;
|
|
||||||
+ }
|
|
||||||
+ // DivineMC end
|
|
||||||
+
|
|
||||||
public void write(FriendlyByteBuf buf) {
|
|
||||||
buf.writeCollection(this.entries, (buf2, entry) -> entry.write(buf2));
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
|
||||||
index a523a83aec3a6ecbec4d60a187edc0c0167d15b4..b7c6b3b31860d372bead4cd2d3ea00fa4ffe1be3 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);
|
|
||||||
|
|
||||||
+ // DivineMC start - No chat sign
|
|
||||||
+ if (codec == net.minecraft.network.protocol.status.ServerStatus.CODEC) {
|
|
||||||
+ JsonElement element = dataresult.getOrThrow(string -> new EncoderException("Failed to encode: " + string + " " + value));
|
|
||||||
+ element.getAsJsonObject().addProperty("preventsChatReports", space.bxteam.divinemc.configuration.DivineConfig.noChatSign);
|
|
||||||
+
|
|
||||||
+ this.writeUtf(GSON.toJson(element));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // DivineMC end
|
|
||||||
+
|
|
||||||
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/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
|
||||||
index 07df3299f1d1aa5506e1f6f146347d53e0278d9c..02fafc64d6178f2ae0be36b38ed5de7e0c31448c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
|
||||||
@@ -16,7 +16,7 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt
|
|
||||||
);
|
|
||||||
|
|
||||||
private ServerboundChatPacket(FriendlyByteBuf buf) {
|
|
||||||
- this(buf.readUtf(256), buf.readInstant(), buf.readLong(), buf.readNullable(MessageSignature::read), new LastSeenMessages.Update(buf));
|
|
||||||
+ this(buf.readUtf(256), buf.readInstant(), buf.readLong(), buf.readNullable(ServerboundChatPacket::readSign), new LastSeenMessages.Update(buf)); // DivineMC - No chat sign
|
|
||||||
}
|
|
||||||
|
|
||||||
private void write(FriendlyByteBuf buf) {
|
|
||||||
@@ -27,6 +27,14 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt
|
|
||||||
this.lastSeenMessages.write(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // DivineMC start - No chat sign
|
|
||||||
+ private static MessageSignature readSign(FriendlyByteBuf buf) {
|
|
||||||
+ byte[] bs = new byte[256];
|
|
||||||
+ buf.readBytes(bs);
|
|
||||||
+ return space.bxteam.divinemc.configuration.DivineConfig.noChatSign ? null : new MessageSignature(bs);
|
|
||||||
+ }
|
|
||||||
+ // DivineMC end
|
|
||||||
+
|
|
||||||
@Override
|
|
||||||
public PacketType<ServerboundChatPacket> type() {
|
|
||||||
return GamePacketTypes.SERVERBOUND_CHAT;
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
|
||||||
index 5705cb920084b775cce4b361683b32c6b6e003ed..9c031dd0fa279a23405e5b7d77e4c11e5a762684 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
|
||||||
@@ -26,6 +26,11 @@ public record ServerboundChatSessionUpdatePacket(RemoteChatSession.Data chatSess
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(ServerGamePacketListener listener) {
|
|
||||||
+ // DivineMC start - No chat sign
|
|
||||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.noChatSign) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // DivineMC end
|
|
||||||
listener.handleChatSessionUpdate(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
||||||
index 75919064593167b51c4325ba6d500366ba8408f1..23b3bfaebb8bfbb3bed77535526235c3db9e750f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
||||||
@@ -705,7 +705,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
||||||
// Paper start - Add setting for proxy online mode status
|
|
||||||
return dedicatedserverproperties.enforceSecureProfile
|
|
||||||
&& io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
|
||||||
- && this.services.canValidateProfileKeys();
|
|
||||||
+ && this.services.canValidateProfileKeys() && !DivineConfig.noChatSign; // DivineMC - No chat sign
|
|
||||||
// Paper end - Add setting for proxy online mode status
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
||||||
index df48c2754dc1ebd52addd8ae768cba5916ce3969..955cfbe0bd97d65fb757d6e9e76ec60440bc5b84 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
||||||
@@ -332,10 +332,24 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
|
||||||
}
|
|
||||||
|
|
||||||
public void send(Packet<?> packet) {
|
|
||||||
+ // DivineMC start - No chat sign
|
|
||||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.noChatSign) {
|
|
||||||
+ if (this instanceof ServerGamePacketListenerImpl && packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat) {
|
|
||||||
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(chat.chatType().decorate(chat.unsignedContent() != null ? chat.unsignedContent() : Component.literal(chat.body().content())), false);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // DivineMC end
|
|
||||||
this.send(packet, (PacketSendListener) null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void send(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
|
||||||
+ // DivineMC start - No chat sign
|
|
||||||
+ if (space.bxteam.divinemc.configuration.DivineConfig.noChatSign) {
|
|
||||||
+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat && callbacks != null) {
|
|
||||||
+ callbacks = null;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // DivineMC end
|
|
||||||
// CraftBukkit start
|
|
||||||
if (packet == null || this.processedDisconnect) { // Spigot
|
|
||||||
return;
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
index 5b1705794a8c3914cb11fdd35f75c8e0c128ecd0..10f6b7e9fdc64760a8bcce34f5f453074a305a94 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
@@ -1426,7 +1426,7 @@ public abstract class PlayerList {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
|
||||||
- return message.hasSignature() && !message.hasExpiredServer(Instant.now());
|
|
||||||
+ return space.bxteam.divinemc.configuration.DivineConfig.noChatSign || (message.hasSignature() && !message.hasExpiredServer(Instant.now())); // DivineMC - No chat sign
|
|
||||||
}
|
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
||||||
index aaf3afd0fe1f13ed7375d272e2690e9db0410417..261a55a4a5171f4ceb57fda8532bc1f795dc30ed 100644
|
|
||||||
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
||||||
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineConfig.java
|
|
||||||
@@ -168,4 +168,9 @@ public class DivineConfig {
|
|
||||||
optimizedDragonRespawn = getBoolean("settings.optimizations.optimized-dragon-respawn", optimizedDragonRespawn);
|
|
||||||
optimizeNoiseGeneration = getBoolean("settings.optimizations.optimize-noise-generation", optimizeNoiseGeneration);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ public static boolean noChatSign = true;
|
|
||||||
+ private static void chatMessageSignatures() {
|
|
||||||
+ noChatSign = getBoolean("settings.no-chat-sign", noChatSign);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user