From cf6a7ce46d03c96dea7335b664ae3d4903f65d4b Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 19 Apr 2015 20:20:50 +1000 Subject: [PATCH] Use CLQ for main thread tasks. Means netty threads aren't blocked for long synchronisations whilst tasks are running. --- CraftBukkit-Patches/0012-Spigot-Timings.patch | 8 +-- ...8-Allow-Disabling-of-Command-Logging.patch | 6 +- .../0033-Disallow-Interaction-With-Self.patch | 6 +- ...0045-Don-t-Special-Case-X-Move-Value.patch | 8 +-- .../0082-Spam-Filter-Exclusions.patch | 6 +- ...Allow-Disabling-Creative-Item-Filter.patch | 6 +- ...-the-isDisconnected-method-by-bukkit.patch | 6 +- ...riptive-kick-reasons-instead-of-Nope.patch | 8 +-- ...tion-input-on-the-main-thread.-Fixes.patch | 6 +- ...-block-placement-interaction-packets.patch | 14 ++--- ...ake-moved-wrongly-limit-configurable.patch | 6 +- ...moved-too-quickly-limit-configurable.patch | 6 +- .../0158-Use-CLQ-for-main-thread-tasks.patch | 56 +++++++++++++++++++ 13 files changed, 99 insertions(+), 43 deletions(-) create mode 100644 CraftBukkit-Patches/0158-Use-CLQ-for-main-thread-tasks.patch diff --git a/CraftBukkit-Patches/0012-Spigot-Timings.patch b/CraftBukkit-Patches/0012-Spigot-Timings.patch index 06ef338d6c..66d270c6f3 100644 --- a/CraftBukkit-Patches/0012-Spigot-Timings.patch +++ b/CraftBukkit-Patches/0012-Spigot-Timings.patch @@ -1,4 +1,4 @@ -From 00b24e2eea1e526a6d351ae508f66f9e5f71d474 Mon Sep 17 00:00:00 2001 +From 2b98747833a588469352c523a5b5dd56ddf789b7 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 10 Jan 2013 00:18:11 -0500 Subject: [PATCH] Spigot Timings @@ -367,10 +367,10 @@ index 611a623..af2e9bc 100644 this.methodProfiler.b(); } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 459752b..d6f6291 100644 +index a295e61..eb977e1 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1061,6 +1061,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -1067,6 +1067,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end private void handleCommand(String s) { @@ -378,7 +378,7 @@ index 459752b..d6f6291 100644 // CraftBukkit start - whole method this.c.info(this.player.getName() + " issued server command: " + s); -@@ -1070,18 +1071,22 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -1076,18 +1077,22 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch index b8c49f0ab8..3b11da1ca2 100644 --- a/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch +++ b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch @@ -1,14 +1,14 @@ -From d18bd3032e8271601709a7c841c72716cfc6f624 Mon Sep 17 00:00:00 2001 +From ab69bfc5ab7eaa0ef4fb1f568a2b0d88181d122d Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 18:01:29 +1000 Subject: [PATCH] Allow Disabling of Command Logging diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d6f6291..5b1900a 100644 +index eb977e1..8e18c9f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1063,6 +1063,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -1069,6 +1069,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList private void handleCommand(String s) { org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot // CraftBukkit start - whole method diff --git a/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch b/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch index fd26a26ab6..6342a85fd8 100644 --- a/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch +++ b/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch @@ -1,14 +1,14 @@ -From 38cd29103c2ced5c7da0603821c4f75d47960f42 Mon Sep 17 00:00:00 2001 +From d4e1a324eb84acc9fc1b3e967292ee784beae6bf Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 28 Jun 2013 19:52:54 +1000 Subject: [PATCH] Disallow Interaction With Self diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 5b1900a..60fa768 100644 +index 8e18c9f..2786399 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1198,6 +1198,13 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -1204,6 +1204,13 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); diff --git a/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch b/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch index 9c547b0099..d94b4b531b 100644 --- a/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch +++ b/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch @@ -1,11 +1,11 @@ -From 3044bd3231f451f14810c8382a6bac82b877d1b7 Mon Sep 17 00:00:00 2001 +From ea79c836f34f613e75e1d40a5359210125ab3ae0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 6 Oct 2013 17:36:28 +1100 Subject: [PATCH] Don't Special Case X Move Value diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 60fa768..1e8dcc1 100644 +index 2786399..a1341a7 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -109,6 +109,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList @@ -16,7 +16,7 @@ index 60fa768..1e8dcc1 100644 public CraftPlayer getPlayer() { return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); -@@ -217,6 +218,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -223,6 +224,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } // CraftBukkit start - fire PlayerMoveEvent Player player = this.getPlayer(); @@ -35,7 +35,7 @@ index 60fa768..1e8dcc1 100644 Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. Location to = player.getLocation().clone(); // Start off the To location as the Players current location. -@@ -245,7 +258,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -251,7 +264,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.lastPitch = to.getPitch(); // Skip the first time we do this diff --git a/CraftBukkit-Patches/0082-Spam-Filter-Exclusions.patch b/CraftBukkit-Patches/0082-Spam-Filter-Exclusions.patch index ce480f0fc7..289891aa06 100644 --- a/CraftBukkit-Patches/0082-Spam-Filter-Exclusions.patch +++ b/CraftBukkit-Patches/0082-Spam-Filter-Exclusions.patch @@ -1,14 +1,14 @@ -From eafea3420ac76bfdc51785764024dc8f74086cad Mon Sep 17 00:00:00 2001 +From 19a15e7391ff2f82fce0fef0686aaec22364853d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 8 Feb 2014 08:13:40 +0000 Subject: [PATCH] Spam Filter Exclusions diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1e8dcc1..63fe40e 100644 +index a1341a7..788300c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -969,9 +969,20 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -975,9 +975,20 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false); } diff --git a/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch b/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch index 3cd86071f2..0fd6ea6b31 100644 --- a/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch +++ b/CraftBukkit-Patches/0085-Allow-Disabling-Creative-Item-Filter.patch @@ -1,14 +1,14 @@ -From 62f6d3d586be6666187e97e5dcd38689dddf6567 Mon Sep 17 00:00:00 2001 +From 1e6077f596837a4ae0328b6a179779f78a41d04f Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 12 Feb 2014 18:18:01 +1100 Subject: [PATCH] Allow Disabling Creative Item Filter diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 63fe40e..cf794b5 100644 +index 788300c..78f6444 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1695,7 +1695,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -1701,7 +1701,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); // CraftBukkit - Add invalidItems check diff --git a/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch b/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch index c239cbceb8..e87fc14b02 100644 --- a/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch +++ b/CraftBukkit-Patches/0088-Unfinalize-the-isDisconnected-method-by-bukkit.patch @@ -1,4 +1,4 @@ -From b1bae6016141e328ccc661362d7cbba0833f3ab2 Mon Sep 17 00:00:00 2001 +From 606b505960fd5b49dc45cc87a79e08a106ffc85f Mon Sep 17 00:00:00 2001 From: hcherndon Date: Sat, 15 Feb 2014 01:51:20 -0600 Subject: [PATCH] Unfinalize the isDisconnected() method by bukkit. @@ -6,10 +6,10 @@ Subject: [PATCH] Unfinalize the isDisconnected() method by bukkit. This would literally mean the world to me. You have no idea how much this method being final is fucking me over right now. (Working with NPC's and what not.) diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index cf794b5..d8f9299 100644 +index 78f6444..66366fc 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2058,7 +2058,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -2064,7 +2064,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } // CraftBukkit start - Add "isDisconnected" method diff --git a/CraftBukkit-Patches/0095-Descriptive-kick-reasons-instead-of-Nope.patch b/CraftBukkit-Patches/0095-Descriptive-kick-reasons-instead-of-Nope.patch index 3b6f53dcfb..8e5c7ce586 100644 --- a/CraftBukkit-Patches/0095-Descriptive-kick-reasons-instead-of-Nope.patch +++ b/CraftBukkit-Patches/0095-Descriptive-kick-reasons-instead-of-Nope.patch @@ -1,4 +1,4 @@ -From 4c5b325c337e4824aadd558eb5dc9321481fb3d6 Mon Sep 17 00:00:00 2001 +From d9429048c292e4bcaa5409ea686274a6efd3b138 Mon Sep 17 00:00:00 2001 From: drXor Date: Sat, 15 Mar 2014 01:30:05 -0400 Subject: [PATCH] Descriptive kick reasons instead of Nope! @@ -27,10 +27,10 @@ index 82accf4..d6bef0b 100644 f1 = 0; } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d8f9299..8e8f1cf 100644 +index 66366fc..fbab12e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -194,7 +194,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -200,7 +200,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList || !NumberConversions.isFinite(packetplayinflying.yaw) || !NumberConversions.isFinite(packetplayinflying.pitch)) { c.warn(player.getName() + " was caught trying to crash the server with an invalid position."); @@ -39,7 +39,7 @@ index d8f9299..8e8f1cf 100644 return; } // CraftBukkit end -@@ -892,7 +892,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -898,7 +898,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.player.z(); } else { PlayerConnection.c.warn(this.player.getName() + " tried to set an invalid carried item"); diff --git a/CraftBukkit-Patches/0120-Process-conversation-input-on-the-main-thread.-Fixes.patch b/CraftBukkit-Patches/0120-Process-conversation-input-on-the-main-thread.-Fixes.patch index da16fddcba..56e9e26259 100644 --- a/CraftBukkit-Patches/0120-Process-conversation-input-on-the-main-thread.-Fixes.patch +++ b/CraftBukkit-Patches/0120-Process-conversation-input-on-the-main-thread.-Fixes.patch @@ -1,4 +1,4 @@ -From a4f10950a712aa45be78dc52b0649bd0840bed42 Mon Sep 17 00:00:00 2001 +From e323209d6bb5583e741a3573d8b1993a19d740ef Mon Sep 17 00:00:00 2001 From: riking Date: Wed, 14 May 2014 13:46:48 -0700 Subject: [PATCH] Process conversation input on the main thread. Fixes @@ -6,10 +6,10 @@ Subject: [PATCH] Process conversation input on the main thread. Fixes diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8e8f1cf..188e6ce 100644 +index fbab12e..c46e943 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -954,7 +954,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -960,7 +960,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } else if (s.isEmpty()) { c.warn(this.player.getName() + " tried to send an empty message"); } else if (getPlayer().isConversing()) { diff --git a/CraftBukkit-Patches/0125-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0125-Limit-block-placement-interaction-packets.patch index d884dea9f4..ea8f351762 100644 --- a/CraftBukkit-Patches/0125-Limit-block-placement-interaction-packets.patch +++ b/CraftBukkit-Patches/0125-Limit-block-placement-interaction-packets.patch @@ -1,4 +1,4 @@ -From 84ab4d1c872c790b2dd1c43afbd2a429dbd76f89 Mon Sep 17 00:00:00 2001 +From 4d08e72d67e499a79d97a6702f8db54fe287496e Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sun, 29 Jun 2014 21:10:34 +0100 Subject: [PATCH] Limit block placement/interaction packets @@ -24,10 +24,10 @@ index c611db1..28cb5e3 100644 public void b(PacketDataSerializer packetdataserializer) throws IOException {} diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 188e6ce..9ea05bd 100644 +index c46e943..b64503d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -626,10 +626,23 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -632,10 +632,23 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end } @@ -52,7 +52,7 @@ index 188e6ce..9ea05bd 100644 // CraftBukkit start if (this.player.dead) return; -@@ -652,7 +665,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -658,7 +671,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit start int itemstackAmount = itemstack.count; @@ -62,7 +62,7 @@ index 188e6ce..9ea05bd 100644 // Raytrace to look for 'rogue armswings' float f1 = this.player.pitch; float f2 = this.player.yaw; -@@ -688,6 +702,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -694,6 +708,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList if (!cancelled) { this.player.playerInteractManager.useItem(this.player, this.player.world, itemstack); } @@ -71,7 +71,7 @@ index 188e6ce..9ea05bd 100644 // CraftBukkit - notch decrements the counter by 1 in the above method with food, // snowballs and so forth, but he does it in a place that doesn't cause the -@@ -713,7 +729,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -719,7 +735,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { @@ -80,7 +80,7 @@ index 188e6ce..9ea05bd 100644 } flag = true; -@@ -1130,6 +1146,19 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -1136,6 +1152,19 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList public void a(PacketPlayInArmAnimation packetplayinarmanimation) { if (this.player.dead) return; // CraftBukkit PlayerConnectionUtils.ensureMainThread(packetplayinarmanimation, this, this.player.u()); diff --git a/CraftBukkit-Patches/0136-Make-moved-wrongly-limit-configurable.patch b/CraftBukkit-Patches/0136-Make-moved-wrongly-limit-configurable.patch index af5eb15c63..751491938d 100644 --- a/CraftBukkit-Patches/0136-Make-moved-wrongly-limit-configurable.patch +++ b/CraftBukkit-Patches/0136-Make-moved-wrongly-limit-configurable.patch @@ -1,14 +1,14 @@ -From d56ab7af0599afc6674b4825f22cab3cda051ad4 Mon Sep 17 00:00:00 2001 +From 6f7f9b857c6586787dd57c3488142aada77d97a2 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Fri, 4 Jul 2014 23:03:13 +0200 Subject: [PATCH] Make "moved wrongly" limit configurable diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 9ea05bd..056516c 100644 +index b64503d..44c8052 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -416,7 +416,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -422,7 +422,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList d17 = d11 * d11 + d12 * d12 + d13 * d13; boolean flag1 = false; diff --git a/CraftBukkit-Patches/0138-Make-moved-too-quickly-limit-configurable.patch b/CraftBukkit-Patches/0138-Make-moved-too-quickly-limit-configurable.patch index ac33459ba0..3df973cc2c 100644 --- a/CraftBukkit-Patches/0138-Make-moved-too-quickly-limit-configurable.patch +++ b/CraftBukkit-Patches/0138-Make-moved-too-quickly-limit-configurable.patch @@ -1,14 +1,14 @@ -From 9c6f37051dbfb75d73f01f7437d14e125b300ccd Mon Sep 17 00:00:00 2001 +From d9bdd343cac4ba10519ebb8ec29a2f6db33182f2 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Tue, 22 Jul 2014 15:59:01 +0200 Subject: [PATCH] Make "moved too quickly" limit configurable diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 056516c..5f3884a 100644 +index 44c8052..3108938 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -389,7 +389,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -395,7 +395,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end double d17 = d14 * d14 + d15 * d15 + d16 * d16; diff --git a/CraftBukkit-Patches/0158-Use-CLQ-for-main-thread-tasks.patch b/CraftBukkit-Patches/0158-Use-CLQ-for-main-thread-tasks.patch new file mode 100644 index 0000000000..150294b00e --- /dev/null +++ b/CraftBukkit-Patches/0158-Use-CLQ-for-main-thread-tasks.patch @@ -0,0 +1,56 @@ +From f7dee00c85a3c65a1132e1aa3f8a5aac417ba887 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sun, 19 Apr 2015 09:19:39 +1000 +Subject: [PATCH] Use CLQ for main thread tasks. + + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 88640a5..1aa659d 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -104,7 +104,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + private long X = 0L; + private final GameProfileRepository Y; + private final UserCache Z; +- protected final Queue> j = Queues.newArrayDeque(); ++ protected final Queue> j = new java.util.concurrent.ConcurrentLinkedQueue>(); // Spigot, PAIL: Rename + private Thread serverThread; + private long ab = ay(); + +@@ -705,11 +705,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + this.methodProfiler.a("jobs"); + Queue queue = this.j; + +- synchronized (this.j) { +- while (!this.j.isEmpty()) { +- SystemUtils.a((FutureTask) this.j.poll(), MinecraftServer.LOGGER); +- } +- } ++ // Spigot start ++ FutureTask entry; ++ int count = this.j.size(); ++ while ((entry = this.j.poll()) != null && count-- > 0) { ++ SystemUtils.a(entry, MinecraftServer.LOGGER); ++ } ++ // Spigot end + + this.methodProfiler.c("levels"); + +@@ -1493,10 +1495,10 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); + Queue queue = this.j; + +- synchronized (this.j) { +- this.j.add(listenablefuturetask); +- return listenablefuturetask; +- } ++ // Spigot start ++ this.j.add(listenablefuturetask); ++ return listenablefuturetask; ++ // Spigot end + } else { + try { + return Futures.immediateFuture(callable.call()); +-- +2.1.0 +