mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
I'll make some changes now, so skipping build Changelog: * add CarpetFixes optimizations * fix optimizations config * lithium optimizations * add Carpet Fixes Sheep Optimization * add Async Pathfinding; add C2ME opts math * add 2 vmp patches * New performance patches; update README and wiki README * update configuration on wiki * update wiki main page * Updated Upstream (Purpur) * fix conflicts * make "Don't save Fireworks" patch configurable * Disable memory reserve allocating * Fix MC-172801 * resolve conflicts * add bstats to readme * dd custom list of forks * update logo link
42 lines
2.4 KiB
Diff
42 lines
2.4 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 fa7ee2b2778a26d0e466bdc05ade26a5ae0c17f4..11dc1af9f8d8ce8c0a855d14a35077f5482ef0e8 100644
|
|
--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
+++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java
|
|
@@ -152,4 +152,9 @@ public class DivineConfig {
|
|
}
|
|
return builder.build();
|
|
}
|
|
+
|
|
+ public static boolean doNotProcessChatCommands = true;
|
|
+ private static void doNotProcessChatCommands() {
|
|
+ doNotProcessChatCommands = getBoolean("settings.do-not-process-chat-commands", doNotProcessChatCommands);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 8352ac55efdfb2ff56c667ceaa0e4d7ce5365a23..c2cb9d6fd3587f33b95b1b60a0f9979a04739706 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;
|
|
@@ -2323,6 +2324,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
|
|
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
|
|
return Optional.empty();
|
|
+ } else if (player.joining && DivineConfig.doNotProcessChatCommands) { // DivineMC - EMC - do not handle chat messages before they joined
|
|
+ return Optional.empty();
|
|
} else {
|
|
this.player.resetLastActionTime();
|
|
return optional;
|