From a909429e0c5f4083c4a54afb70d4a0af71c3c2eb Mon Sep 17 00:00:00 2001 From: Ivan Pekov Date: Thu, 10 Sep 2020 21:35:41 +0300 Subject: [PATCH] Boys I got some fixes for you! --- PATCHES.md | 3 + .../server/0047-Give-them-items-motion.patch | 19 ++++++ ...-Fix-LightEngineThreaded-memory-leak.patch | 31 +++++++++ ...Respect-PlayerKickEvent-leaveMessage.patch | 65 +++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 patches/server/0047-Give-them-items-motion.patch create mode 100644 patches/server/0048-Fix-LightEngineThreaded-memory-leak.patch create mode 100644 patches/server/0049-Respect-PlayerKickEvent-leaveMessage.patch diff --git a/PATCHES.md b/PATCHES.md index b95f2414..9365e8b8 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -53,11 +53,13 @@ # Patches | server | Fix "Unable to save chunk" error | Ivan Pekov | | | server | Fix 'outdated server' showing in ping before server fully | William Blake Galbreath | | | server | Fix Bukkit.createInventory() with type LECTERN | willies952002 | | +| server | Fix LightEngineThreaded memory leak | Ivan Pekov | | | server | Fix exp drop of zombie pigmen (MC-56653) | Phoenix616 | | | server | Fix lead fall dmg config | tr7zw | | | server | Fix recipe crash | Ivan Pekov | | | server | Fix the dead lagging the server | William Blake Galbreath | | | server | Giants AI settings | William Blake Galbreath | | +| server | Give them items motion | Ivan Pekov | | | server | Global Eula file | tr7zw | | | server | Heavily optimize furnance fuel and recipe lookups | tr7zw | | | server | Highly optimize VillagePlace filtering | Ivan Pekov | | @@ -101,6 +103,7 @@ # Patches | server | Remove some streams and object allocations | Phoenix616 | | | server | Remove stream for ender teleport | Sotr | | | server | Remove vanilla profiler callers | Sotr | | +| server | Respect PlayerKickEvent leaveMessage | Ivan Pekov | | | server | Respect permissions when constructing InventoryEnderChest | Ivan Pekov | | | server | Send more packets immediately | MrIvanPlays | | | server | Skip events if there's no listeners | William Blake Galbreath | | diff --git a/patches/server/0047-Give-them-items-motion.patch b/patches/server/0047-Give-them-items-motion.patch new file mode 100644 index 00000000..9a1bb201 --- /dev/null +++ b/patches/server/0047-Give-them-items-motion.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ivan Pekov +Date: Thu, 10 Sep 2020 20:55:13 +0300 +Subject: [PATCH] Give them items motion + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 344177bc815264e07a3695d9f0c3a1cd90899aa7..dff2bd940a327061aa906a5e26646b09cc0b23b8 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -1551,7 +1551,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + } + + public void setPositionRotation(double d0, double d1, double d2, float f, float f1) { +- this.mot = new Vec3D(0, 0, 0); // Paper - cancel entity velocity if teleported ++ if (this instanceof EntityPlayer) { this.mot = Vec3D.a; } // Paper - cancel entity velocity if teleported // Yatopia - fix PaperMC-4292 + this.g(d0, d1, d2); + this.yaw = f; + this.pitch = f1; diff --git a/patches/server/0048-Fix-LightEngineThreaded-memory-leak.patch b/patches/server/0048-Fix-LightEngineThreaded-memory-leak.patch new file mode 100644 index 00000000..444c508c --- /dev/null +++ b/patches/server/0048-Fix-LightEngineThreaded-memory-leak.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ivan Pekov +Date: Thu, 10 Sep 2020 21:02:26 +0300 +Subject: [PATCH] Fix LightEngineThreaded memory leak + + +diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java +index ceaa92400678aef3bf436279dd807e4b38609dda..d9bbac17c5767df638fc4464e9795d5c842c3056 100644 +--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java ++++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java +@@ -114,6 +114,8 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { + } + } + ++ public final void remove(long chunkId) { pendingTasks.removeIf(task -> task.chunkId == chunkId); queueUpdate(); } // Yatopia ++ + public final boolean isEmpty() { + return this.size == 0 && this.pendingTasks.isEmpty(); + } +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index adda64b92b7ea1a62d18ebe81c9a5bc5547f21e0..e5031225b3da2899686067dca97baa1baa478719 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -1787,6 +1787,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + // Paper end + ++ chunkProvider.getLightEngine().queue.remove(chunk.getPos().pair()); // Yatopia - unregister from light queue + } + + public void unregisterEntity(Entity entity) { diff --git a/patches/server/0049-Respect-PlayerKickEvent-leaveMessage.patch b/patches/server/0049-Respect-PlayerKickEvent-leaveMessage.patch new file mode 100644 index 00000000..83319a6d --- /dev/null +++ b/patches/server/0049-Respect-PlayerKickEvent-leaveMessage.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ivan Pekov +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 529537ce96b6dcb51c04f66c0a205dc4804a4d02..64ba11b251e2ebc53434c9eabf6982ac2965caf3 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -309,7 +309,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; +@@ -1604,6 +1604,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; +@@ -1619,7 +1624,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 2fdca1dc83ba77dbf0c84ebfac1af6cb330d52fa..15768537fb3695d94c20fda53a708ef779761b79 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