mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-20 15:29:15 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@ad03187 drop exact choice recipe book clicks patch, supercedes #1446 PurpurMC/Purpur@ff126d3 Updated Upstream (Paper) PurpurMC/Purpur@0458d84 Updated Upstream (Paper & Pufferfish) PurpurMC/Purpur@7aa6845 Add option to disable the copper oxidation proximity penalty (#1443)
43 lines
2.5 KiB
Diff
43 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Mon, 18 Sep 2023 00:35:27 +0300
|
|
Subject: [PATCH] Do not process chat/commands before player has joined
|
|
|
|
|
|
diff --git a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
index 512afaa97e89e3beb92cf2ebc46248eddd22cf5c..b8fa8f551c95503be60f990099b2d41296ea91de 100644
|
|
--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
+++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
@@ -162,4 +162,9 @@ public class DivineConfig {
|
|
private static void allowAnyUsername() {
|
|
allowAnyUsername = getBoolean("settings.player.allow-any-username", allowAnyUsername);
|
|
}
|
|
+
|
|
+ public static boolean doNotProcessChatCommands = true;
|
|
+ private static void doNotProcessChatCommands() {
|
|
+ doNotProcessChatCommands = getBoolean("settings.do-not-process-chat-commands", doNotProcessChatCommands);
|
|
+ }
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 6638d769a34287d54b22e4416003556915e153f1..32d2e53a73f70d64db13a7da01c3157bb0cd7395 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -6,6 +6,7 @@ import com.mojang.authlib.GameProfile;
|
|
import com.mojang.brigadier.ParseResults;
|
|
import com.mojang.brigadier.StringReader;
|
|
import com.mojang.logging.LogUtils;
|
|
+import gq.bxteam.divinemc.configuration.DivineConfig;
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|
@@ -2312,6 +2313,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
|
|
}); // Paper - push to main
|
|
return Optional.empty();
|
|
+ } else if (player.joining && DivineConfig.doNotProcessChatCommands) { // DivineMC - EMC - do not handle chat messages before they joined
|
|
+ return Optional.empty();
|
|
} else {
|
|
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);
|
|
|