Yatopia/patches/server/0037-Respect-PlayerKickEvent-leaveMessage.patch
Ivan Pekov ef7a12601f
Updated Upstream and Sidestream(s) (Tuinity/EMC/Purpur/AirplaneLite)
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
86b20d4 Updated Upstream (Paper)
afd0643 Merge branch 'master' of https://github.com/Spottedleaf/Tuinity into ver/1.16.4
d1db107 Updated Upstream (Paper)

EMC Changes:
d32f7b26 Updated Paper
0650e984 Only retrack passengers if there are passengers in them

Purpur Changes:
5758335 Configurable spawn reinforcements attribute
8849c20 Fix afk broadcast stripped colors
fe73b19 Updated Upstream (Paper)
f3dccd1 [ci-skip] Specify UTF-8 for Javadoc and JavaCompile
7ad2c5d [ci-skip] More attributes work
19ec1c3 [ci-skip] Uh.. I dont even know..
1cb7e4e Add PlayerBookTooLargeEvent
4e8a150 Updated Upstream (Paper)
8cabaae Updated Upstream (Paper & Tuinity)

AirplaneLite Changes:
20b8c79 Allow gradle wrapper in gitignore
6cd80e9 Updated Upstream (Tuinity)
2020-12-24 09:14:21 +02:00

66 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Thu, 10 Sep 2020 21:16:40 +0300
Subject: [PATCH] Respect PlayerKickEvent leaveMessage
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 10139becc33a483a81858dcad2d07571e48ea43e..c258b5b1cc6d5f7fae49c311865e9506d0164c6a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -323,7 +323,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(ichatbasecomponent), (future) -> {
this.networkManager.close(ichatbasecomponent);
});
- this.a(ichatbasecomponent); // CraftBukkit - fire quit instantly
+ this.a(ichatbasecomponent, event.getLeaveMessage() == null || event.getLeaveMessage().equalsIgnoreCase(leaveMessage) ? null : event.getLeaveMessage()); // CraftBukkit - fire quit instantly // Yatopia
this.networkManager.stopReading();
MinecraftServer minecraftserver = this.minecraftServer;
NetworkManager networkmanager = this.networkManager;
@@ -1691,6 +1691,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(IChatBaseComponent ichatbasecomponent) {
+ // Yatopia start - added quitMessage parameter
+ a(ichatbasecomponent, null);
+ }
+ public void a(IChatBaseComponent ichatbasecomponent, String quitMessage) {
+ // Yatopia end
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@@ -1706,7 +1711,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
*/
this.player.p();
- String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player);
+ quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player, quitMessage); // Yatopia
if ((quitMessage != null) && (quitMessage.length() > 0)) {
this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage));
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index d52985bc8236ba78b9530b4465e1f6de895f3b72..6b7209a4a5128a2fa64442365a4e53c7cf866621 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -499,6 +499,11 @@ public abstract class PlayerList {
}
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
+ // Yatopia start - add quitMessage parameter
+ return disconnect(entityplayer, null);
+ }
+ public String disconnect(EntityPlayer entityplayer, String quitMessage) {
+ // Yatopia end
WorldServer worldserver = entityplayer.getWorldServer();
entityplayer.a(StatisticList.LEAVE_GAME);
@@ -589,7 +594,7 @@ public abstract class PlayerList {
cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
// CraftBukkit end
- return entityplayer.didPlayerJoinEvent ? playerQuitEvent.getQuitMessage() : null; // CraftBukkit // Paper - don't print quit if we never printed join
+ return entityplayer.didPlayerJoinEvent ? quitMessage != null ? quitMessage : playerQuitEvent.getQuitMessage() : null; // CraftBukkit // Paper - don't print quit if we never printed join // Yatopia
}
// CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer