Yatopia/patches/server/0046-Respect-PlayerKickEvent-leaveMessage.patch
Ivan Pekov f541b93c6a Updated Upstream and Sidestream(s) (Tuinity/Purpur/Rainforest)
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:
76777f0 Updated Upstream (Paper)
6465aba Merge branch 'master' of https://github.com/Spottedleaf/Tuinity into ver/1.16.3
ba4dbb6 Do not allow ticket level changes while unloading playerchunks
e0e7144 Aggressive state checking in region manager

Purpur Changes:
0743d38 PaperPR - Add hex color code support for console logging
081f5a7 Oopsie, lets fix these snowballs :3
4895a88 Improve output of plugins command
3424c40 Minor changes to projectile despawn rate patch
9d49a31 Updated Upstream (Paper)
09e0103 add snowball to despawn rate config

Rainforest Changes:
5a187d6 Update to 1.16.3.
2020-09-20 21:45:23 +03:00

66 lines
3.6 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 cb4f173774b46793bc3744cb3242edd9272df463..4fac720564b8687fae59c0f2e4898a48b16a9105 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -308,7 +308,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()); // CraftBukkit - fire quit instantly // Yatopia
this.networkManager.stopReading();
MinecraftServer minecraftserver = this.minecraftServer;
NetworkManager networkmanager = this.networkManager;
@@ -1603,6 +1603,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;
@@ -1618,7 +1623,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 c571ca533153e6d554d6da2a71b380224bdc6cd4..25186df83c41ae168bca30b28149005f4b9f45e9 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -500,6 +500,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);
@@ -585,7 +590,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