mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
Fix player chat messages from vanished players resulting in kicks (#8777)
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
This commit is contained in:
parent
8e08d9b023
commit
7a64b85f92
@ -2349,7 +2349,7 @@ index be097f13dba5d408f58d6fada893bed2638d4219..3d7d1ba148dbc3591d8c76b99a2ee7d9
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 25227822aa0e1dd7fbbe98a0925ccd023af8d0dc..7cd2af9a08bfca0c7de1ecac21ee7f8a790e8b64 100644
|
||||
index 25227822aa0e1dd7fbbe98a0925ccd023af8d0dc..8c1937ff71b8b4dad85e20b55dcf2a0cc06ce2df 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils;
|
||||
@ -2464,7 +2464,7 @@ index 25227822aa0e1dd7fbbe98a0925ccd023af8d0dc..7cd2af9a08bfca0c7de1ecac21ee7f8a
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -1181,14 +1181,24 @@ public abstract class PlayerList {
|
||||
@@ -1181,24 +1181,43 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) {
|
||||
@ -2487,20 +2487,31 @@ index 25227822aa0e1dd7fbbe98a0925ccd023af8d0dc..7cd2af9a08bfca0c7de1ecac21ee7f8a
|
||||
boolean flag = this.verifyChatTrusted(message);
|
||||
|
||||
- this.server.logChatMessage(message.decoratedContent(), params, flag ? null : "Not Secure");
|
||||
+ this.server.logChatMessage((unsignedFunction == null ? message : message.withUnsignedContent(unsignedFunction.apply(this.server.console))).decoratedContent(), params, flag ? null : "Not Secure"); // Paper
|
||||
+ this.server.logChatMessage((unsignedFunction == null ? Component.literal(message.signedContent()) : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper
|
||||
OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message);
|
||||
boolean flag1 = false;
|
||||
|
||||
@@ -1198,7 +1208,7 @@ public abstract class PlayerList {
|
||||
boolean flag2;
|
||||
+ Packet<?> disguised = sender != null && unsignedFunction == null ? new net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket(outgoingchatmessage.content(), params.toNetwork(sender.level.registryAccess())) : null; // Paper - don't send player chat packets from vanished players
|
||||
|
||||
for (Iterator iterator = this.players.iterator(); iterator.hasNext(); flag1 |= flag2 && message.isFullyFiltered()) {
|
||||
ServerPlayer entityplayer1 = (ServerPlayer) iterator.next();
|
||||
|
||||
flag2 = shouldSendFiltered.test(entityplayer1);
|
||||
- entityplayer1.sendChatMessage(outgoingchatmessage, flag2, params);
|
||||
+ // Paper start - don't send player chat packets from vanished players
|
||||
+ if (sender != null && !entityplayer1.getBukkitEntity().canSee(sender.getBukkitEntity())) {
|
||||
+ entityplayer1.connection.send(unsignedFunction != null
|
||||
+ ? new net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket(unsignedFunction.apply(entityplayer1.getBukkitEntity()), params.toNetwork(sender.level.registryAccess()))
|
||||
+ : disguised);
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ entityplayer1.sendChatMessage(outgoingchatmessage, flag2, params, unsignedFunction == null ? null : unsignedFunction.apply(entityplayer1.getBukkitEntity())); // Paper
|
||||
}
|
||||
|
||||
if (flag1 && sender != null) {
|
||||
@@ -1207,7 +1217,7 @@ public abstract class PlayerList {
|
||||
@@ -1207,7 +1226,7 @@ public abstract class PlayerList {
|
||||
|
||||
}
|
||||
|
||||
|
@ -15940,7 +15940,7 @@ index e4435962a60cf9c6d833183bd244a2758ff42808..b85545f997447875e737e4d22a8a8dbc
|
||||
StringReader stringreader = new StringReader(packet.getCommand());
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 5ecdd3ed015c220eb8217ea36388d68c05fa1d4c..08f7bafbe1979c3b531cb13255704ea5319b9c07 100644
|
||||
index 257b13703166bf953c73c83db8982b412ca96565..da36a7342c5ef34af9ea4330e6cee2880d8d4dc8 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -251,7 +251,7 @@ public abstract class PlayerList {
|
||||
@ -15963,7 +15963,7 @@ index 5ecdd3ed015c220eb8217ea36388d68c05fa1d4c..08f7bafbe1979c3b531cb13255704ea5
|
||||
entityplayer1.spawnIn(worldserver1);
|
||||
entityplayer1.unsetRemoved();
|
||||
entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
@@ -1272,7 +1272,7 @@ public abstract class PlayerList {
|
||||
@@ -1281,7 +1281,7 @@ public abstract class PlayerList {
|
||||
|
||||
public void setViewDistance(int viewDistance) {
|
||||
this.viewDistance = viewDistance;
|
||||
@ -15972,7 +15972,7 @@ index 5ecdd3ed015c220eb8217ea36388d68c05fa1d4c..08f7bafbe1979c3b531cb13255704ea5
|
||||
Iterator iterator = this.server.getAllLevels().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1287,7 +1287,7 @@ public abstract class PlayerList {
|
||||
@@ -1296,7 +1296,7 @@ public abstract class PlayerList {
|
||||
|
||||
public void setSimulationDistance(int simulationDistance) {
|
||||
this.simulationDistance = simulationDistance;
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Use username instead of display name in
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 3d458d034cf074f56fc828ced0f3b97b096371ea..af78bee12160435fc2ea01bfa7a1cd919e353833 100644
|
||||
index 0093be36b2d107549da99d51894f7a332af5e3fa..c092bfa679c60fd11eb95aaa4828b4f3403869f8 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1398,7 +1398,7 @@ public abstract class PlayerList {
|
||||
@@ -1407,7 +1407,7 @@ public abstract class PlayerList {
|
||||
// CraftBukkit start
|
||||
public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) {
|
||||
ServerStatsCounter serverstatisticmanager = entityhuman.getStats();
|
||||
|
Loading…
Reference in New Issue
Block a user