From e94f09ff804f98e998110e33d0caa543b7241863 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 17:41:26 +1000 Subject: [PATCH] Ping sending patch done --- .../0004-Spigot-Configuration.patch | 10 ++--- ...b-Spawning-Relative-to-View-Distance.patch | 6 +-- .../0022-Entity-Activation-Range.patch | 6 +-- ...> 0033-Enable-Improved-Ping-Sending.patch} | 39 +++++++++---------- 4 files changed, 30 insertions(+), 31 deletions(-) rename CraftBukkit-Patches/{0033-Enable-Improved-ping-sending.patch => 0033-Enable-Improved-Ping-Sending.patch} (54%) diff --git a/CraftBukkit-Patches/0004-Spigot-Configuration.patch b/CraftBukkit-Patches/0004-Spigot-Configuration.patch index 9066d4002a..49e19591e8 100644 --- a/CraftBukkit-Patches/0004-Spigot-Configuration.patch +++ b/CraftBukkit-Patches/0004-Spigot-Configuration.patch @@ -1,4 +1,4 @@ -From 0abff71f90ac188f2bc11f81faa224f58179f1c8 Mon Sep 17 00:00:00 2001 +From ba981dd9b929cf59480d214ed9de8cd79c3bdbbc Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 20 Jun 2013 17:35:57 +1000 Subject: [PATCH] Spigot Configuration @@ -38,7 +38,7 @@ index 3a4ddea..de052bd 100644 this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java new file mode 100644 -index 0000000..bf297bc +index 0000000..43d94fe --- /dev/null +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -0,0 +1,98 @@ @@ -128,7 +128,7 @@ index 0000000..bf297bc + return config.getInt( path, config.getInt( path ) ); + } + -+ private List getList(String path, T def) ++ private List getList(String path, T def) + { + config.addDefault( path, def ); + return (List) config.getList( path, config.getList( path ) ); @@ -142,7 +142,7 @@ index 0000000..bf297bc +} diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java new file mode 100644 -index 0000000..6642e86 +index 0000000..facea4f --- /dev/null +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +1,63 @@ @@ -197,7 +197,7 @@ index 0000000..6642e86 + return config.getInt( "world-settings." + worldName + "." + path, config.getInt( "world-settings.default." + path ) ); + } + -+ private List getList(String path, T def) ++ private List getList(String path, T def) + { + config.addDefault( "world-settings.default." + path, def ); + return (List) config.getList( "world-settings." + worldName + "." + path, config.getList( "world-settings.default." + path ) ); diff --git a/CraftBukkit-Patches/0020-Fix-Mob-Spawning-Relative-to-View-Distance.patch b/CraftBukkit-Patches/0020-Fix-Mob-Spawning-Relative-to-View-Distance.patch index b8b40ef246..13da4c0756 100644 --- a/CraftBukkit-Patches/0020-Fix-Mob-Spawning-Relative-to-View-Distance.patch +++ b/CraftBukkit-Patches/0020-Fix-Mob-Spawning-Relative-to-View-Distance.patch @@ -1,4 +1,4 @@ -From 9e053fee3c3d3b2af10a4eb74a3d11d1a06ccb14 Mon Sep 17 00:00:00 2001 +From 0ad89ba769c9c32aa1fe9b2174a80077cbf42ef1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 17:29:54 +1000 Subject: [PATCH] Fix Mob Spawning Relative to View Distance @@ -121,7 +121,7 @@ index 056100f..bec0d91 100644 continue label110; } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 5e1cfa9..e807ec8 100644 +index eac85fc..6db43d8 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -142,4 +142,11 @@ public class SpigotWorldConfig @@ -132,7 +132,7 @@ index 5e1cfa9..e807ec8 100644 + public byte mobSpawnRange; + private void mobSpawnRange() + { -+ mobSpawnRange = getByte( "mob-spawn-range", 4 ); ++ mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 ); + log( "Mob Spawn Range: " + mobSpawnRange ); + } } diff --git a/CraftBukkit-Patches/0022-Entity-Activation-Range.patch b/CraftBukkit-Patches/0022-Entity-Activation-Range.patch index 9aad829962..0418174a60 100644 --- a/CraftBukkit-Patches/0022-Entity-Activation-Range.patch +++ b/CraftBukkit-Patches/0022-Entity-Activation-Range.patch @@ -1,4 +1,4 @@ -From 59f6244d29ad8a3a8b383267a4fe1749d7b34db4 Mon Sep 17 00:00:00 2001 +From 3e2225679ce7bb228ae9527d4cae18bc1523e92d Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 3 Feb 2013 05:10:21 -0500 Subject: [PATCH] Entity Activation Range @@ -462,11 +462,11 @@ index 0000000..93ce20e + } +} diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index e807ec8..c567250 100644 +index 6db43d8..494a94e 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -149,4 +149,15 @@ public class SpigotWorldConfig - mobSpawnRange = getByte( "mob-spawn-range", 4 ); + mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 ); log( "Mob Spawn Range: " + mobSpawnRange ); } + diff --git a/CraftBukkit-Patches/0033-Enable-Improved-ping-sending.patch b/CraftBukkit-Patches/0033-Enable-Improved-Ping-Sending.patch similarity index 54% rename from CraftBukkit-Patches/0033-Enable-Improved-ping-sending.patch rename to CraftBukkit-Patches/0033-Enable-Improved-Ping-Sending.patch index be14b47b69..3577f9ff94 100644 --- a/CraftBukkit-Patches/0033-Enable-Improved-ping-sending.patch +++ b/CraftBukkit-Patches/0033-Enable-Improved-Ping-Sending.patch @@ -1,11 +1,8 @@ -From 9b8d56fab138108ef3d328c5fe52cade92b13ce3 Mon Sep 17 00:00:00 2001 +From de9ad985c0772ebe1ab6eb22283e76100119adf0 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Feb 2013 20:45:20 +1100 -Subject: [PATCH] Enable Improved ping sending +Subject: [PATCH] Enable Improved Ping Sending - 3 files changed, 18 insertions(+) - - 3 files changed, 18 insertions(+) diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 7de5b48..35a579c 100644 @@ -20,33 +17,35 @@ index 7de5b48..35a579c 100644 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 30c6503..a236c5f 100644 +index 30c6503..1891308 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -717,7 +717,23 @@ public abstract class PlayerList { +@@ -717,6 +717,25 @@ 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); ++ if ( !players.isEmpty() ) ++ { ++ 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; + } -+ player.lastPing = player.ping; + } ++ // Spigot end } -+ // Spigot end public void sendAll(Packet packet) { - for (int i = 0; i < this.players.size(); ++i) { -- 1.8.1.2