From d852f744a01be275de262bc83068b8c0eda005b5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 24 Feb 2013 20:43:10 +1100 Subject: [PATCH] Add PR #7 - improve ping sending. --- ...5-Infrequently-send-tab-list-updates.patch | 72 ------------------- ...ptimize-getTileEntities-performance.patch} | 2 +- ...ile-entity-lookup-for-chunk-sending.patch} | 2 +- ...the-Metrics-system-to-be-closer-to-.patch} | 17 ++--- ...hread.patch => 0028-Watchdog-Thread.patch} | 4 +- .../{0030-Netty.patch => 0029-Netty.patch} | 2 +- ...ception-for-built-in-PluginChannels.patch} | 2 +- .../0031-Enable-Improved-ping-sending.patch | 53 ++++++++++++++ 8 files changed, 68 insertions(+), 86 deletions(-) delete mode 100644 CraftBukkit-Patches/0025-Infrequently-send-tab-list-updates.patch rename CraftBukkit-Patches/{0026-Optimize-getTileEntities-performance.patch => 0025-Optimize-getTileEntities-performance.patch} (96%) rename CraftBukkit-Patches/{0027-Improved-tile-entity-lookup-for-chunk-sending.patch => 0026-Improved-tile-entity-lookup-for-chunk-sending.patch} (96%) rename CraftBukkit-Patches/{0028-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch => 0027-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch} (98%) rename CraftBukkit-Patches/{0029-Watchdog-Thread.patch => 0028-Watchdog-Thread.patch} (99%) rename CraftBukkit-Patches/{0030-Netty.patch => 0029-Netty.patch} (99%) rename CraftBukkit-Patches/{0031-Kick-player-on-exception-for-built-in-PluginChannels.patch => 0030-Kick-player-on-exception-for-built-in-PluginChannels.patch} (98%) create mode 100644 CraftBukkit-Patches/0031-Enable-Improved-ping-sending.patch diff --git a/CraftBukkit-Patches/0025-Infrequently-send-tab-list-updates.patch b/CraftBukkit-Patches/0025-Infrequently-send-tab-list-updates.patch deleted file mode 100644 index 69c5e74d4..000000000 --- a/CraftBukkit-Patches/0025-Infrequently-send-tab-list-updates.patch +++ /dev/null @@ -1,72 +0,0 @@ -From d8bd72d1293a2c074efa2dc4f5093a3d6f0a8351 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 16 Feb 2013 19:05:15 +1100 -Subject: [PATCH] Infrequently send tab list updates. - ---- - src/main/java/net/minecraft/server/PlayerList.java | 13 ++++++++----- - src/main/java/org/bukkit/craftbukkit/Spigot.java | 2 ++ - src/main/resources/configurations/bukkit.yml | 1 + - 3 files changed, 11 insertions(+), 5 deletions(-) - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index d13fa19..3fc66aa 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -655,13 +655,16 @@ public abstract class PlayerList { - this.o = 0; - } - -- /* CraftBukkit start - remove updating of lag to players -- it spams way to much on big servers. -- if (this.o < this.players.size()) { -+ if (org.bukkit.craftbukkit.Spigot.tabPing && this.o < this.players.size()) { - EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.o); -- -- this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping)); -+ Packet packet = new Packet201PlayerInfo(entityplayer.listName, true, entityplayer.ping); -+ for (int i = 0; i < this.players.size(); ++i) { -+ PlayerConnection con = ((EntityPlayer) this.players.get(i)).playerConnection; -+ if (con.getPlayer().canSee(entityplayer.getBukkitEntity())) { -+ con.sendPacket(packet); -+ } -+ } - } -- // CraftBukkit end */ - } - - public void sendAll(Packet packet) { -diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java -index bc28d7b..dafbbc7 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Spigot.java -+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java -@@ -7,6 +7,7 @@ import org.bukkit.configuration.file.YamlConfiguration; - import java.util.List; - - public class Spigot { -+ public static boolean tabPing = false; - - public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { - commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); -@@ -30,6 +31,7 @@ public class Spigot { - server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!"); - } - -+ tabPing = configuration.getBoolean("settings.tab-ping", tabPing); - } - - /** -diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml -index 54e28db..26e6566 100644 ---- a/src/main/resources/configurations/bukkit.yml -+++ b/src/main/resources/configurations/bukkit.yml -@@ -31,6 +31,7 @@ settings: - command-complete: true - spam-exclusions: - - /skill -+ tab-ping: false - world-settings: - default: - growth-chunks-per-tick: 650 --- -1.8.1-rc2 - diff --git a/CraftBukkit-Patches/0026-Optimize-getTileEntities-performance.patch b/CraftBukkit-Patches/0025-Optimize-getTileEntities-performance.patch similarity index 96% rename from CraftBukkit-Patches/0026-Optimize-getTileEntities-performance.patch rename to CraftBukkit-Patches/0025-Optimize-getTileEntities-performance.patch index cfccd0170..cc5d6f357 100644 --- a/CraftBukkit-Patches/0026-Optimize-getTileEntities-performance.patch +++ b/CraftBukkit-Patches/0025-Optimize-getTileEntities-performance.patch @@ -1,4 +1,4 @@ -From c0bce5effec9fed2726650b37ca5ef37f005e2c4 Mon Sep 17 00:00:00 2001 +From f20cebf078418f0f42373e94481592ee15608692 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 20 Feb 2013 23:07:53 -0500 Subject: [PATCH] Optimize getTileEntities performance diff --git a/CraftBukkit-Patches/0027-Improved-tile-entity-lookup-for-chunk-sending.patch b/CraftBukkit-Patches/0026-Improved-tile-entity-lookup-for-chunk-sending.patch similarity index 96% rename from CraftBukkit-Patches/0027-Improved-tile-entity-lookup-for-chunk-sending.patch rename to CraftBukkit-Patches/0026-Improved-tile-entity-lookup-for-chunk-sending.patch index dc556335c..262ffb6db 100644 --- a/CraftBukkit-Patches/0027-Improved-tile-entity-lookup-for-chunk-sending.patch +++ b/CraftBukkit-Patches/0026-Improved-tile-entity-lookup-for-chunk-sending.patch @@ -1,4 +1,4 @@ -From 7b59da20b8a8fd9a537e2fd5a72a863ab21cff3b Mon Sep 17 00:00:00 2001 +From 2ee6a39216c5b2913d0ed585230afe36238960ff Mon Sep 17 00:00:00 2001 From: shakytom Date: Wed, 20 Feb 2013 22:34:38 -0500 Subject: [PATCH] Improved tile entity lookup for chunk sending diff --git a/CraftBukkit-Patches/0028-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch b/CraftBukkit-Patches/0027-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch similarity index 98% rename from CraftBukkit-Patches/0028-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch rename to CraftBukkit-Patches/0027-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch index 912d6343f..093d480e7 100644 --- a/CraftBukkit-Patches/0028-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch +++ b/CraftBukkit-Patches/0027-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch @@ -1,20 +1,20 @@ -From 25d1e688c5485b2e23a52c56f2c49ec36eb55883 Mon Sep 17 00:00:00 2001 +From ec31c15be3a7f53f13ec8e75a0480b3b956a16be Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Feb 2013 08:58:35 +1100 Subject: [PATCH] Metrics. Rewrite the Metrics system to be closer to the Bukkit version. --- - src/main/java/org/bukkit/craftbukkit/Spigot.java | 15 + + src/main/java/org/bukkit/craftbukkit/Spigot.java | 17 + src/main/java/org/spigotmc/Metrics.java | 645 +++++++++++++++++++++++ - 2 files changed, 660 insertions(+) + 2 files changed, 662 insertions(+) create mode 100644 src/main/java/org/spigotmc/Metrics.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java -index dafbbc7..ced4bd4 100644 +index bc28d7b..ced4bd4 100644 --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java -@@ -1,13 +1,19 @@ +@@ -1,12 +1,19 @@ package org.bukkit.craftbukkit; +import java.io.IOException; @@ -29,15 +29,16 @@ index dafbbc7..ced4bd4 100644 +import org.spigotmc.Metrics; public class Spigot { - public static boolean tabPing = false; ++ public static boolean tabPing = false; + private static Metrics metrics; public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); -@@ -32,6 +38,15 @@ public class Spigot { +@@ -30,6 +37,16 @@ public class Spigot { + server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!"); } - tabPing = configuration.getBoolean("settings.tab-ping", tabPing); ++ tabPing = configuration.getBoolean("settings.tab-ping", tabPing); + + if (metrics == null) { + try { diff --git a/CraftBukkit-Patches/0029-Watchdog-Thread.patch b/CraftBukkit-Patches/0028-Watchdog-Thread.patch similarity index 99% rename from CraftBukkit-Patches/0029-Watchdog-Thread.patch rename to CraftBukkit-Patches/0028-Watchdog-Thread.patch index 6db7d56c3..f5c6ec6f8 100644 --- a/CraftBukkit-Patches/0029-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0028-Watchdog-Thread.patch @@ -1,4 +1,4 @@ -From cd8026eec14b1b342f20cfad6f6f72cf4ef5d9a3 Mon Sep 17 00:00:00 2001 +From 2efc3e1c63f1d0868965ed0df2a8d2a462c063dd Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Feb 2013 12:33:20 +1100 Subject: [PATCH] Watchdog Thread. @@ -33,7 +33,7 @@ index 128016f..3a6b620 100644 this.isStopped = true; } catch (Throwable throwable1) { diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java -index 8c3cda5..5a96c86 100644 +index ced4bd4..15acc97 100644 --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java @@ -1,5 +1,6 @@ diff --git a/CraftBukkit-Patches/0030-Netty.patch b/CraftBukkit-Patches/0029-Netty.patch similarity index 99% rename from CraftBukkit-Patches/0030-Netty.patch rename to CraftBukkit-Patches/0029-Netty.patch index 6cfaef5e6..6047b5605 100644 --- a/CraftBukkit-Patches/0030-Netty.patch +++ b/CraftBukkit-Patches/0029-Netty.patch @@ -1,4 +1,4 @@ -From 48cf8759487754486c207f668ea1f04163f93f26 Mon Sep 17 00:00:00 2001 +From d53d91635104f6809f1bb666371b7fc4cb41fa16 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 14 Feb 2013 17:32:20 +1100 Subject: [PATCH] Netty diff --git a/CraftBukkit-Patches/0031-Kick-player-on-exception-for-built-in-PluginChannels.patch b/CraftBukkit-Patches/0030-Kick-player-on-exception-for-built-in-PluginChannels.patch similarity index 98% rename from CraftBukkit-Patches/0031-Kick-player-on-exception-for-built-in-PluginChannels.patch rename to CraftBukkit-Patches/0030-Kick-player-on-exception-for-built-in-PluginChannels.patch index 958489bf0..653ade811 100644 --- a/CraftBukkit-Patches/0031-Kick-player-on-exception-for-built-in-PluginChannels.patch +++ b/CraftBukkit-Patches/0030-Kick-player-on-exception-for-built-in-PluginChannels.patch @@ -1,4 +1,4 @@ -From 3cf26dc98a5f1484603b8b0ad04e8faaa6eba697 Mon Sep 17 00:00:00 2001 +From 90a010f980ef943857f4437f64e76761ad6c37d3 Mon Sep 17 00:00:00 2001 From: Eimref Date: Wed, 6 Feb 2013 18:59:07 -0500 Subject: [PATCH] Kick player on exception for built-in PluginChannels; Fixes diff --git a/CraftBukkit-Patches/0031-Enable-Improved-ping-sending.patch b/CraftBukkit-Patches/0031-Enable-Improved-ping-sending.patch new file mode 100644 index 000000000..04e1e7937 --- /dev/null +++ b/CraftBukkit-Patches/0031-Enable-Improved-ping-sending.patch @@ -0,0 +1,53 @@ +From 0374f99776040c7e5f14ac38c132bcc1bd43051f Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 24 Feb 2013 20:45:20 +1100 +Subject: [PATCH] Enable Improved ping sending + +--- + src/main/java/net/minecraft/server/EntityPlayer.java | 1 + + src/main/java/net/minecraft/server/PlayerList.java | 16 ++++++++++++++++ + 2 files changed, 17 insertions(+) + +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 28f462b..933a2e7 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -48,6 +48,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public int newLevel = 0; + public int newTotalExp = 0; + public boolean keepLevel = false; ++ public int lastPing = -1; // Spigot + // CraftBukkit end + + public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) { +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index d13fa19..6c19ad7 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -662,7 +662,23 @@ public abstract class PlayerList { + this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping)); + } + // CraftBukkit end */ ++ // Spigot start ++ if (this.players.size() == 0 || !org.bukkit.craftbukkit.Spigot.tabPing) { ++ return; ++ } ++ int index = MinecraftServer.currentTick % this.players.size(); ++ EntityPlayer player = (EntityPlayer) this.players.get(index); ++ if (player.lastPing == -1 || Math.abs(player.ping - player.lastPing) > 20) { ++ Packet packet = new Packet201PlayerInfo(player.listName, true, player.ping); ++ for (EntityPlayer splayer : (List) this.players) { ++ if (splayer.getBukkitEntity().canSee(player.getBukkitEntity())) { ++ splayer.playerConnection.sendPacket(packet); ++ } ++ } ++ player.lastPing = player.ping; ++ } + } ++ // Spigot end + + public void sendAll(Packet packet) { + for (int i = 0; i < this.players.size(); ++i) { +-- +1.8.1-rc2 +