mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@8a1e23d Updated Upstream (Paper) PurpurMC/Purpur@42d0290 return empty itemstack to PlayerBookTooLargeEvent if book is not being held PurpurMC/Purpur@1f589eb Updated Upstream (Paper) PurpurMC/Purpur@ea2835b Updated Upstream (Paper)
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 426ae4086adc0180e3f3ba06cf6c005476ca891e..02dc7f154098313ff58a688ac5080457bc108164 100644
|
|
--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
+++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
@@ -157,4 +157,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 bf74dd38b5d495f8d2ac6a2072fd95dbdd2f44e4..3034e1801efd1b855e29dac1e64f7c10d50cada8 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;
|
|
@@ -2315,6 +2316,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);
|
|
|