mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-20 23:39:29 +00:00
51 lines
3.0 KiB
Diff
51 lines
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Mon, 26 Dec 2022 05:22:43 +0100
|
|
Subject: [PATCH] Make chat order verification configurable
|
|
|
|
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Add option to disable out-of-order chat"
|
|
By: Kevin Raneri <kevin.raneri@gmail.com>
|
|
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
|
index 300929a406905f5ff1ede664d5b99fb0938d4d2e..e5625557d2cd70b19b9db5fd418c243b639188e8 100644
|
|
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
|
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
|
@@ -8,6 +8,7 @@ import javax.annotation.Nullable;
|
|
import net.minecraft.util.SignatureValidator;
|
|
import net.minecraft.util.Signer;
|
|
import net.minecraft.world.entity.player.ProfilePublicKey;
|
|
+import org.galemc.gale.configuration.GaleGlobalConfiguration;
|
|
import org.slf4j.Logger;
|
|
|
|
public class SignedMessageChain {
|
|
@@ -45,7 +46,7 @@ public class SignedMessageChain {
|
|
SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink;
|
|
if (signedMessageLink == null) {
|
|
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN);
|
|
- } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) {
|
|
+ } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp) && GaleGlobalConfiguration.get().misc.verifyChatOrder) { // Gale - Pufferfish - make chat order verification configurable
|
|
this.setChainBroken();
|
|
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
|
|
} else {
|
|
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
index d180ea6099d8fed3cf19f0f32bbfced7df57c9d7..8075e5c17f469f1bf5b7758a1334943d6ed8383f 100644
|
|
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
|
|
@@ -41,4 +41,10 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
|
|
public boolean enableBookWriting = true; // Gale - Pufferfish - make book writing configurable
|
|
|
|
}
|
|
+
|
|
+ public Misc misc;
|
|
+ public class Misc extends ConfigurationPart {
|
|
+
|
|
+ public boolean verifyChatOrder = true; // Gale - Pufferfish - make chat order verification configurable
|
|
+ }
|
|
}
|