mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 14:15:43 +01:00
0a19056af0
Fixes bad performance out of the box for production. Apparently there's another issue which is thinkering our minds up, it is that after certain amount of time the gc just can't keep up. We're investigating into this, but until it is fixed - this is gonna be a stable build Co-authored-by: Mykyta Komarn <nkomarn@hotmail.com>
66 lines
3.7 KiB
Diff
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 7f551ad4b80c092b3cb22f040dcf9a40ec5b03e9..f4a2bae611806aa861b4f12b7f42c3117d528d95 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().equalsIgnoreCase(leaveMessage) ? null : event.getLeaveMessage()); // CraftBukkit - fire quit instantly // Yatopia
|
|
this.networkManager.stopReading();
|
|
MinecraftServer minecraftserver = this.minecraftServer;
|
|
NetworkManager networkmanager = this.networkManager;
|
|
@@ -1601,6 +1601,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;
|
|
@@ -1616,7 +1621,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 01b3904fd813f98048396f5b4c041f35d3b395c4..41fb2bcd6c4a2c99ff5f71d059c5485eaa3a6193 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);
|
|
@@ -587,7 +592,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
|