From 3f493d0785cad08376ec2def7ce350ef23524a0d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 09:55:21 +1100
Subject: [PATCH] Add per world view distance which got lost along the way.

---
 CraftBukkit-Patches/0005-View-Distance.patch  | 84 +++++++++++++++++++
 ...86-by-firing-the-inventory-close-ev.patch} |  2 +-
 ...ray-from-mc-dev-for-diff-visibility.patch} |  2 +-
 ...ing-of-NibbleArrays-only-allocate-b.patch} |  2 +-
 ...crop-growth-modifier-formula-issues.patch} |  2 +-
 ...der-from-mc-dev-for-diff-visibility.patch} |  2 +-
 ...11-Fix-mcRegion-to-Anvil-conversion.patch} |  2 +-
 ...-check-to-correctly-resolve-api-ver.patch} |  2 +-
 ...sed-to-unload-chunks-for-the-client.patch} |  2 +-
 ....move-if-we-are-not-moving-anywhere.patch} |  2 +-
 ...free-but-safe-chunk-reference-cache.patch} |  2 +-
 ...ation-sleep-for-as-long-as-possible.patch} |  2 +-
 ...tch => 0017-Improved-Timings-System.patch} |  4 +-
 ...> 0018-Add-oreobfuscator-for-Spigot.patch} | 31 +++----
 ...er-of-LivingEntity-collision-checks.patch} |  2 +-
 ...es-in-chunks-being-processed-for-th.patch} |  2 +-
 ...d-maps-in-item-frames-upon-tracking.patch} |  2 +-
 ...e-and-warn-about-null-tile-entities.patch} |  2 +-
 ...tch => 0023-Entity-Activation-Range.patch} |  4 +-
 ...ptimize-getTileEntities-performance.patch} |  4 +-
 ...ile-entity-lookup-for-chunk-sending.patch} |  2 +-
 ...the-Metrics-system-to-be-closer-to-.patch} |  2 +-
 ...hread.patch => 0027-Watchdog-Thread.patch} |  4 +-
 .../{0027-Netty.patch => 0028-Netty.patch}    |  2 +-
 ...> 0029-Enable-Improved-ping-sending.patch} |  4 +-
 CraftBukkit-Patches/0029-View-distance.patch  | 26 ------
 26 files changed, 125 insertions(+), 72 deletions(-)
 create mode 100644 CraftBukkit-Patches/0005-View-Distance.patch
 rename CraftBukkit-Patches/{0005-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch => 0006-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch} (96%)
 rename CraftBukkit-Patches/{0006-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch => 0007-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch} (96%)
 rename CraftBukkit-Patches/{0007-Implement-lightening-of-NibbleArrays-only-allocate-b.patch => 0008-Implement-lightening-of-NibbleArrays-only-allocate-b.patch} (99%)
 rename CraftBukkit-Patches/{0008-Fix-various-crop-growth-modifier-formula-issues.patch => 0009-Fix-various-crop-growth-modifier-formula-issues.patch} (99%)
 rename CraftBukkit-Patches/{0009-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch => 0010-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch} (98%)
 rename CraftBukkit-Patches/{0010-Fix-mcRegion-to-Anvil-conversion.patch => 0011-Fix-mcRegion-to-Anvil-conversion.patch} (95%)
 rename CraftBukkit-Patches/{0011-Update-versioning-check-to-correctly-resolve-api-ver.patch => 0012-Update-versioning-check-to-correctly-resolve-api-ver.patch} (94%)
 rename CraftBukkit-Patches/{0012-Optimize-packet-used-to-unload-chunks-for-the-client.patch => 0013-Optimize-packet-used-to-unload-chunks-for-the-client.patch} (97%)
 rename CraftBukkit-Patches/{0013-Skip-entity.move-if-we-are-not-moving-anywhere.patch => 0014-Skip-entity.move-if-we-are-not-moving-anywhere.patch} (92%)
 rename CraftBukkit-Patches/{0014-Alternate-sync-free-but-safe-chunk-reference-cache.patch => 0015-Alternate-sync-free-but-safe-chunk-reference-cache.patch} (95%)
 rename CraftBukkit-Patches/{0015-Tick-loop-optimization-sleep-for-as-long-as-possible.patch => 0016-Tick-loop-optimization-sleep-for-as-long-as-possible.patch} (98%)
 rename CraftBukkit-Patches/{0016-Improved-Timings-System.patch => 0017-Improved-Timings-System.patch} (99%)
 rename CraftBukkit-Patches/{0017-Add-oreobfuscator-for-Spigot.patch => 0018-Add-oreobfuscator-for-Spigot.patch} (94%)
 rename CraftBukkit-Patches/{0018-Reduce-number-of-LivingEntity-collision-checks.patch => 0019-Reduce-number-of-LivingEntity-collision-checks.patch} (95%)
 rename CraftBukkit-Patches/{0019-Only-count-entities-in-chunks-being-processed-for-th.patch => 0020-Only-count-entities-in-chunks-being-processed-for-th.patch} (98%)
 rename CraftBukkit-Patches/{0020-Only-send-maps-in-item-frames-upon-tracking.patch => 0021-Only-send-maps-in-item-frames-upon-tracking.patch} (98%)
 rename CraftBukkit-Patches/{0021-Detect-remove-and-warn-about-null-tile-entities.patch => 0022-Detect-remove-and-warn-about-null-tile-entities.patch} (95%)
 rename CraftBukkit-Patches/{0022-Entity-Activation-Range.patch => 0023-Entity-Activation-Range.patch} (99%)
 rename CraftBukkit-Patches/{0023-Optimize-getTileEntities-performance.patch => 0024-Optimize-getTileEntities-performance.patch} (95%)
 rename CraftBukkit-Patches/{0024-Improved-tile-entity-lookup-for-chunk-sending.patch => 0025-Improved-tile-entity-lookup-for-chunk-sending.patch} (96%)
 rename CraftBukkit-Patches/{0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch => 0026-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch} (99%)
 rename CraftBukkit-Patches/{0026-Watchdog-Thread.patch => 0027-Watchdog-Thread.patch} (99%)
 rename CraftBukkit-Patches/{0027-Netty.patch => 0028-Netty.patch} (99%)
 rename CraftBukkit-Patches/{0028-Enable-Improved-ping-sending.patch => 0029-Enable-Improved-ping-sending.patch} (96%)
 delete mode 100644 CraftBukkit-Patches/0029-View-distance.patch

diff --git a/CraftBukkit-Patches/0005-View-Distance.patch b/CraftBukkit-Patches/0005-View-Distance.patch
new file mode 100644
index 0000000000..d1fe181fd3
--- /dev/null
+++ b/CraftBukkit-Patches/0005-View-Distance.patch
@@ -0,0 +1,84 @@
+From 8a13d0f677be4842ed291347c14892c2932d500d Mon Sep 17 00:00:00 2001
+From: md_5 <md_5@live.com.au>
+Date: Sat, 23 Mar 2013 09:52:41 +1100
+Subject: [PATCH] View Distance
+
+This commit allows the user to select per world view distances, and view distances below 3. Be wary of the issues selecting a view distance of 1 or 2 may cause!
+---
+ src/main/java/net/minecraft/server/PlayerChunkMap.java | 2 +-
+ src/main/java/net/minecraft/server/WorldServer.java    | 2 +-
+ src/main/java/org/bukkit/craftbukkit/CraftWorld.java   | 5 +++++
+ src/main/resources/configurations/bukkit.yml           | 1 +
+ 4 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
+index f788a62..98d6dd2 100644
+--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
++++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
+@@ -23,7 +23,7 @@ public class PlayerChunkMap {
+     public PlayerChunkMap(WorldServer worldserver, int i) {
+         if (i > 15) {
+             throw new IllegalArgumentException("Too big view radius!");
+-        } else if (i < 3) {
++        } else if (i < 1) {
+             throw new IllegalArgumentException("Too small view radius!");
+         } else {
+             this.e = i;
+diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
+index 05b2d6d..9902506 100644
+--- a/src/main/java/net/minecraft/server/WorldServer.java
++++ b/src/main/java/net/minecraft/server/WorldServer.java
+@@ -51,7 +51,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
+         // CraftBukkit end
+         this.server = minecraftserver;
+         this.tracker = new EntityTracker(this);
+-        this.manager = new PlayerChunkMap(this, minecraftserver.getPlayerList().o());
++        this.manager = new PlayerChunkMap(this, getWorld().viewDistance); // Spigot
+         if (this.entitiesById == null) {
+             this.entitiesById = new IntHashMap();
+         }
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+index 9343d46..f81ca3e 100644
+--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+@@ -118,6 +118,9 @@ public class CraftWorld implements World {
+         treeGrowthModifier = configuration.getInt("world-settings." + name + ".tree-growth-modifier", treeGrowthModifier);
+         mushroomGrowthModifier = configuration.getInt("world-settings." + name + ".mushroom-growth-modifier", mushroomGrowthModifier);
+ 
++        viewDistance = Bukkit.getServer().getViewDistance();
++        viewDistance = configuration.getInt("world-settings." + name + ".view-distance", viewDistance);
++
+         server.getLogger().info("-------------- Spigot ----------------");
+         server.getLogger().info("-------- World Settings For [" + name + "] --------");
+         server.getLogger().info("Growth Per Chunk: " + growthPerTick);
+@@ -131,6 +134,7 @@ public class CraftWorld implements World {
+         server.getLogger().info("Sugar Growth Modifier: " + sugarGrowthModifier);
+         server.getLogger().info("Tree Growth Modifier: " + treeGrowthModifier);
+         server.getLogger().info("Mushroom Growth Modifier: " + mushroomGrowthModifier);
++        server.getLogger().info("View distance: " + viewDistance);
+         server.getLogger().info("-------------------------------------------------");
+         // Spigot end
+     }
+@@ -141,6 +145,7 @@ public class CraftWorld implements World {
+     public int aggregateTicks = 4;
+     public double itemMergeRadius = 3.5;
+     public double expMergeRadius = 3.5;
++    public int viewDistance;
+     //Crop growth rates:
+     public int wheatGrowthModifier = 100;
+     public int cactusGrowthModifier = 100;
+diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
+index 87f9f1c..35fbd06 100644
+--- a/src/main/resources/configurations/bukkit.yml
++++ b/src/main/resources/configurations/bukkit.yml
+@@ -49,6 +49,7 @@ world-settings:
+     world:
+         growth-chunks-per-tick: 1000
+     world_nether:
++        view-distance: 5
+         growth-chunks-per-tick: 0
+         random-light-updates: true
+         water-creatures-per-chunk: 0
+-- 
+1.8.1-rc2
+
diff --git a/CraftBukkit-Patches/0005-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch b/CraftBukkit-Patches/0006-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch
similarity index 96%
rename from CraftBukkit-Patches/0005-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch
rename to CraftBukkit-Patches/0006-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch
index 1646d56049..d8ea0fdab5 100644
--- a/CraftBukkit-Patches/0005-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch
+++ b/CraftBukkit-Patches/0006-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch
@@ -1,4 +1,4 @@
-From cb3fe928074c99b3f092d87eac6c36df494fcce1 Mon Sep 17 00:00:00 2001
+From c10928016124ddbd042e7b5ec97dfbf196cfab15 Mon Sep 17 00:00:00 2001
 From: md_5 <md_5@bigpond.com>
 Date: Sun, 23 Dec 2012 17:09:40 +1100
 Subject: [PATCH] Address BUKKIT-3286 by firing the inventory close event when
diff --git a/CraftBukkit-Patches/0006-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch b/CraftBukkit-Patches/0007-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch
similarity index 96%
rename from CraftBukkit-Patches/0006-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch
rename to CraftBukkit-Patches/0007-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch
index 731d916708..c06f25220b 100644
--- a/CraftBukkit-Patches/0006-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch
+++ b/CraftBukkit-Patches/0007-Include-NibbleArray-from-mc-dev-for-diff-visibility.patch
@@ -1,4 +1,4 @@
-From c0b74eb8b5124a081c1655af4948d8605eaeb028 Mon Sep 17 00:00:00 2001
+From b1188994f419db30faf032efdd1b3945d4046441 Mon Sep 17 00:00:00 2001
 From: Mike Primm <mike@primmhome.com>
 Date: Fri, 14 Dec 2012 21:51:06 -0600
 Subject: [PATCH] Include NibbleArray from mc-dev for diff visibility
diff --git a/CraftBukkit-Patches/0007-Implement-lightening-of-NibbleArrays-only-allocate-b.patch b/CraftBukkit-Patches/0008-Implement-lightening-of-NibbleArrays-only-allocate-b.patch
similarity index 99%
rename from CraftBukkit-Patches/0007-Implement-lightening-of-NibbleArrays-only-allocate-b.patch
rename to CraftBukkit-Patches/0008-Implement-lightening-of-NibbleArrays-only-allocate-b.patch
index 1bd3991c22..df6ecf3aa9 100644
--- a/CraftBukkit-Patches/0007-Implement-lightening-of-NibbleArrays-only-allocate-b.patch
+++ b/CraftBukkit-Patches/0008-Implement-lightening-of-NibbleArrays-only-allocate-b.patch
@@ -1,4 +1,4 @@
-From a062d1cbb45a6db914e4de8d44a5730833c895d1 Mon Sep 17 00:00:00 2001
+From 6cc2da43b3876e687bd7237ed42a09332d2d7c84 Mon Sep 17 00:00:00 2001
 From: Mike Primm <mike@primmhome.com>
 Date: Sun, 23 Dec 2012 14:46:23 -0600
 Subject: [PATCH] Implement 'lightening' of NibbleArrays - only allocate
diff --git a/CraftBukkit-Patches/0008-Fix-various-crop-growth-modifier-formula-issues.patch b/CraftBukkit-Patches/0009-Fix-various-crop-growth-modifier-formula-issues.patch
similarity index 99%
rename from CraftBukkit-Patches/0008-Fix-various-crop-growth-modifier-formula-issues.patch
rename to CraftBukkit-Patches/0009-Fix-various-crop-growth-modifier-formula-issues.patch
index 480b5ada22..f8226d2137 100644
--- a/CraftBukkit-Patches/0008-Fix-various-crop-growth-modifier-formula-issues.patch
+++ b/CraftBukkit-Patches/0009-Fix-various-crop-growth-modifier-formula-issues.patch
@@ -1,4 +1,4 @@
-From 77ad92ad7538ee1646e4718f4458fa737b053795 Mon Sep 17 00:00:00 2001
+From f07d661fbec7e2a091c52ad124cfefea3e8c11c6 Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Fri, 11 Jan 2013 11:08:45 -0500
 Subject: [PATCH] Fix various crop growth modifier formula issues
diff --git a/CraftBukkit-Patches/0009-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch b/CraftBukkit-Patches/0010-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch
similarity index 98%
rename from CraftBukkit-Patches/0009-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch
rename to CraftBukkit-Patches/0010-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch
index 7a4feef09c..7a1ddc6b0a 100644
--- a/CraftBukkit-Patches/0009-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch
+++ b/CraftBukkit-Patches/0010-Add-OldChunkLoader-from-mc-dev-for-diff-visibility.patch
@@ -1,4 +1,4 @@
-From 91c1376c40f1b65590c3904c0f3568bcd9393805 Mon Sep 17 00:00:00 2001
+From ef9fda7e53835b13b36dc8e9ab235e4676069140 Mon Sep 17 00:00:00 2001
 From: Agaricus <agaricusb@yahoo.com>
 Date: Sun, 13 Jan 2013 03:41:38 -0800
 Subject: [PATCH] Add OldChunkLoader from mc-dev for diff visibility
diff --git a/CraftBukkit-Patches/0010-Fix-mcRegion-to-Anvil-conversion.patch b/CraftBukkit-Patches/0011-Fix-mcRegion-to-Anvil-conversion.patch
similarity index 95%
rename from CraftBukkit-Patches/0010-Fix-mcRegion-to-Anvil-conversion.patch
rename to CraftBukkit-Patches/0011-Fix-mcRegion-to-Anvil-conversion.patch
index 773173241e..c8399449ae 100644
--- a/CraftBukkit-Patches/0010-Fix-mcRegion-to-Anvil-conversion.patch
+++ b/CraftBukkit-Patches/0011-Fix-mcRegion-to-Anvil-conversion.patch
@@ -1,4 +1,4 @@
-From fcd0a70b968940344581a96d14343b507f36f492 Mon Sep 17 00:00:00 2001
+From 3f6fe28ec20e0597dbdcf1c49e3d1b77e18494f9 Mon Sep 17 00:00:00 2001
 From: Agaricus <agaricusb@yahoo.com>
 Date: Sun, 13 Jan 2013 03:49:07 -0800
 Subject: [PATCH] Fix mcRegion-to-Anvil conversion
diff --git a/CraftBukkit-Patches/0011-Update-versioning-check-to-correctly-resolve-api-ver.patch b/CraftBukkit-Patches/0012-Update-versioning-check-to-correctly-resolve-api-ver.patch
similarity index 94%
rename from CraftBukkit-Patches/0011-Update-versioning-check-to-correctly-resolve-api-ver.patch
rename to CraftBukkit-Patches/0012-Update-versioning-check-to-correctly-resolve-api-ver.patch
index ed783ad957..a105df8dd9 100644
--- a/CraftBukkit-Patches/0011-Update-versioning-check-to-correctly-resolve-api-ver.patch
+++ b/CraftBukkit-Patches/0012-Update-versioning-check-to-correctly-resolve-api-ver.patch
@@ -1,4 +1,4 @@
-From 0f82033d1a429b38e007692571d568d700e0f2d0 Mon Sep 17 00:00:00 2001
+From b898ae83fbb7311b28c72e0a438f978fee141eaf Mon Sep 17 00:00:00 2001
 From: md_5 <md_5@bigpond.com>
 Date: Tue, 15 Jan 2013 15:05:02 +1100
 Subject: [PATCH] Update versioning check to correctly resolve api version.
diff --git a/CraftBukkit-Patches/0012-Optimize-packet-used-to-unload-chunks-for-the-client.patch b/CraftBukkit-Patches/0013-Optimize-packet-used-to-unload-chunks-for-the-client.patch
similarity index 97%
rename from CraftBukkit-Patches/0012-Optimize-packet-used-to-unload-chunks-for-the-client.patch
rename to CraftBukkit-Patches/0013-Optimize-packet-used-to-unload-chunks-for-the-client.patch
index 85d7d35b5e..dc7ccae250 100644
--- a/CraftBukkit-Patches/0012-Optimize-packet-used-to-unload-chunks-for-the-client.patch
+++ b/CraftBukkit-Patches/0013-Optimize-packet-used-to-unload-chunks-for-the-client.patch
@@ -1,4 +1,4 @@
-From 312d229f498566d9727dd5bc1aa130ee2767a427 Mon Sep 17 00:00:00 2001
+From b4a15f067f8c583f3110091e0a092830644495f0 Mon Sep 17 00:00:00 2001
 From: Ammar Askar <ammar@ammaraskar.com>
 Date: Fri, 18 Jan 2013 16:20:01 +0500
 Subject: [PATCH] Optimize packet used to unload chunks for the client
diff --git a/CraftBukkit-Patches/0013-Skip-entity.move-if-we-are-not-moving-anywhere.patch b/CraftBukkit-Patches/0014-Skip-entity.move-if-we-are-not-moving-anywhere.patch
similarity index 92%
rename from CraftBukkit-Patches/0013-Skip-entity.move-if-we-are-not-moving-anywhere.patch
rename to CraftBukkit-Patches/0014-Skip-entity.move-if-we-are-not-moving-anywhere.patch
index 6cb484b660..30458703a4 100644
--- a/CraftBukkit-Patches/0013-Skip-entity.move-if-we-are-not-moving-anywhere.patch
+++ b/CraftBukkit-Patches/0014-Skip-entity.move-if-we-are-not-moving-anywhere.patch
@@ -1,4 +1,4 @@
-From d6399ccd17ce4c3af3f1c9193080f12fddd7b2ba Mon Sep 17 00:00:00 2001
+From 7291eb00715590e098ef1478c11e8c39c8b39a04 Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Sat, 19 Jan 2013 01:11:30 -0500
 Subject: [PATCH] Skip entity.move() if we are not moving anywhere.
diff --git a/CraftBukkit-Patches/0014-Alternate-sync-free-but-safe-chunk-reference-cache.patch b/CraftBukkit-Patches/0015-Alternate-sync-free-but-safe-chunk-reference-cache.patch
similarity index 95%
rename from CraftBukkit-Patches/0014-Alternate-sync-free-but-safe-chunk-reference-cache.patch
rename to CraftBukkit-Patches/0015-Alternate-sync-free-but-safe-chunk-reference-cache.patch
index 1dc397d5eb..b4a9f129ea 100644
--- a/CraftBukkit-Patches/0014-Alternate-sync-free-but-safe-chunk-reference-cache.patch
+++ b/CraftBukkit-Patches/0015-Alternate-sync-free-but-safe-chunk-reference-cache.patch
@@ -1,4 +1,4 @@
-From aa6762884aa5711a67c9aef0d4075cdc2038e0a2 Mon Sep 17 00:00:00 2001
+From 20d8e8c4d3e5e3a0faf49375a89a9ee44ae58ce9 Mon Sep 17 00:00:00 2001
 From: Mike Primm <mike@primmhome.com>
 Date: Wed, 16 Jan 2013 15:27:22 -0600
 Subject: [PATCH] Alternate, sync-free-but-safe chunk reference cache
diff --git a/CraftBukkit-Patches/0015-Tick-loop-optimization-sleep-for-as-long-as-possible.patch b/CraftBukkit-Patches/0016-Tick-loop-optimization-sleep-for-as-long-as-possible.patch
similarity index 98%
rename from CraftBukkit-Patches/0015-Tick-loop-optimization-sleep-for-as-long-as-possible.patch
rename to CraftBukkit-Patches/0016-Tick-loop-optimization-sleep-for-as-long-as-possible.patch
index 49db322e0f..a6accf0079 100644
--- a/CraftBukkit-Patches/0015-Tick-loop-optimization-sleep-for-as-long-as-possible.patch
+++ b/CraftBukkit-Patches/0016-Tick-loop-optimization-sleep-for-as-long-as-possible.patch
@@ -1,4 +1,4 @@
-From fc42dccd299521795dd9b98199195524a6a78d4c Mon Sep 17 00:00:00 2001
+From c078fb70e71ec8514612e7d0a6d23af33e0d351c Mon Sep 17 00:00:00 2001
 From: md_5 <md_5@live.com.au>
 Date: Sun, 3 Feb 2013 12:28:17 +1100
 Subject: [PATCH] Tick loop optimization - sleep for as long as possible.
diff --git a/CraftBukkit-Patches/0016-Improved-Timings-System.patch b/CraftBukkit-Patches/0017-Improved-Timings-System.patch
similarity index 99%
rename from CraftBukkit-Patches/0016-Improved-Timings-System.patch
rename to CraftBukkit-Patches/0017-Improved-Timings-System.patch
index c45964c42f..a812ea8d5d 100644
--- a/CraftBukkit-Patches/0016-Improved-Timings-System.patch
+++ b/CraftBukkit-Patches/0017-Improved-Timings-System.patch
@@ -1,4 +1,4 @@
-From 2d4715065524fceccd18aa9f34aebf20ed3a6325 Mon Sep 17 00:00:00 2001
+From af64eacbd621fb551bfb2378d7e5e8db74a21b6a Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Thu, 10 Jan 2013 00:18:11 -0500
 Subject: [PATCH] Improved Timings System
@@ -381,7 +381,7 @@ index 7862b43..dd61607 100644
      }
  
 diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
-index 05b2d6d..e7ecbd6 100644
+index 9902506..836da20 100644
 --- a/src/main/java/net/minecraft/server/WorldServer.java
 +++ b/src/main/java/net/minecraft/server/WorldServer.java
 @@ -169,9 +169,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
diff --git a/CraftBukkit-Patches/0017-Add-oreobfuscator-for-Spigot.patch b/CraftBukkit-Patches/0018-Add-oreobfuscator-for-Spigot.patch
similarity index 94%
rename from CraftBukkit-Patches/0017-Add-oreobfuscator-for-Spigot.patch
rename to CraftBukkit-Patches/0018-Add-oreobfuscator-for-Spigot.patch
index 85acede32e..6a2fc28467 100644
--- a/CraftBukkit-Patches/0017-Add-oreobfuscator-for-Spigot.patch
+++ b/CraftBukkit-Patches/0018-Add-oreobfuscator-for-Spigot.patch
@@ -1,4 +1,4 @@
-From 2fb3d58ee2c8d00b90304314750d8988cdfb6a91 Mon Sep 17 00:00:00 2001
+From bbd48168b30e50034297a255b3b251fa60631ebb Mon Sep 17 00:00:00 2001
 From: lishid <lishid@gmail.com>
 Date: Sat, 16 Feb 2013 10:05:25 +1100
 Subject: [PATCH] Add oreobfuscator for Spigot.
@@ -10,11 +10,11 @@ Subject: [PATCH] Add oreobfuscator for Spigot.
  .../net/minecraft/server/Packet56MapChunkBulk.java |  21 ++-
  .../minecraft/server/PlayerInteractManager.java    |   5 +
  .../java/org/bukkit/craftbukkit/CraftServer.java   |   6 +
- .../java/org/bukkit/craftbukkit/CraftWorld.java    |   9 ++
+ .../java/org/bukkit/craftbukkit/CraftWorld.java    |   4 +
  .../bukkit/craftbukkit/OrebfuscatorManager.java    | 146 +++++++++++++++++++++
  src/main/java/org/bukkit/craftbukkit/Spigot.java   |   8 ++
  src/main/resources/configurations/bukkit.yml       |   6 +
- 10 files changed, 203 insertions(+), 1 deletion(-)
+ 10 files changed, 198 insertions(+), 1 deletion(-)
  create mode 100644 src/main/java/org/bukkit/craftbukkit/OrebfuscatorManager.java
 
 diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -140,35 +140,30 @@ index 872c4ac..83704f0 100644
          private boolean value = true;
      }
 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 9343d46..fbab028 100644
+index f81ca3e..fbab028 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -118,6 +118,11 @@ public class CraftWorld implements World {
-         treeGrowthModifier = configuration.getInt("world-settings." + name + ".tree-growth-modifier", treeGrowthModifier);
-         mushroomGrowthModifier = configuration.getInt("world-settings." + name + ".mushroom-growth-modifier", mushroomGrowthModifier);
+@@ -121,6 +121,8 @@ public class CraftWorld implements World {
+         viewDistance = Bukkit.getServer().getViewDistance();
+         viewDistance = configuration.getInt("world-settings." + name + ".view-distance", viewDistance);
  
-+        viewDistance = Bukkit.getServer().getViewDistance();
-+        viewDistance = configuration.getInt("world-settings." + name + ".view-distance", viewDistance);
-+
 +        obfuscated = !world.getServer().orebfuscatorDisabledWorlds.contains(name);
 +
          server.getLogger().info("-------------- Spigot ----------------");
          server.getLogger().info("-------- World Settings For [" + name + "] --------");
          server.getLogger().info("Growth Per Chunk: " + growthPerTick);
-@@ -131,6 +136,8 @@ public class CraftWorld implements World {
-         server.getLogger().info("Sugar Growth Modifier: " + sugarGrowthModifier);
+@@ -135,6 +137,7 @@ public class CraftWorld implements World {
          server.getLogger().info("Tree Growth Modifier: " + treeGrowthModifier);
          server.getLogger().info("Mushroom Growth Modifier: " + mushroomGrowthModifier);
-+        server.getLogger().info("View distance: " + viewDistance);
+         server.getLogger().info("View distance: " + viewDistance);
 +        server.getLogger().info("Oreobfuscator: " + obfuscated);
          server.getLogger().info("-------------------------------------------------");
          // Spigot end
      }
-@@ -141,6 +148,8 @@ public class CraftWorld implements World {
-     public int aggregateTicks = 4;
+@@ -146,6 +149,7 @@ public class CraftWorld implements World {
      public double itemMergeRadius = 3.5;
      public double expMergeRadius = 3.5;
-+    public int viewDistance;
+     public int viewDistance;
 +    public boolean obfuscated = false;
      //Crop growth rates:
      public int wheatGrowthModifier = 100;
@@ -345,10 +340,10 @@ index db46037..ad65bca 100644
              server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!");
          }
 diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
-index 87f9f1c..d0e7244 100644
+index 35fbd06..6c21ca2 100644
 --- a/src/main/resources/configurations/bukkit.yml
 +++ b/src/main/resources/configurations/bukkit.yml
-@@ -80,3 +80,9 @@ database:
+@@ -81,3 +81,9 @@ database:
      driver: org.sqlite.JDBC
      password: walrus
      url: jdbc:sqlite:{DIR}{NAME}.db
diff --git a/CraftBukkit-Patches/0018-Reduce-number-of-LivingEntity-collision-checks.patch b/CraftBukkit-Patches/0019-Reduce-number-of-LivingEntity-collision-checks.patch
similarity index 95%
rename from CraftBukkit-Patches/0018-Reduce-number-of-LivingEntity-collision-checks.patch
rename to CraftBukkit-Patches/0019-Reduce-number-of-LivingEntity-collision-checks.patch
index 52b8a042a5..5d68645afb 100644
--- a/CraftBukkit-Patches/0018-Reduce-number-of-LivingEntity-collision-checks.patch
+++ b/CraftBukkit-Patches/0019-Reduce-number-of-LivingEntity-collision-checks.patch
@@ -1,4 +1,4 @@
-From 44b79ea940e90d3f92db99bed464beb71ad4b8a0 Mon Sep 17 00:00:00 2001
+From 2de89494d456b2d4f2b129f6a2174271fa26ed2a Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Fri, 18 Jan 2013 19:31:14 -0500
 Subject: [PATCH] Reduce number of LivingEntity collision checks.
diff --git a/CraftBukkit-Patches/0019-Only-count-entities-in-chunks-being-processed-for-th.patch b/CraftBukkit-Patches/0020-Only-count-entities-in-chunks-being-processed-for-th.patch
similarity index 98%
rename from CraftBukkit-Patches/0019-Only-count-entities-in-chunks-being-processed-for-th.patch
rename to CraftBukkit-Patches/0020-Only-count-entities-in-chunks-being-processed-for-th.patch
index 1217bf1b04..a2df2e2a8e 100644
--- a/CraftBukkit-Patches/0019-Only-count-entities-in-chunks-being-processed-for-th.patch
+++ b/CraftBukkit-Patches/0020-Only-count-entities-in-chunks-being-processed-for-th.patch
@@ -1,4 +1,4 @@
-From 1547a6035058c9d72d3556c765f0d7a40b564048 Mon Sep 17 00:00:00 2001
+From 6ee3a17c40f55022ed3d84c55a9814a3b558e61f Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Tue, 29 Jan 2013 13:25:53 -0500
 Subject: [PATCH] Only count entities in chunks being processed for the spawn
diff --git a/CraftBukkit-Patches/0020-Only-send-maps-in-item-frames-upon-tracking.patch b/CraftBukkit-Patches/0021-Only-send-maps-in-item-frames-upon-tracking.patch
similarity index 98%
rename from CraftBukkit-Patches/0020-Only-send-maps-in-item-frames-upon-tracking.patch
rename to CraftBukkit-Patches/0021-Only-send-maps-in-item-frames-upon-tracking.patch
index d855839a66..199a79b990 100644
--- a/CraftBukkit-Patches/0020-Only-send-maps-in-item-frames-upon-tracking.patch
+++ b/CraftBukkit-Patches/0021-Only-send-maps-in-item-frames-upon-tracking.patch
@@ -1,4 +1,4 @@
-From ee62a92389e8101ada783301db035a87d1391e91 Mon Sep 17 00:00:00 2001
+From 17b87c50187fe2dd65832d1b8bd5e1b627425d2c Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Tue, 19 Feb 2013 17:26:20 -0500
 Subject: [PATCH] Only send maps in item frames upon tracking
diff --git a/CraftBukkit-Patches/0021-Detect-remove-and-warn-about-null-tile-entities.patch b/CraftBukkit-Patches/0022-Detect-remove-and-warn-about-null-tile-entities.patch
similarity index 95%
rename from CraftBukkit-Patches/0021-Detect-remove-and-warn-about-null-tile-entities.patch
rename to CraftBukkit-Patches/0022-Detect-remove-and-warn-about-null-tile-entities.patch
index 8ade3c064a..d41d929072 100644
--- a/CraftBukkit-Patches/0021-Detect-remove-and-warn-about-null-tile-entities.patch
+++ b/CraftBukkit-Patches/0022-Detect-remove-and-warn-about-null-tile-entities.patch
@@ -1,4 +1,4 @@
-From ae90d896a4e067fa4bb6202f57cbd6a3587dde7e Mon Sep 17 00:00:00 2001
+From c98c1cc94472e4865f169c44b5f506f5e9278277 Mon Sep 17 00:00:00 2001
 From: md_5 <md_5@live.com.au>
 Date: Sun, 3 Feb 2013 09:20:19 +1100
 Subject: [PATCH] Detect, remove and warn about null tile entities.
diff --git a/CraftBukkit-Patches/0022-Entity-Activation-Range.patch b/CraftBukkit-Patches/0023-Entity-Activation-Range.patch
similarity index 99%
rename from CraftBukkit-Patches/0022-Entity-Activation-Range.patch
rename to CraftBukkit-Patches/0023-Entity-Activation-Range.patch
index 7208766756..a6607573e3 100644
--- a/CraftBukkit-Patches/0022-Entity-Activation-Range.patch
+++ b/CraftBukkit-Patches/0023-Entity-Activation-Range.patch
@@ -1,4 +1,4 @@
-From 5e88bcd41dfbe2141293bca5d569b62f8b54d0c9 Mon Sep 17 00:00:00 2001
+From 03753a3621b236da0c9e47c046c313d9affbaffd Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Sun, 3 Feb 2013 05:10:21 -0500
 Subject: [PATCH] Entity Activation Range
@@ -426,7 +426,7 @@ index bbb6368..d8f73ad 100644
      public static final HashMap<String, CustomTimingsHandler> tileEntityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
      public static final HashMap<String, CustomTimingsHandler> pluginTaskTimingMap = new HashMap<String, CustomTimingsHandler>();
 diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
-index d0e7244..a363d81 100644
+index 6c21ca2..24808be 100644
 --- a/src/main/resources/configurations/bukkit.yml
 +++ b/src/main/resources/configurations/bukkit.yml
 @@ -46,6 +46,9 @@ world-settings:
diff --git a/CraftBukkit-Patches/0023-Optimize-getTileEntities-performance.patch b/CraftBukkit-Patches/0024-Optimize-getTileEntities-performance.patch
similarity index 95%
rename from CraftBukkit-Patches/0023-Optimize-getTileEntities-performance.patch
rename to CraftBukkit-Patches/0024-Optimize-getTileEntities-performance.patch
index 67c5aac667..cd74c1f3ce 100644
--- a/CraftBukkit-Patches/0023-Optimize-getTileEntities-performance.patch
+++ b/CraftBukkit-Patches/0024-Optimize-getTileEntities-performance.patch
@@ -1,4 +1,4 @@
-From 07c483562114abd55d400a79894fcf1f3fdff6f3 Mon Sep 17 00:00:00 2001
+From 60c41aa2d4d73fc1786e53b5e45ad3aff9156342 Mon Sep 17 00:00:00 2001
 From: Mike Primm <mike@primmhome.com>
 Date: Wed, 20 Feb 2013 23:07:53 -0500
 Subject: [PATCH] Optimize getTileEntities performance
@@ -9,7 +9,7 @@ Avoid traversing tile entities for every loaded chunk
  1 file changed, 12 insertions(+), 9 deletions(-)
 
 diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
-index e7ecbd6..eb97f41 100644
+index 836da20..177fa94 100644
 --- a/src/main/java/net/minecraft/server/WorldServer.java
 +++ b/src/main/java/net/minecraft/server/WorldServer.java
 @@ -658,17 +658,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
diff --git a/CraftBukkit-Patches/0024-Improved-tile-entity-lookup-for-chunk-sending.patch b/CraftBukkit-Patches/0025-Improved-tile-entity-lookup-for-chunk-sending.patch
similarity index 96%
rename from CraftBukkit-Patches/0024-Improved-tile-entity-lookup-for-chunk-sending.patch
rename to CraftBukkit-Patches/0025-Improved-tile-entity-lookup-for-chunk-sending.patch
index 50cb3c4567..e3ca70a21e 100644
--- a/CraftBukkit-Patches/0024-Improved-tile-entity-lookup-for-chunk-sending.patch
+++ b/CraftBukkit-Patches/0025-Improved-tile-entity-lookup-for-chunk-sending.patch
@@ -1,4 +1,4 @@
-From 47c6ea5eb16afa6a145012e17bf68cb1ce985eae Mon Sep 17 00:00:00 2001
+From 0e6962f92f84e0e32e30c99611ee40b4f7d4c262 Mon Sep 17 00:00:00 2001
 From: shakytom <tom.roberts00@gmail.com>
 Date: Wed, 20 Feb 2013 22:34:38 -0500
 Subject: [PATCH] Improved tile entity lookup for chunk sending
diff --git a/CraftBukkit-Patches/0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch b/CraftBukkit-Patches/0026-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch
similarity index 99%
rename from CraftBukkit-Patches/0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch
rename to CraftBukkit-Patches/0026-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch
index 445800f4b4..3caf18c83e 100644
--- a/CraftBukkit-Patches/0025-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch
+++ b/CraftBukkit-Patches/0026-Metrics.-Rewrite-the-Metrics-system-to-be-closer-to-.patch
@@ -1,4 +1,4 @@
-From f974ecd9e312c25a0fdfe9c83b72953ece76a053 Mon Sep 17 00:00:00 2001
+From f3098aec724dd2d41c3c2c5c1c44a74e7ab0124f Mon Sep 17 00:00:00 2001
 From: md_5 <md_5@live.com.au>
 Date: Sat, 23 Feb 2013 08:58:35 +1100
 Subject: [PATCH] Metrics. Rewrite the Metrics system to be closer to the
diff --git a/CraftBukkit-Patches/0026-Watchdog-Thread.patch b/CraftBukkit-Patches/0027-Watchdog-Thread.patch
similarity index 99%
rename from CraftBukkit-Patches/0026-Watchdog-Thread.patch
rename to CraftBukkit-Patches/0027-Watchdog-Thread.patch
index e400daca2a..23aada62ba 100644
--- a/CraftBukkit-Patches/0026-Watchdog-Thread.patch
+++ b/CraftBukkit-Patches/0027-Watchdog-Thread.patch
@@ -1,4 +1,4 @@
-From 8d41661909479d868da7346d59f169ef0c16aff1 Mon Sep 17 00:00:00 2001
+From 55779a29f1a3efefc374cfbb257be13511e64985 Mon Sep 17 00:00:00 2001
 From: md_5 <md_5@live.com.au>
 Date: Sat, 23 Feb 2013 12:33:20 +1100
 Subject: [PATCH] Watchdog Thread.
@@ -283,7 +283,7 @@ index 0000000..10390b8
 +    }
 +}
 diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
-index a363d81..63ab1ad 100644
+index 24808be..c7014fa 100644
 --- a/src/main/resources/configurations/bukkit.yml
 +++ b/src/main/resources/configurations/bukkit.yml
 @@ -31,6 +31,9 @@ settings:
diff --git a/CraftBukkit-Patches/0027-Netty.patch b/CraftBukkit-Patches/0028-Netty.patch
similarity index 99%
rename from CraftBukkit-Patches/0027-Netty.patch
rename to CraftBukkit-Patches/0028-Netty.patch
index 72cd2f42f6..30ca7b3ad4 100644
--- a/CraftBukkit-Patches/0027-Netty.patch
+++ b/CraftBukkit-Patches/0028-Netty.patch
@@ -1,4 +1,4 @@
-From 2435b1a2c296dc58747d689d199553988900a344 Mon Sep 17 00:00:00 2001
+From 2fda9f46b36ce7627c1f37785fc8bf4892f8a161 Mon Sep 17 00:00:00 2001
 From: md_5 <md_5@live.com.au>
 Date: Thu, 14 Feb 2013 17:32:20 +1100
 Subject: [PATCH] Netty
diff --git a/CraftBukkit-Patches/0028-Enable-Improved-ping-sending.patch b/CraftBukkit-Patches/0029-Enable-Improved-ping-sending.patch
similarity index 96%
rename from CraftBukkit-Patches/0028-Enable-Improved-ping-sending.patch
rename to CraftBukkit-Patches/0029-Enable-Improved-ping-sending.patch
index fdcc8e417b..8333ac4da6 100644
--- a/CraftBukkit-Patches/0028-Enable-Improved-ping-sending.patch
+++ b/CraftBukkit-Patches/0029-Enable-Improved-ping-sending.patch
@@ -1,4 +1,4 @@
-From 136302a31cd399e9c8c7a50f62dfaf412f80331a Mon Sep 17 00:00:00 2001
+From 370cd20cfd780ab697c775f518975e08cc42e5a4 Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Sun, 24 Feb 2013 20:45:20 +1100
 Subject: [PATCH] Enable Improved ping sending
@@ -50,7 +50,7 @@ index 79c52f6..c6513c8 100644
      public void sendAll(Packet packet) {
          for (int i = 0; i < this.players.size(); ++i) {
 diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
-index 63ab1ad..8ce7e58 100644
+index c7014fa..472b36b 100644
 --- a/src/main/resources/configurations/bukkit.yml
 +++ b/src/main/resources/configurations/bukkit.yml
 @@ -31,6 +31,7 @@ settings:
diff --git a/CraftBukkit-Patches/0029-View-distance.patch b/CraftBukkit-Patches/0029-View-distance.patch
deleted file mode 100644
index dd37549bfa..0000000000
--- a/CraftBukkit-Patches/0029-View-distance.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 663703f0dde6c7b1f784c3d44c75bc8de42b16db Mon Sep 17 00:00:00 2001
-From: md_5 <md_5@live.com.au>
-Date: Tue, 26 Feb 2013 11:31:27 +1100
-Subject: [PATCH] View distance.
-
-Allow small view distances. TODO: Merge per world view distances to this.
----
- src/main/java/net/minecraft/server/PlayerChunkMap.java | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
-index f788a62..98d6dd2 100644
---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
-+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
-@@ -23,7 +23,7 @@ public class PlayerChunkMap {
-     public PlayerChunkMap(WorldServer worldserver, int i) {
-         if (i > 15) {
-             throw new IllegalArgumentException("Too big view radius!");
--        } else if (i < 3) {
-+        } else if (i < 1) {
-             throw new IllegalArgumentException("Too small view radius!");
-         } else {
-             this.e = i;
--- 
-1.8.1-rc2
-