9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-21 16:09:19 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0031-Do-not-process-chat-commands-before-player-has-joine.patch
Dreeam fbb7d752a0 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@51345a1c Correct nullable fall location type
PaperMC/Paper@93246a07 Fix errors when loading raid files without a PDC
PaperMC/Paper@cb3ffd0b Don't store empty PDCs on raids
PaperMC/Paper@d637ae85 Fix NoSuchElementException in EntityTransformEvent for slimes (#12510)
PaperMC/Paper@10742373 Pass correct draw strength for EntityShootBowEvent (#12308)
PaperMC/Paper@825685f8 Add PlayerPickBlockEvent and PlayerPickEntityEvent (#12425)
PaperMC/Paper@2bd84f6f Expand PotionMeta Api to allow getting effective potion colour and effects (#12390)
PaperMC/Paper@6f1f5b67 Fix ArmorStand items for canceled EntityDeathEvent (#12288)
2025-05-03 08:11:09 -04:00

53 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Tue, 29 Nov 2022 15:33:32 +0100
Subject: [PATCH] Do not process chat/commands before player has joined
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Do not process chat/commands before player has joined"
By: chickeneer <emcchickeneer@gmail.com>
As part of: EmpireCraft (https://github.com/starlis/empirecraft)
Licensed under: MIT (https://opensource.org/licenses/MIT)
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 16b390f527cf18a000ebed2950a35bcfb15c6c21..671393424ca6773ffeb05c4183cf833181f1c1a9 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -422,6 +422,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
public boolean sentListPacket = false;
public boolean supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready
// CraftBukkit end
+ public boolean didPlayerJoinEvent = false; // Gale - EMC - do not process chat/commands before player has joined
public boolean isRealPlayer; // Paper
public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public @Nullable String clientBrandName = null; // Paper - Brand support
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7576932c6ccb0e018ad19ef6cf4f5d217de6bda4..debeec0ff3bfb9f9d84ce0607365a05802b6496b 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2399,7 +2399,7 @@ public class ServerGamePacketListenerImpl
this.disconnectAsync(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add proper async disconnect
} else 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));
- } else {
+ } else if (player.didPlayerJoinEvent) { // Gale - EMC - do not process chat/commands before player has joined
this.player.resetLastActionTime();
// CraftBukkit start
if (sync) {
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index a0949d8256823731f6f7da30e74dfd0205dde380..2c025382d041c43486ae975a3f687bc4cddf8d62 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -334,6 +334,8 @@ public abstract class PlayerList {
return;
}
+ player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined
+
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure