From 80da3f0c9b327c8efe3a740a1558995bacb7343c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 1 Dec 2013 14:40:53 +1100 Subject: [PATCH] Stage 1 --- CraftBukkit-Patches/0001-POM-Changes.patch | 12 +- .../0003-Skeleton-API-Implementations.patch | 18 +- .../0004-Spigot-Configuration.patch | 32 +- .../0005-Better-Chunk-Tick-Selection.patch | 43 +- .../0006-Crop-Growth-Rates.patch | 74 +- ...0007-More-Efficient-Chunk-Save-Queue.patch | 74 +- .../0008-More-Efficient-GetCubes.patch | 21 +- ...0009-Merge-tweaks-and-configuration.patch} | 16 +- .../0009-Proxy-IP-Filter.patch | 86 - ...weaks.patch => 0010-LongHash-Tweaks.patch} | 4 +- ...ch => 0011-Async-Operation-Catching.patch} | 48 +- ...istance.patch => 0012-View-Distance.patch} | 8 +- ...ch => 0013-Compressed-Nibble-Arrays.patch} | 20 +- ...014-Sync-Free-Chunk-Reference-Cache.patch} | 19 +- ... => 0015-Highly-Optimized-Tick-Loop.patch} | 50 +- ...tch => 0016-Improved-Timings-System.patch} | 143 +- ...fuscator.patch => 0017-Orebfuscator.patch} | 58 +- ...-Spawning-Relative-to-View-Distance.patch} | 26 +- ...h => 0019-Handle-Null-Tile-Entities.patch} | 6 +- ...tch => 0020-Entity-Activation-Range.patch} | 43 +- ...{0022-Metrics.patch => 0021-Metrics.patch} | 6 +- ...patch => 0022-PlayerItemDamageEvent.patch} | 18 +- ...ch => 0023-Faster-UUID-for-entities.patch} | 11 +- CraftBukkit-Patches/0023-Netty.patch | 1492 ----------------- ...ch => 0024-Prevent-NPE-in-CraftSign.patch} | 4 +- ...atch => 0025-Entity-Tracking-Ranges.patch} | 12 +- ... => 0026-Limit-Custom-Map-Rendering.patch} | 10 +- ...> 0027-Enable-Improved-Ping-Sending.patch} | 16 +- .../0028-BungeeCord-Support.patch | 106 -- .../0028-Thread-Naming-and-Tweaks.patch | 23 + ...h => 0029-Close-Unloaded-Save-Files.patch} | 8 +- ...30-Improve-NextTickList-Performance.patch} | 115 +- .../0031-Filter-Invalid-Names.patch | 29 - ...ption.patch => 0031-Remove-o-Option.patch} | 8 +- ...patch => 0032-Recipe-Deconstruction.patch} | 16 +- .../0032-Thread-Naming-and-Tweaks.patch | 60 - ...I.patch => 0033-Implement-Arrow-API.patch} | 4 +- ...owns.patch => 0034-Hopper-Cooldowns.patch} | 8 +- ...patch => 0035-Prevent-Shutdown-Hang.patch} | 14 +- ...=> 0036-Implement-SpawnerSpawnEvent.patch} | 16 +- ...tch => 0037-Firework-Meta-Crash-Fix.patch} | 6 +- ...8-Do-Not-Search-for-Offline-Players.patch} | 6 +- CraftBukkit-Patches/0038-Particle-API.patch | 240 --- ...-Allow-Disabling-of-Command-Logging.patch} | 18 +- ...ow-Disabling-of-Command-TabComplete.patch} | 10 +- ...patch => 0041-Configurable-Messages.patch} | 54 +- ...isabling-of-Random-Lighting-Updates.patch} | 6 +- ...ing.patch => 0043-Add-Log-Filtering.patch} | 10 +- .../0044-Enable-Foreign-Language-Signs.patch | 22 - ...ry.getItem-use-both-containers.-Fix.patch} | 4 +- ... => 0045-Properly-Close-Inventories.patch} | 12 +- .../0045-Spam-Filter-Exclusions.patch | 50 - ...0046-Disallow-Interaction-With-Self.patch} | 12 +- ...tch => 0047-Lower-Chunk-Compression.patch} | 14 +- ...48-Entity-Mount-and-Dismount-Events.patch} | 14 +- ...erly-Consume-Bonemeal-in-Dispensers.patch} | 6 +- ...ent-Ghost-Players-Caused-by-Plugins.patch} | 8 +- ...> 0051-Entity-ticking-chunk-caching.patch} | 12 +- .../0052-Always-Fire-PreLoginEvent.patch | 71 - ... 0052-Plug-World-Unload-Memory-Leak.patch} | 6 +- ....patch => 0053-Player-Collision-API.patch} | 32 +- ...y-Disable-Snooper-When-Not-Required.patch} | 18 +- ...d-Getter-for-Entity-Invulnerability.patch} | 8 +- ...ist.patch => 0056-Guard-entity-list.patch} | 16 +- ...ch => 0057-Cap-Minimum-Player-Speed.patch} | 10 +- .../0057-Colour-Console-Messages.patch | 22 - ...and-Health-for-PlayerConsumeItemEve.patch} | 10 +- ...BlockEvent-for-Fire-Arrows-hitting-.patch} | 4 +- ...Disabling-of-1.6.3-Structure-Saving.patch} | 4 +- ...ate.patch => 0061-Item-Despawn-Rate.patch} | 22 +- ...062-Don-t-Special-Case-X-Move-Value.patch} | 16 +- ...patch => 0063-Implement-respawn-API.patch} | 8 +- ...-BrewingStands-Removing-NBT-Potions.patch} | 4 +- ...te.patch => 0065-Arrow-Despawn-Rate.patch} | 10 +- ...hread.patch => 0066-Watchdog-Thread.patch} | 16 +- .../0068-Nerf-Zombie-Lag-Issues.patch | 106 -- ...ion-effects-on-respawn-missed-rename.patch | 22 - 77 files changed, 706 insertions(+), 2980 deletions(-) rename CraftBukkit-Patches/{0010-Merge-tweaks-and-configuration.patch => 0009-Merge-tweaks-and-configuration.patch} (92%) delete mode 100644 CraftBukkit-Patches/0009-Proxy-IP-Filter.patch rename CraftBukkit-Patches/{0011-LongHash-Tweaks.patch => 0010-LongHash-Tweaks.patch} (98%) rename CraftBukkit-Patches/{0012-Async-Operation-Catching.patch => 0011-Async-Operation-Catching.patch} (85%) rename CraftBukkit-Patches/{0013-View-Distance.patch => 0012-View-Distance.patch} (93%) rename CraftBukkit-Patches/{0014-Compressed-Nibble-Arrays.patch => 0013-Compressed-Nibble-Arrays.patch} (97%) rename CraftBukkit-Patches/{0015-Sync-Free-Chunk-Reference-Cache.patch => 0014-Sync-Free-Chunk-Reference-Cache.patch} (71%) rename CraftBukkit-Patches/{0016-Highly-Optimized-Tick-Loop.patch => 0015-Highly-Optimized-Tick-Loop.patch} (74%) rename CraftBukkit-Patches/{0017-Improved-Timings-System.patch => 0016-Improved-Timings-System.patch} (86%) rename CraftBukkit-Patches/{0018-Orebfuscator.patch => 0017-Orebfuscator.patch} (89%) rename CraftBukkit-Patches/{0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch => 0018-Fix-Mob-Spawning-Relative-to-View-Distance.patch} (94%) rename CraftBukkit-Patches/{0020-Handle-Null-Tile-Entities.patch => 0019-Handle-Null-Tile-Entities.patch} (86%) rename CraftBukkit-Patches/{0021-Entity-Activation-Range.patch => 0020-Entity-Activation-Range.patch} (95%) rename CraftBukkit-Patches/{0022-Metrics.patch => 0021-Metrics.patch} (99%) rename CraftBukkit-Patches/{0024-PlayerItemDamageEvent.patch => 0022-PlayerItemDamageEvent.patch} (81%) rename CraftBukkit-Patches/{0025-Faster-UUID-for-entities.patch => 0023-Faster-UUID-for-entities.patch} (77%) delete mode 100644 CraftBukkit-Patches/0023-Netty.patch rename CraftBukkit-Patches/{0026-Prevent-NPE-in-CraftSign.patch => 0024-Prevent-NPE-in-CraftSign.patch} (95%) rename CraftBukkit-Patches/{0027-Entity-Tracking-Ranges.patch => 0025-Entity-Tracking-Ranges.patch} (95%) rename CraftBukkit-Patches/{0029-Limit-Custom-Map-Rendering.patch => 0026-Limit-Custom-Map-Rendering.patch} (95%) rename CraftBukkit-Patches/{0030-Enable-Improved-Ping-Sending.patch => 0027-Enable-Improved-Ping-Sending.patch} (77%) delete mode 100644 CraftBukkit-Patches/0028-BungeeCord-Support.patch create mode 100644 CraftBukkit-Patches/0028-Thread-Naming-and-Tweaks.patch rename CraftBukkit-Patches/{0033-Close-Unloaded-Save-Files.patch => 0029-Close-Unloaded-Save-Files.patch} (92%) rename CraftBukkit-Patches/{0034-Improve-NextTickList-Performance.patch => 0030-Improve-NextTickList-Performance.patch} (73%) delete mode 100644 CraftBukkit-Patches/0031-Filter-Invalid-Names.patch rename CraftBukkit-Patches/{0035-Remove-o-Option.patch => 0031-Remove-o-Option.patch} (82%) rename CraftBukkit-Patches/{0036-Recipe-Deconstruction.patch => 0032-Recipe-Deconstruction.patch} (86%) delete mode 100644 CraftBukkit-Patches/0032-Thread-Naming-and-Tweaks.patch rename CraftBukkit-Patches/{0037-Implement-Arrow-API.patch => 0033-Implement-Arrow-API.patch} (92%) rename CraftBukkit-Patches/{0039-Hopper-Cooldowns.patch => 0034-Hopper-Cooldowns.patch} (96%) rename CraftBukkit-Patches/{0040-Prevent-Shutdown-Hang.patch => 0035-Prevent-Shutdown-Hang.patch} (74%) rename CraftBukkit-Patches/{0041-Implement-SpawnerSpawnEvent.patch => 0036-Implement-SpawnerSpawnEvent.patch} (91%) rename CraftBukkit-Patches/{0042-Firework-Meta-Crash-Fix.patch => 0037-Firework-Meta-Crash-Fix.patch} (91%) rename CraftBukkit-Patches/{0043-Do-Not-Search-for-Offline-Players.patch => 0038-Do-Not-Search-for-Offline-Players.patch} (82%) delete mode 100644 CraftBukkit-Patches/0038-Particle-API.patch rename CraftBukkit-Patches/{0046-Allow-Disabling-of-Command-Logging.patch => 0039-Allow-Disabling-of-Command-Logging.patch} (66%) rename CraftBukkit-Patches/{0047-Allow-Disabling-of-Command-TabComplete.patch => 0040-Allow-Disabling-of-Command-TabComplete.patch} (86%) rename CraftBukkit-Patches/{0048-Configurable-Messages.patch => 0041-Configurable-Messages.patch} (60%) rename CraftBukkit-Patches/{0049-Allow-Disabling-of-Random-Lighting-Updates.patch => 0042-Allow-Disabling-of-Random-Lighting-Updates.patch} (90%) rename CraftBukkit-Patches/{0050-Add-Log-Filtering.patch => 0043-Add-Log-Filtering.patch} (92%) delete mode 100644 CraftBukkit-Patches/0044-Enable-Foreign-Language-Signs.patch rename CraftBukkit-Patches/{0051-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch => 0044-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch} (97%) rename CraftBukkit-Patches/{0053-Properly-Close-Inventories.patch => 0045-Properly-Close-Inventories.patch} (91%) delete mode 100644 CraftBukkit-Patches/0045-Spam-Filter-Exclusions.patch rename CraftBukkit-Patches/{0054-Disallow-Interaction-With-Self.patch => 0046-Disallow-Interaction-With-Self.patch} (67%) rename CraftBukkit-Patches/{0055-Lower-Chunk-Compression.patch => 0047-Lower-Chunk-Compression.patch} (70%) rename CraftBukkit-Patches/{0056-Entity-Mount-and-Dismount-Events.patch => 0048-Entity-Mount-and-Dismount-Events.patch} (88%) rename CraftBukkit-Patches/{0058-Properly-Consume-Bonemeal-in-Dispensers.patch => 0049-Properly-Consume-Bonemeal-in-Dispensers.patch} (95%) rename CraftBukkit-Patches/{0059-Prevent-Ghost-Players-Caused-by-Plugins.patch => 0050-Prevent-Ghost-Players-Caused-by-Plugins.patch} (85%) rename CraftBukkit-Patches/{0060-Entity-ticking-chunk-caching.patch => 0051-Entity-ticking-chunk-caching.patch} (89%) delete mode 100644 CraftBukkit-Patches/0052-Always-Fire-PreLoginEvent.patch rename CraftBukkit-Patches/{0061-Plug-World-Unload-Memory-Leak.patch => 0052-Plug-World-Unload-Memory-Leak.patch} (88%) rename CraftBukkit-Patches/{0062-Player-Collision-API.patch => 0053-Player-Collision-API.patch} (78%) rename CraftBukkit-Patches/{0063-Fully-Disable-Snooper-When-Not-Required.patch => 0054-Fully-Disable-Snooper-When-Not-Required.patch} (63%) rename CraftBukkit-Patches/{0064-Add-Getter-for-Entity-Invulnerability.patch => 0055-Add-Getter-for-Entity-Invulnerability.patch} (80%) rename CraftBukkit-Patches/{0065-Guard-entity-list.patch => 0056-Guard-entity-list.patch} (85%) rename CraftBukkit-Patches/{0066-Cap-Minimum-Player-Speed.patch => 0057-Cap-Minimum-Player-Speed.patch} (77%) delete mode 100644 CraftBukkit-Patches/0057-Colour-Console-Messages.patch rename CraftBukkit-Patches/{0067-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch => 0058-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch} (74%) rename CraftBukkit-Patches/{0069-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch => 0059-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch} (95%) rename CraftBukkit-Patches/{0070-Allow-Disabling-of-1.6.3-Structure-Saving.patch => 0060-Allow-Disabling-of-1.6.3-Structure-Saving.patch} (96%) rename CraftBukkit-Patches/{0071-Item-Despawn-Rate.patch => 0061-Item-Despawn-Rate.patch} (64%) rename CraftBukkit-Patches/{0073-Don-t-Special-Case-X-Move-Value.patch => 0062-Don-t-Special-Case-X-Move-Value.patch} (67%) rename CraftBukkit-Patches/{0074-Implement-respawn-API.patch => 0063-Implement-respawn-API.patch} (83%) rename CraftBukkit-Patches/{0075-Fix-BrewingStands-Removing-NBT-Potions.patch => 0064-Fix-BrewingStands-Removing-NBT-Potions.patch} (94%) rename CraftBukkit-Patches/{0076-Arrow-Despawn-Rate.patch => 0065-Arrow-Despawn-Rate.patch} (85%) rename CraftBukkit-Patches/{0077-Watchdog-Thread.patch => 0066-Watchdog-Thread.patch} (96%) delete mode 100644 CraftBukkit-Patches/0068-Nerf-Zombie-Lag-Issues.patch delete mode 100644 CraftBukkit-Patches/0072-Fix-clearing-potion-effects-on-respawn-missed-rename.patch diff --git a/CraftBukkit-Patches/0001-POM-Changes.patch b/CraftBukkit-Patches/0001-POM-Changes.patch index 7926860dd..7db09802e 100644 --- a/CraftBukkit-Patches/0001-POM-Changes.patch +++ b/CraftBukkit-Patches/0001-POM-Changes.patch @@ -1,11 +1,11 @@ -From 1e30afdf5e51ea4aab45e4ddadaa8e38e4082682 Mon Sep 17 00:00:00 2001 +From 0fb4b4d5c11cbd1aa4d4143accc986954f0fea1a Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 2 Jul 2013 13:07:39 +1000 Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index b56b26c..de6eeed 100644 +index 2afdff4..a77fec8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,20 @@ @@ -25,7 +25,7 @@ index b56b26c..de6eeed 100644 + org.spigotmc + spigot jar - 1.6.4-R2.1-SNAPSHOT + 1.7.2-R0.1-SNAPSHOT - CraftBukkit - http://www.bukkit.org + Spigot @@ -142,11 +142,11 @@ index b56b26c..de6eeed 100644 package diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d140c4f..8fc8bba 100644 +index caa184e..a478ee9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -210,7 +210,7 @@ public final class CraftServer implements Server { - chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold"); +@@ -225,7 +225,7 @@ public final class CraftServer implements Server { + loadIcon(); updater = new AutoUpdater(new BukkitDLUpdaterService(configuration.getString("auto-updater.host")), getLogger(), configuration.getString("auto-updater.preferred-channel")); - updater.setEnabled(configuration.getBoolean("auto-updater.enabled")); diff --git a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch index c1157d637..f4f8122ff 100644 --- a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch +++ b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch @@ -1,15 +1,15 @@ -From e0fec2ec7e896f2c660729f24eb0b72791865915 Mon Sep 17 00:00:00 2001 +From 43a4368814bb1162e0cc30b58ba911b3d6099646 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 15:10:56 +1000 Subject: [PATCH] Skeleton API Implementations diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 9f75d8e..856c713 100644 +index 5626e98..5938b37 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1268,4 +1268,14 @@ public class CraftWorld implements World { - cps.queueUnload(chunk.x, chunk.z); +@@ -1274,4 +1274,14 @@ public class CraftWorld implements World { + cps.queueUnload(chunk.locX, chunk.locZ); } } + // Spigot start @@ -44,10 +44,10 @@ index b46b9c4..a386001 100644 + // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d9659fb..4f4b84f 100644 +index fe0f200..e026c1f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -398,4 +398,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -399,4 +399,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return getHandle().vehicle.getBukkitEntity(); } @@ -64,12 +64,12 @@ index d9659fb..4f4b84f 100644 + // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ac73273..63ce45a 100644 +index 0153608..9add7bf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1072,4 +1072,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1125,4 +1125,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } - collection.add(new AttributeModifiable(getHandle().aX(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + collection.add(new AttributeModifiable(getHandle().bc(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); } + + // Spigot start diff --git a/CraftBukkit-Patches/0004-Spigot-Configuration.patch b/CraftBukkit-Patches/0004-Spigot-Configuration.patch index 926d66ef4..1a405b4a4 100644 --- a/CraftBukkit-Patches/0004-Spigot-Configuration.patch +++ b/CraftBukkit-Patches/0004-Spigot-Configuration.patch @@ -1,15 +1,15 @@ -From f964622c2736fc8d723025d8553ca2ce91b7d67e Mon Sep 17 00:00:00 2001 +From 5a795c69a696f3a4817dd22c16cc526937e30410 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 7 Jul 2013 09:32:53 +1000 Subject: [PATCH] Spigot Configuration diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index f871b73..0cca057 100644 +index 03585b7..086f49e 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -90,6 +90,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (this.I() < 0) { +@@ -102,6 +102,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + if (this.J() < 0) { this.setPort(this.propertyManager.getInt("server-port", 25565)); } + // Spigot start @@ -18,9 +18,9 @@ index f871b73..0cca057 100644 + org.spigotmc.SpigotConfig.registerCommands(); + // Spigot end - this.getLogger().info("Generating keypair"); + h.info("Generating keypair"); this.a(MinecraftEncryption.b()); -@@ -104,7 +109,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -116,7 +121,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return false; } @@ -32,12 +32,12 @@ index f871b73..0cca057 100644 + // Spigot End if (!this.getOnlineMode()) { - this.getLogger().warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); + h.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 3924a5c..fbbfa33 100644 +index 67247f6..9357eb9 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -99,6 +99,7 @@ public abstract class World implements IBlockAccess { +@@ -105,6 +105,7 @@ public abstract class World implements IBlockAccess { int lastXAccessed = Integer.MIN_VALUE; int lastZAccessed = Integer.MIN_VALUE; final Object chunkLock = new Object(); @@ -45,19 +45,19 @@ index 3924a5c..fbbfa33 100644 public CraftWorld getWorld() { return this.world; -@@ -110,6 +111,7 @@ public abstract class World implements IBlockAccess { +@@ -116,6 +117,7 @@ public abstract class World implements IBlockAccess { - // Changed signature - public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, ChunkGenerator gen, org.bukkit.World.Environment env) { + // Changed signature - added gen and env + public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig( s ); // Spigot this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index cee0549..62ecc19 100644 +index a478ee9..5eefd0d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -216,8 +216,10 @@ public final class CraftServer implements Server { +@@ -231,8 +231,10 @@ public final class CraftServer implements Server { updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update")); updater.check(serverVersion); @@ -70,7 +70,7 @@ index cee0549..62ecc19 100644 } private File getConfigFile() { -@@ -566,6 +568,7 @@ public final class CraftServer implements Server { +@@ -582,6 +584,7 @@ public final class CraftServer implements Server { playerList.getIPBans().load(); playerList.getNameBans().load(); @@ -78,7 +78,7 @@ index cee0549..62ecc19 100644 for (WorldServer world : console.worlds) { world.difficulty = difficulty; world.setSpawnFlags(monsters, animals); -@@ -580,11 +583,13 @@ public final class CraftServer implements Server { +@@ -596,11 +599,13 @@ public final class CraftServer implements Server { } else { world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns(); } diff --git a/CraftBukkit-Patches/0005-Better-Chunk-Tick-Selection.patch b/CraftBukkit-Patches/0005-Better-Chunk-Tick-Selection.patch index 7c5ee138a..16e5830e3 100644 --- a/CraftBukkit-Patches/0005-Better-Chunk-Tick-Selection.patch +++ b/CraftBukkit-Patches/0005-Better-Chunk-Tick-Selection.patch @@ -1,24 +1,17 @@ -From e88612ecce87211e7d06cb37dc9cb17329bc3e68 Mon Sep 17 00:00:00 2001 +From 4feddcc91c933967b5ea82389c2593641f28e20f Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 11 Jun 2013 12:56:02 +1000 Subject: [PATCH] Better Chunk Tick Selection diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7d4def3..15d2a62 100644 +index 9357eb9..f0a8024 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -66,13 +66,35 @@ public abstract class World implements IBlockAccess { - // CraftBukkit start - public, longhashset - public boolean allowMonsters = true; - public boolean allowAnimals = true; -- protected LongHashSet chunkTickList = new LongHashSet(); - public long ticksPerAnimalSpawns; - public long ticksPerMonsterSpawns; - // CraftBukkit end - private int O; - int[] H; - public boolean isStatic; +@@ -74,6 +74,30 @@ public abstract class World implements IBlockAccess { + private boolean N; + int[] I; + + // Spigot start + protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; + protected float growthOdds = 100; @@ -42,10 +35,11 @@ index 7d4def3..15d2a62 100644 + return (int) ( ( ( k >> 32 ) & 0xFFFF0000L ) | ( ( k >> 16 ) & 0x0000FFFF ) ); + } + // Spigot end - ++ public BiomeBase getBiome(int i, int j) { if (this.isLoaded(i, 0, j)) { -@@ -117,6 +139,11 @@ public abstract class World implements IBlockAccess { + Chunk chunk = this.getChunkAtWorldCoords(i, j); +@@ -123,6 +147,11 @@ public abstract class World implements IBlockAccess { this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit // CraftBukkit end @@ -55,9 +49,9 @@ index 7d4def3..15d2a62 100644 + this.chunkTickList.setAutoCompactionFactor( 0 ); + // Spigot end - this.O = this.random.nextInt(12000); - this.H = new int['\u8000']; -@@ -1955,24 +1982,44 @@ public abstract class World implements IBlockAccess { + this.L = this.random.nextInt(12000); + this.allowMonsters = true; +@@ -1896,24 +1925,44 @@ public abstract class World implements IBlockAccess { int j; int k; @@ -113,16 +107,14 @@ index 7d4def3..15d2a62 100644 this.methodProfiler.b(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index eb9540f..b073b90 100644 +index b9b967f..812e887 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -300,9 +300,19 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -306,10 +306,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate // CraftBukkit start // Iterator iterator = this.chunkTickList.iterator(); - for (long chunkCoord : this.chunkTickList.popAll()) { -- int chunkX = LongHash.msw(chunkCoord); -- int chunkZ = LongHash.lsw(chunkCoord); + // Spigot start + for (gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) { + iter.advance(); @@ -137,11 +129,14 @@ index eb9540f..b073b90 100644 + } + // Spigot end // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); +- int chunkX = LongHash.msw(chunkCoord); +- int chunkZ = LongHash.lsw(chunkCoord); int k = chunkX * 16; int l = chunkZ * 16; + @@ -400,6 +410,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - if (block != null && block.isTicking()) { + if (block.isTicking()) { ++i; + this.growthOdds = (iter.value() < 1) ? this.modifiedOdds : 100; // Spigot - grow fast if no players are in this chunk (value = player count) block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random); @@ -164,5 +159,5 @@ index 961ddb4..478d9e6 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch b/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch index 494881337..229f2ace0 100644 --- a/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch +++ b/CraftBukkit-Patches/0006-Crop-Growth-Rates.patch @@ -1,14 +1,14 @@ -From 89188699eec6514aae0bc53904a2fe8f732630bf Mon Sep 17 00:00:00 2001 +From 27be6c4e1c2e911cd92968c1a58b16e5ee7302a0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 17:17:20 +1000 Subject: [PATCH] Crop Growth Rates diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 2a85c1c..afe8735 100644 +index dca832f..ad4e3a2 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -781,4 +781,16 @@ public class Block { +@@ -804,4 +804,16 @@ public class Block { return 0; } // CraftBukkit end @@ -26,36 +26,41 @@ index 2a85c1c..afe8735 100644 + // Spigot end } diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index 03eece7..758ab84 100644 +index 421af04..5c7910d 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -23,7 +23,7 @@ public class BlockCactus extends Block { +@@ -23,8 +23,8 @@ public class BlockCactus extends Block { if (l < 3) { int i1 = world.getData(i, j, k); - if (i1 == 15) { +- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit + if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit world.setData(i, j, k, 0, 4); - this.doPhysics(world, i, j + 1, k, this.id); + this.doPhysics(world, i, j + 1, k, this); + } else { diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java -index e157fbe..84a809b 100644 +index 942d6ab..ef670e8 100644 --- a/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java -@@ -28,7 +28,7 @@ public class BlockCrops extends BlockFlower { +@@ -27,9 +27,8 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement if (l < 7) { - float f = this.k(world, i, j, k); + float f = this.n(world, i, j, k); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { +- ++l; +- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit + if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit } } + } diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java -index 6f9301d..2ccc0b8 100644 +index 7b78579..bdf3172 100644 --- a/src/main/java/net/minecraft/server/BlockGrass.java +++ b/src/main/java/net/minecraft/server/BlockGrass.java -@@ -32,7 +32,8 @@ public class BlockGrass extends Block { +@@ -37,7 +37,8 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { } // CraftBukkit end } else if (world.getLightLevel(i, j + 1, k) >= 9) { @@ -66,10 +71,10 @@ index 6f9301d..2ccc0b8 100644 int j1 = j + random.nextInt(5) - 3; int k1 = k + random.nextInt(3) - 1; diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java -index 796527d..b4a6800 100644 +index 54a399f..4cab3eb 100644 --- a/src/main/java/net/minecraft/server/BlockMushroom.java +++ b/src/main/java/net/minecraft/server/BlockMushroom.java -@@ -24,7 +24,7 @@ public class BlockMushroom extends BlockFlower { +@@ -23,7 +23,7 @@ public class BlockMushroom extends BlockPlant implements IBlockFragilePlantEleme public void a(World world, int i, int j, int k, Random random) { final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit @@ -79,7 +84,7 @@ index 796527d..b4a6800 100644 int l = 5; diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java -index 1de8c83..fa11d1c 100644 +index 6ac6d94..a401f65 100644 --- a/src/main/java/net/minecraft/server/BlockMycel.java +++ b/src/main/java/net/minecraft/server/BlockMycel.java @@ -32,7 +32,8 @@ public class BlockMycel extends Block { @@ -93,23 +98,32 @@ index 1de8c83..fa11d1c 100644 int j1 = j + random.nextInt(5) - 3; int k1 = k + random.nextInt(3) - 1; diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index 8657860..cf52501 100644 +index a1350f6..246b951 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -23,7 +23,7 @@ public class BlockReed extends Block { - if (l < 3) { - int i1 = world.getData(i, j, k); +@@ -24,12 +24,11 @@ public class BlockReed extends Block { + if (l < 3) { + int i1 = world.getData(i, j, k); -- if (i1 == 15) { +- if (i1 == 15) { +- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit +- world.setData(i, j, k, 0, 4); +- } else { +- world.setData(i, j, k, i1 + 1, 4); +- } + if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit - world.setData(i, j, k, 0, 4); - } else { ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit ++ world.setData(i, j, k, 0, 4); ++ } else { ++ world.setData(i, j, k, i1 + 1, 4); + } + } + } diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java -index 706d6c9..fe675b3 100644 +index 830eb65..24c95ef 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java -@@ -25,7 +25,7 @@ public class BlockSapling extends BlockFlower { +@@ -26,7 +26,7 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen public void a(World world, int i, int j, int k, Random random) { if (!world.isStatic) { super.a(world, i, j, k, random); @@ -119,12 +133,12 @@ index 706d6c9..fe675b3 100644 } } diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java -index f2d4e57..5fe0a81 100644 +index 4fae805..9c8e816 100644 --- a/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java -@@ -27,7 +27,7 @@ public class BlockStem extends BlockFlower { +@@ -26,7 +26,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { if (world.getLightLevel(i, j + 1, k) >= 9) { - float f = this.m(world, i, j, k); + float f = this.n(world, i, j, k); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { + if (random.nextInt((int) (world.growthOdds / (this.id == Block.PUMPKIN_STEM.id ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot @@ -173,5 +187,5 @@ index 478d9e6..1c598ed 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0007-More-Efficient-Chunk-Save-Queue.patch b/CraftBukkit-Patches/0007-More-Efficient-Chunk-Save-Queue.patch index b02669786..1c9dbe64f 100644 --- a/CraftBukkit-Patches/0007-More-Efficient-Chunk-Save-Queue.patch +++ b/CraftBukkit-Patches/0007-More-Efficient-Chunk-Save-Queue.patch @@ -1,30 +1,28 @@ -From a47bb2a8c87e3c9d9ea238e46f01c984c71428f8 Mon Sep 17 00:00:00 2001 +From ff637c04c532b97e577121ac1790ff689ad7bf31 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 11 Jun 2013 12:09:45 +1000 Subject: [PATCH] More Efficient Chunk Save Queue diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 8a21f35..ba6d32f 100644 +index d5cf88d..1e1499e 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -13,8 +13,7 @@ import java.util.Set; +@@ -16,6 +16,7 @@ import org.apache.logging.log4j.Logger; - public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { + public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { -- private List a = new ArrayList(); -- private Set b = new HashSet(); + private java.util.LinkedHashMap pendingSaves = new java.util.LinkedHashMap(); // Spigot - private Object c = new Object(); - private final File d; - -@@ -27,13 +26,11 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { + private static final Logger a = LogManager.getLogger(); + private List b = new ArrayList(); + private Set c = new HashSet(); +@@ -31,13 +32,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); - synchronized (this.c) { -- if (this.b.contains(chunkcoordintpair)) { -- for (int k = 0; k < this.a.size(); ++k) { -- if (((PendingChunkToSave) this.a.get(k)).a.equals(chunkcoordintpair)) { + synchronized (this.d) { +- if (this.c.contains(chunkcoordintpair)) { +- for (int k = 0; k < this.b.size(); ++k) { +- if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) { - return true; - } - } @@ -36,15 +34,15 @@ index 8a21f35..ba6d32f 100644 + // Spigot end } - return RegionFileCache.a(this.d, i, j).chunkExists(i & 31, j & 31); -@@ -60,14 +57,12 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { - Object object = this.c; + return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31); +@@ -64,14 +63,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + Object object = this.d; - synchronized (this.c) { -- if (this.b.contains(chunkcoordintpair)) { -- for (int k = 0; k < this.a.size(); ++k) { -- if (((PendingChunkToSave) this.a.get(k)).a.equals(chunkcoordintpair)) { -- nbttagcompound = ((PendingChunkToSave) this.a.get(k)).b; + synchronized (this.d) { +- if (this.c.contains(chunkcoordintpair)) { +- for (int k = 0; k < this.b.size(); ++k) { +- if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) { +- nbttagcompound = ((PendingChunkToSave) this.b.get(k)).b; - break; - } - } @@ -57,14 +55,14 @@ index 8a21f35..ba6d32f 100644 } if (nbttagcompound == null) { -@@ -148,17 +143,11 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { - Object object = this.c; +@@ -151,17 +148,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + Object object = this.d; - synchronized (this.c) { -- if (this.b.contains(chunkcoordintpair)) { -- for (int i = 0; i < this.a.size(); ++i) { -- if (((PendingChunkToSave) this.a.get(i)).a.equals(chunkcoordintpair)) { -- this.a.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); + synchronized (this.d) { +- if (this.c.contains(chunkcoordintpair)) { +- for (int i = 0; i < this.b.size(); ++i) { +- if (((PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) { +- this.b.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); - return; - } - } @@ -73,24 +71,24 @@ index 8a21f35..ba6d32f 100644 + return; } - -- this.a.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); -- this.b.add(chunkcoordintpair); +- this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); +- this.c.add(chunkcoordintpair); + // Spigot end FileIOThread.a.a(this); } } -@@ -168,12 +157,14 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { - Object object = this.c; +@@ -171,12 +162,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + Object object = this.d; - synchronized (this.c) { -- if (this.a.isEmpty()) { + synchronized (this.d) { +- if (this.b.isEmpty()) { + // Spigot start + if (this.pendingSaves.isEmpty()) { return false; } -- pendingchunktosave = (PendingChunkToSave) this.a.remove(0); -- this.b.remove(pendingchunktosave.a); +- pendingchunktosave = (PendingChunkToSave) this.b.remove(0); +- this.c.remove(pendingchunktosave.a); + pendingchunktosave = this.pendingSaves.values().iterator().next(); + this.pendingSaves.remove(pendingchunktosave.a); + // Spigot end @@ -98,5 +96,5 @@ index 8a21f35..ba6d32f 100644 if (pendingchunktosave != null) { -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch b/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch index b893946b0..0fd305087 100644 --- a/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch +++ b/CraftBukkit-Patches/0008-More-Efficient-GetCubes.patch @@ -1,14 +1,14 @@ -From 60ef2965fff046cd970c123c931facd7ee291f39 Mon Sep 17 00:00:00 2001 +From 4aa2e37f77d90bcae16a89d4aff9727bd4a1fcab Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 11 Jun 2013 12:17:37 +1000 Subject: [PATCH] More Efficient GetCubes diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 15d2a62..8ac0e8e 100644 +index f0a8024..a8dbc44 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1044,19 +1044,47 @@ public abstract class World implements IBlockAccess { +@@ -1015,16 +1015,42 @@ public abstract class World implements IBlockAccess { int i1 = MathHelper.floor(axisalignedbb.c); int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); @@ -16,10 +16,12 @@ index 15d2a62..8ac0e8e 100644 - for (int l1 = i1; l1 < j1; ++l1) { - if (this.isLoaded(k1, 64, l1)) { - for (int i2 = k - 1; i2 < l; ++i2) { -- Block block = Block.byId[this.getTypeId(k1, i2, l1)]; +- Block block; - -- if (block != null) { -- block.a(this, k1, i2, l1, axisalignedbb, this.M, entity); +- if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) { +- block = this.getType(k1, i2, l1); +- } else { +- block = Blocks.STONE; + // Spigot start + int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 ); + for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ ) @@ -53,10 +55,13 @@ index 15d2a62..8ac0e8e 100644 + if ( block != null ) + { + block.a( this, x, y, z, axisalignedbb, this.M, entity ); ++ // SPIGOT TODO: THIS DIFF + } + } } - } + + block.a(this, k1, i2, l1, axisalignedbb, this.M, entity); +@@ -1032,6 +1058,7 @@ public abstract class World implements IBlockAccess { } } } @@ -65,5 +70,5 @@ index 15d2a62..8ac0e8e 100644 double d0 = 0.25D; List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0)); -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0010-Merge-tweaks-and-configuration.patch b/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch similarity index 92% rename from CraftBukkit-Patches/0010-Merge-tweaks-and-configuration.patch rename to CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch index 8d8115d41..54eb9c422 100644 --- a/CraftBukkit-Patches/0010-Merge-tweaks-and-configuration.patch +++ b/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch @@ -1,4 +1,4 @@ -From 51dda8f0e8253d99806ada3cc33de13402f3504e Mon Sep 17 00:00:00 2001 +From 6caca256eacb7bcf592e0c987f6b2bc3e3365f2d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Mar 2013 09:46:33 +1100 Subject: [PATCH] Merge tweaks and configuration @@ -6,13 +6,13 @@ Subject: [PATCH] Merge tweaks and configuration This allows the merging of Experience orbs, as well as the configuration of the merge radius of items. Additionally it refactors the merge algorithm to be a better experience for players. diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 8e1b024..0b8756b 100644 +index bbcf674..08b9ac8 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -112,7 +112,10 @@ public class EntityItem extends Entity { +@@ -117,7 +117,10 @@ public class EntityItem extends Entity { } - private void e() { + private void k() { - Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator(); + // Spigot start + double radius = world.spigotConfig.itemMerge; @@ -21,7 +21,7 @@ index 8e1b024..0b8756b 100644 while (iterator.hasNext()) { EntityItem entityitem = (EntityItem) iterator.next(); -@@ -141,11 +144,13 @@ public class EntityItem extends Entity { +@@ -148,11 +151,13 @@ public class EntityItem extends Entity { } else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) { return false; } else { @@ -41,10 +41,10 @@ index 8e1b024..0b8756b 100644 } } else { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8ac0e8e..0968ed8 100644 +index a8dbc44..c91ae63 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -956,6 +956,23 @@ public abstract class World implements IBlockAccess { +@@ -927,6 +927,23 @@ public abstract class World implements IBlockAccess { // Not all projectiles extend EntityProjectile, so check for Bukkit interface instead event = CraftEventFactory.callProjectileLaunchEvent(entity); } @@ -92,5 +92,5 @@ index 1c598ed..610f753 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0009-Proxy-IP-Filter.patch b/CraftBukkit-Patches/0009-Proxy-IP-Filter.patch deleted file mode 100644 index 5f0c8ce48..000000000 --- a/CraftBukkit-Patches/0009-Proxy-IP-Filter.patch +++ /dev/null @@ -1,86 +0,0 @@ -From f87755a50f02b5c85c289b1cbb63b5333044c631 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 23 Apr 2013 11:22:07 +1000 -Subject: [PATCH] Proxy IP Filter - - -diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -index 2ce2e3a..f87ebf9 100644 ---- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -@@ -28,6 +28,7 @@ class ThreadLoginVerifier extends Thread { - - public void run() { - try { -+ if (org.spigotmc.SpamHaus.filterIp(pendingConnection)) return; // Spigot - String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).H().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16); - URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8")); - BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openConnection(PendingConnection.b(this.pendingConnection).ap()).getInputStream())); -diff --git a/src/main/java/org/spigotmc/SpamHaus.java b/src/main/java/org/spigotmc/SpamHaus.java -new file mode 100644 -index 0000000..55d8d12 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpamHaus.java -@@ -0,0 +1,44 @@ -+package org.spigotmc; -+ -+import java.net.InetAddress; -+import net.minecraft.server.PendingConnection; -+ -+public class SpamHaus -+{ -+ -+ private SpamHaus() -+ { -+ } -+ -+ public static boolean filterIp(PendingConnection con) -+ { -+ if ( SpigotConfig.preventProxies ) -+ { -+ try -+ { -+ InetAddress address = con.getSocket().getInetAddress(); -+ String ip = address.getHostAddress(); -+ -+ if ( !address.isLoopbackAddress() ) -+ { -+ String[] split = ip.split( "\\." ); -+ StringBuilder lookup = new StringBuilder(); -+ for ( int i = split.length - 1; i >= 0; i-- ) -+ { -+ lookup.append( split[i] ); -+ lookup.append( "." ); -+ } -+ lookup.append( "xbl.spamhaus.org." ); -+ if ( InetAddress.getByName( lookup.toString() ) != null ) -+ { -+ con.disconnect( "Your IP address (" + ip + ") is flagged as unsafe by spamhaus.org/xbl" ); -+ return true; -+ } -+ } -+ } catch ( Exception ex ) -+ { -+ } -+ } -+ return false; -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 358d5ec..83696e9 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -117,4 +117,10 @@ public class SpigotConfig - config.addDefault( path, def ); - return config.getString( path, config.getString( path ) ); - } -+ -+ public static boolean preventProxies; -+ private static void preventProxies() -+ { -+ preventProxies = getBoolean( "settings.prevent-proxies", false ); -+ } - } --- -1.8.1.2 - diff --git a/CraftBukkit-Patches/0011-LongHash-Tweaks.patch b/CraftBukkit-Patches/0010-LongHash-Tweaks.patch similarity index 98% rename from CraftBukkit-Patches/0011-LongHash-Tweaks.patch rename to CraftBukkit-Patches/0010-LongHash-Tweaks.patch index 4ce7b8775..03e105a6f 100644 --- a/CraftBukkit-Patches/0011-LongHash-Tweaks.patch +++ b/CraftBukkit-Patches/0010-LongHash-Tweaks.patch @@ -1,4 +1,4 @@ -From 0db87d9664687b450e80bf526eb4f44e17bdc6a3 Mon Sep 17 00:00:00 2001 +From 78255c9512516c665d4f93bf0b984d479cf5b824 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 17:13:47 +1000 Subject: [PATCH] LongHash Tweaks @@ -220,5 +220,5 @@ index 0000000..9416f6e + } +} -- -1.8.1.msysgit.1 +1.8.3.2 diff --git a/CraftBukkit-Patches/0012-Async-Operation-Catching.patch b/CraftBukkit-Patches/0011-Async-Operation-Catching.patch similarity index 85% rename from CraftBukkit-Patches/0012-Async-Operation-Catching.patch rename to CraftBukkit-Patches/0011-Async-Operation-Catching.patch index 9c69cfc74..b557ba05a 100644 --- a/CraftBukkit-Patches/0012-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0011-Async-Operation-Catching.patch @@ -1,4 +1,4 @@ -From dafcb9453f2b6debf6e9613b3a402a85f28e654a Mon Sep 17 00:00:00 2001 +From d4776c8e08161059f62919e41423f47216e7db43 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 7 Mar 2013 20:12:46 +1100 Subject: [PATCH] Async Operation Catching @@ -6,10 +6,10 @@ Subject: [PATCH] Async Operation Catching Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread. diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index afe8735..8fc6c12 100644 +index ad4e3a2..32f8c3f 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -342,9 +342,13 @@ public class Block { +@@ -433,9 +433,13 @@ public class Block { return 10; } @@ -18,7 +18,7 @@ index afe8735..8fc6c12 100644 + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous block onPlace!"); // Spigot + } -- public void remove(World world, int i, int j, int k, int l, int i1) {} +- public void remove(World world, int i, int j, int k, Block block, int l) {} + public void remove(World world, int i, int j, int k, int l, int i1) { + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous block remove!"); // Spigot + } @@ -26,30 +26,30 @@ index afe8735..8fc6c12 100644 public int a(Random random) { return 1; diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -index 1d9203b..ebbef6a 100644 +index 7447e42..97d0bbb 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java -@@ -87,6 +87,7 @@ public class EntityTracker { +@@ -91,6 +91,7 @@ public class EntityTracker { } public void addEntity(Entity entity, int i, int j, boolean flag) { + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous entity track!"); // Spigot - if (i > this.d) { - i = this.d; + if (i > this.e) { + i = this.e; } -@@ -122,6 +123,7 @@ public class EntityTracker { +@@ -125,6 +126,7 @@ public class EntityTracker { } public void untrackEntity(Entity entity) { + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous entity untrack!"); // Spigot if (entity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) entity; - Iterator iterator = this.b.iterator(); + Iterator iterator = this.c.iterator(); diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 8545b50..1f5a652 100644 +index 9f818cf..8052ea6 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -297,6 +297,7 @@ public class EntityTrackerEntry { +@@ -299,6 +299,7 @@ public class EntityTrackerEntry { } public void updatePlayer(EntityPlayer entityplayer) { @@ -57,19 +57,19 @@ index 8545b50..1f5a652 100644 if (entityplayer != this.tracker) { double d0 = entityplayer.locX - (double) (this.xLoc / 32); double d1 = entityplayer.locZ - (double) (this.zLoc / 32); -@@ -513,6 +514,7 @@ public class EntityTrackerEntry { +@@ -515,6 +516,7 @@ public class EntityTrackerEntry { } public void clear(EntityPlayer entityplayer) { + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous player tracker clear!"); // Spigot if (this.trackedPlayers.contains(entityplayer)) { this.trackedPlayers.remove(entityplayer); - entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id)); + entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId())); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0968ed8..4ec4d08 100644 +index c91ae63..967565b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -925,6 +925,7 @@ public abstract class World implements IBlockAccess { +@@ -896,6 +896,7 @@ public abstract class World implements IBlockAccess { } public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason @@ -77,7 +77,7 @@ index 0968ed8..4ec4d08 100644 if (entity == null) return false; // CraftBukkit end -@@ -1031,6 +1032,7 @@ public abstract class World implements IBlockAccess { +@@ -1002,6 +1003,7 @@ public abstract class World implements IBlockAccess { } public void removeEntity(Entity entity) { @@ -85,16 +85,16 @@ index 0968ed8..4ec4d08 100644 entity.die(); if (entity instanceof EntityHuman) { this.players.remove(entity); -@@ -2448,6 +2450,7 @@ public abstract class World implements IBlockAccess { +@@ -2398,6 +2400,7 @@ public abstract class World implements IBlockAccess { } public void a(List list) { + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous entity world add!"); // Spigot // CraftBukkit start + // this.entityList.addAll(list); Entity entity = null; - for (int i = 0; i < list.size(); ++i) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index fc71833..7601fb5 100644 +index 5938b37..0f21e89 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -159,6 +159,7 @@ public class CraftWorld implements World { @@ -122,17 +122,17 @@ index fc71833..7601fb5 100644 if (generate) { // Use the default variant of loadChunk when generate == true. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3cf0c28..988c6e7 100644 +index 9add7bf..0b8b324 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -218,6 +218,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } +@@ -230,6 +230,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + @Override public void kickPlayer(String message) { + if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous player kick!"); // Spigot if (getHandle().playerConnection == null) return; getHandle().playerConnection.disconnect(message == null ? "" : message); -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0013-View-Distance.patch b/CraftBukkit-Patches/0012-View-Distance.patch similarity index 93% rename from CraftBukkit-Patches/0013-View-Distance.patch rename to CraftBukkit-Patches/0012-View-Distance.patch index 537b03e0a..18ab8c6cd 100644 --- a/CraftBukkit-Patches/0013-View-Distance.patch +++ b/CraftBukkit-Patches/0012-View-Distance.patch @@ -1,4 +1,4 @@ -From a400608cb3d78216f49772c1155e2e8c0a0f5490 Mon Sep 17 00:00:00 2001 +From ff4ef17762df254ce5e8a0842b247d59cb1524dd Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Mar 2013 09:52:41 +1100 Subject: [PATCH] View Distance @@ -19,10 +19,10 @@ index 4e0398c..ae4ca63 100644 } else { this.f = i; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index b073b90..1a34feb 100644 +index 812e887..9f09a3d 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -49,7 +49,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -54,7 +54,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate // CraftBukkit end this.server = minecraftserver; this.tracker = new EntityTracker(this); @@ -48,5 +48,5 @@ index 610f753..3e66d79 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0014-Compressed-Nibble-Arrays.patch b/CraftBukkit-Patches/0013-Compressed-Nibble-Arrays.patch similarity index 97% rename from CraftBukkit-Patches/0014-Compressed-Nibble-Arrays.patch rename to CraftBukkit-Patches/0013-Compressed-Nibble-Arrays.patch index 8a696ecb3..65dab50f8 100644 --- a/CraftBukkit-Patches/0014-Compressed-Nibble-Arrays.patch +++ b/CraftBukkit-Patches/0013-Compressed-Nibble-Arrays.patch @@ -1,4 +1,4 @@ -From d10857c13d5eea02e7d70951421a73469468b7ca Mon Sep 17 00:00:00 2001 +From 1daa2b921a3a38f046c2281993f1b676ecac515a Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sun, 13 Jan 2013 03:49:07 -0800 Subject: [PATCH] Compressed Nibble Arrays @@ -12,10 +12,10 @@ Finish up NibbleArray lightening work - use for Snapshots, reduce copies Fix nibble handling with NBT - arrays aren't copied by NBTByteArray diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index ba6d32f..0b086a2 100644 +index 1e1499e..76b081a 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -218,15 +218,15 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { +@@ -225,15 +225,15 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { nbttagcompound1.setByte("Y", (byte) (chunksection.getYPosition() >> 4 & 255)); nbttagcompound1.setByteArray("Blocks", chunksection.getIdArray()); if (chunksection.getExtendedIdArray() != null) { @@ -37,10 +37,10 @@ index ba6d32f..0b086a2 100644 nbttaglist.add(nbttagcompound1); diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 3f67a19..e69afba 100644 +index a05efa0..360de1a 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -134,7 +134,8 @@ public class ChunkSection { +@@ -140,7 +140,8 @@ public class ChunkSection { } } } else { @@ -50,7 +50,7 @@ index 3f67a19..e69afba 100644 for (int off = 0, off2 = 0; off < blkIds.length;) { byte extid = ext[off2]; int l = (blkIds[off] & 0xFF) | ((extid & 0xF) << 8); // Even data -@@ -165,6 +166,12 @@ public class ChunkSection { +@@ -171,6 +172,12 @@ public class ChunkSection { off++; off2++; } @@ -63,7 +63,7 @@ index 3f67a19..e69afba 100644 } this.nonEmptyBlockCount = cntNonEmpty; this.tickingBlockCount = cntTicking; -@@ -225,12 +232,11 @@ public class ChunkSection { +@@ -224,12 +231,11 @@ public class ChunkSection { public void setExtendedIdArray(NibbleArray nibblearray) { // CraftBukkit start - Don't hang on to an empty nibble array boolean empty = true; @@ -80,7 +80,7 @@ index 3f67a19..e69afba 100644 if (empty) { return; -@@ -254,11 +260,11 @@ public class ChunkSection { +@@ -253,11 +259,11 @@ public class ChunkSection { // CraftBukkit start - Validate array lengths private NibbleArray validateNibbleArray(NibbleArray nibbleArray) { @@ -330,7 +330,7 @@ index 4e67e27..fa10397 100644 } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 1a21516..6921206 100644 +index b2c6ef4..55f5225 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -174,7 +174,18 @@ public class CraftChunk implements Chunk { @@ -402,5 +402,5 @@ index 1a21516..6921206 100644 } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0015-Sync-Free-Chunk-Reference-Cache.patch b/CraftBukkit-Patches/0014-Sync-Free-Chunk-Reference-Cache.patch similarity index 71% rename from CraftBukkit-Patches/0015-Sync-Free-Chunk-Reference-Cache.patch rename to CraftBukkit-Patches/0014-Sync-Free-Chunk-Reference-Cache.patch index 24edfa454..d73bc19f3 100644 --- a/CraftBukkit-Patches/0015-Sync-Free-Chunk-Reference-Cache.patch +++ b/CraftBukkit-Patches/0014-Sync-Free-Chunk-Reference-Cache.patch @@ -1,17 +1,20 @@ -From c876ff9dabc9bf638b9fcb1fd21521904c87193a Mon Sep 17 00:00:00 2001 +From 5778aaae32fd276df37a9941ec8c281431bd3803 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 16 Jan 2013 15:27:22 -0600 Subject: [PATCH] Sync Free Chunk Reference Cache diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4ec4d08..d5552b6 100644 +index 967565b..93c476c 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -300,15 +300,13 @@ public abstract class World implements IBlockAccess { +@@ -290,20 +290,18 @@ public abstract class World implements IBlockAccess { + return this.getChunkAt(i >> 4, j >> 4); + } - // CraftBukkit start ++ // Spigot start public Chunk getChunkAt(int i, int j) { +- // CraftBukkit start - Chunk result = null; - synchronized (this.chunkLock) { - if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) { @@ -28,8 +31,12 @@ index 4ec4d08..d5552b6 100644 } + //} return result; +- // CraftBukkit end } - // CraftBukkit end ++ // Spigot end + + public boolean setTypeAndData(int i, int j, int k, Block block, int l, int i1) { + if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) { -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0016-Highly-Optimized-Tick-Loop.patch b/CraftBukkit-Patches/0015-Highly-Optimized-Tick-Loop.patch similarity index 74% rename from CraftBukkit-Patches/0016-Highly-Optimized-Tick-Loop.patch rename to CraftBukkit-Patches/0015-Highly-Optimized-Tick-Loop.patch index cec6566d2..313ab7e12 100644 --- a/CraftBukkit-Patches/0016-Highly-Optimized-Tick-Loop.patch +++ b/CraftBukkit-Patches/0015-Highly-Optimized-Tick-Loop.patch @@ -1,14 +1,14 @@ -From 608e4269f7d6eaa3db5509d6c696185e35a351e9 Mon Sep 17 00:00:00 2001 +From 9b65fde8e1bbddb11b5e9a8faa5528e4dca6e9c1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 3 Feb 2013 12:28:17 +1100 Subject: [PATCH] Highly Optimized Tick Loop diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 029131d..d3a4265 100644 +index cdc41b4..1a9df71 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -87,6 +87,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -101,6 +101,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; // CraftBukkit end @@ -19,37 +19,42 @@ index 029131d..d3a4265 100644 + private static long catchupTime = 0; + // Spigot end - public MinecraftServer(OptionSet options) { // CraftBukkit - signature file -> OptionSet - this.c = Proxy.NO_PROXY; -@@ -391,39 +397,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet + i = this; +@@ -412,45 +418,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo public void run() { try { if (this.init()) { -- long i = aq(); +- long i = ap(); +- long j = 0L; - -- for (long j = 0L; this.isRunning; this.R = true) { -- long k = aq(); +- this.p.setMOTD(new ChatComponentText(this.motd)); +- this.p.setServerInfo(new ServerPingServerData("1.7.2", 4)); +- this.a(this.p); +- +- while (this.isRunning) { +- long k = ap(); - long l = k - i; - -- if (l > 2000L && i - this.S >= 15000L) { +- if (l > 2000L && i - this.O >= 15000L) { - if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages -- this.getLogger().warning("Can\'t keep up! Did the system time change, or is the server overloaded?"); +- h.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(l), Long.valueOf(l / 50L)}); - l = 2000L; -- this.S = i; +- this.O = i; - } - - if (l < 0L) { -- this.getLogger().warning("Time ran backwards! Did the system time change?"); +- h.warn("Time ran backwards! Did the system time change?"); - l = 0L; - } - - j += l; - i = k; - if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit -- this.s(); +- this.t(); - j = 0L; + // Spigot start -+ for (long lastTick = 0L; this.isRunning; this.R = true) { ++ for (long lastTick = 0L; this.isRunning;) { + long curTime = System.nanoTime(); + long wait = TICK_TIME - (curTime - lastTick) - catchupTime; + if (wait > 0) { @@ -60,16 +65,17 @@ index 029131d..d3a4265 100644 - while (j > 50L) { - MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit - j -= 50L; -- this.s(); +- this.t(); - } + catchupTime = Math.min(TICK_TIME * TPS, Math.abs(wait)); } - - Thread.sleep(1L); +- this.N = true; + currentTPS = (currentTPS * 0.95) + (1E9 / (curTime - lastTick) * 0.05); + lastTick = curTime; + MinecraftServer.currentTick++; -+ this.s(); ++ this.t(); } + // Spigot end } else { @@ -117,7 +123,7 @@ index 0000000..f114a31 + } +} diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 8f42042..693518d 100644 +index 2f2752a..b5d611b 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -14,6 +14,7 @@ import net.minecraft.server.MinecraftServer; @@ -128,9 +134,9 @@ index 8f42042..693518d 100644 public class SpigotConfig { -@@ -123,4 +124,9 @@ public class SpigotConfig - { - preventProxies = getBoolean( "settings.prevent-proxies", false ); +@@ -117,4 +118,9 @@ public class SpigotConfig + config.addDefault( path, def ); + return config.getString( path, config.getString( path ) ); } + + private static void tpsCommand() @@ -139,5 +145,5 @@ index 8f42042..693518d 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0017-Improved-Timings-System.patch b/CraftBukkit-Patches/0016-Improved-Timings-System.patch similarity index 86% rename from CraftBukkit-Patches/0017-Improved-Timings-System.patch rename to CraftBukkit-Patches/0016-Improved-Timings-System.patch index 258f6e040..469f3a9aa 100644 --- a/CraftBukkit-Patches/0017-Improved-Timings-System.patch +++ b/CraftBukkit-Patches/0016-Improved-Timings-System.patch @@ -1,4 +1,4 @@ -From 8eccd95e302141a9334eac45ed42f09658e99ac3 Mon Sep 17 00:00:00 2001 +From 75e5b9146eb945a1f5418ebab5da804264db3067 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 10 Jan 2013 00:18:11 -0500 Subject: [PATCH] Improved Timings System @@ -6,10 +6,10 @@ Subject: [PATCH] Improved Timings System Tracks nearly every point of minecraft internals and plugin events to give a good quick overview on what is causing TPS loss. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index b73f69c..17934c0 100644 +index a702fe8..e642388 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -102,6 +102,7 @@ public class ChunkProviderServer implements IChunkProvider { +@@ -107,6 +107,7 @@ public class ChunkProviderServer implements IChunkProvider { // CraftBukkit end if (chunk == null) { @@ -17,16 +17,16 @@ index b73f69c..17934c0 100644 chunk = this.loadChunk(i, j); if (chunk == null) { if (this.chunkProvider == null) { -@@ -140,6 +141,7 @@ public class ChunkProviderServer implements IChunkProvider { +@@ -143,6 +144,7 @@ public class ChunkProviderServer implements IChunkProvider { + } // CraftBukkit end - chunk.a(this, this, i, j); + org.bukkit.craftbukkit.SpigotTimings.syncChunkLoadTimer.stopTiming(); // Spigot } // CraftBukkit start - If we didn't need to load the chunk run the callback now diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 2158088..d65c123 100644 +index fec07f8..0c1350e 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -14,6 +14,7 @@ import org.bukkit.block.BlockFace; @@ -43,38 +43,39 @@ index 2158088..d65c123 100644 + public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot + - public Entity(World world) { - this.id = entityCount++; - this.l = 1.0D; -@@ -405,6 +408,7 @@ public abstract class Entity { + public int getId() { + return this.id; + } +@@ -423,6 +426,8 @@ public abstract class Entity { + return; } // CraftBukkit end - ++ + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot - if (this.Z) { + if (this.Y) { this.boundingBox.d(d0, d1, d2); this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; -@@ -713,6 +717,7 @@ public abstract class Entity { +@@ -731,6 +736,7 @@ public abstract class Entity { this.world.methodProfiler.b(); } + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - protected void D() { + protected String H() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d3a4265..dec46bd 100644 +index 1a9df71..5a07791 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -7,7 +7,6 @@ import java.security.KeyPair; - import java.text.SimpleDateFormat; - import java.util.ArrayList; +@@ -10,7 +10,6 @@ import java.util.ArrayList; + import java.util.Arrays; + import java.util.Collections; import java.util.Date; -import java.util.Iterator; import java.util.List; - import java.util.concurrent.Callable; - import java.util.logging.Level; -@@ -20,6 +19,7 @@ import jline.console.ConsoleReader; + import java.util.Random; + import java.util.UUID; +@@ -36,6 +35,7 @@ import jline.console.ConsoleReader; import joptsimple.OptionSet; import org.bukkit.World.Environment; @@ -82,26 +83,26 @@ index d3a4265..dec46bd 100644 import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.server.RemoteServerCommandEvent; import org.bukkit.event.world.WorldSaveEvent; -@@ -411,7 +411,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -432,7 +432,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo currentTPS = (currentTPS * 0.95) + (1E9 / (curTime - lastTick) * 0.05); lastTick = curTime; MinecraftServer.currentTick++; + SpigotTimings.serverTickTimer.startTiming(); - this.s(); + this.t(); + SpigotTimings.serverTickTimer.stopTiming(); + org.spigotmc.CustomTimingsHandler.tick(); } // Spigot end } else { -@@ -510,6 +513,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - public void t() { +@@ -557,6 +560,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + public void u() { this.methodProfiler.a("levels"); + SpigotTimings.schedulerTimer.startTiming(); // Spigot // CraftBukkit start this.server.getScheduler().mainThreadHeartbeat(this.ticks); -@@ -518,7 +522,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -565,7 +569,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo processQueue.remove().run(); } @@ -112,7 +113,7 @@ index d3a4265..dec46bd 100644 // Send time updates to everyone, it will get the right time from the world the player is in. if (this.ticks % 20 == 0) { -@@ -570,7 +577,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -617,7 +624,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo this.methodProfiler.b(); this.methodProfiler.a("tracker"); @@ -122,12 +123,12 @@ index d3a4265..dec46bd 100644 this.methodProfiler.b(); this.methodProfiler.b(); // } // CraftBukkit -@@ -579,14 +588,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -626,14 +635,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo } this.methodProfiler.c("connection"); + SpigotTimings.connectionTimer.startTiming(); // Spigot - this.ag().b(); + this.ag().c(); + SpigotTimings.connectionTimer.stopTiming(); // Spigot this.methodProfiler.c("players"); + SpigotTimings.playerListTimer.startTiming(); // Spigot @@ -136,18 +137,18 @@ index d3a4265..dec46bd 100644 this.methodProfiler.c("tickables"); + SpigotTimings.tickablesTimer.startTiming(); // Spigot - for (i = 0; i < this.p.size(); ++i) { - ((IUpdatePlayerListBox) this.p.get(i)).a(); + for (i = 0; i < this.m.size(); ++i) { + ((IUpdatePlayerListBox) this.m.get(i)).a(); } + SpigotTimings.tickablesTimer.stopTiming(); // Spigot this.methodProfiler.b(); } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index e4cb5c7..8443731 100644 +index 2419ac2..4e41695 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -953,6 +953,7 @@ public class PlayerConnection extends Connection { +@@ -908,6 +908,7 @@ public class PlayerConnection implements PacketPlayInListener { // CraftBukkit end private void handleCommand(String s) { @@ -155,7 +156,7 @@ index e4cb5c7..8443731 100644 // CraftBukkit start CraftPlayer player = this.getPlayer(); -@@ -960,19 +961,23 @@ public class PlayerConnection extends Connection { +@@ -915,19 +916,23 @@ public class PlayerConnection implements PacketPlayInListener { this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -164,7 +165,7 @@ index e4cb5c7..8443731 100644 } try { - this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit + this.c.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot return; @@ -176,16 +177,16 @@ index e4cb5c7..8443731 100644 return; } + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot + //this.minecraftServer.getCommandHandler().a(this.player, s); // CraftBukkit end - - /* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above. + } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index f4be980..6ae7cb3 100644 +index 811f1a4..3de32fe 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -4,10 +4,12 @@ import java.util.HashMap; - import java.util.Map; - import java.util.concurrent.Callable; +@@ -7,10 +7,12 @@ import java.util.concurrent.Callable; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import org.spigotmc.CustomTimingsHandler; // Spigot import org.bukkit.inventory.InventoryHolder; // CraftBukkit @@ -193,11 +194,11 @@ index f4be980..6ae7cb3 100644 public class TileEntity { + public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot - private static Map a = new HashMap(); - private static Map b = new HashMap(); - protected World world; + private static final Logger a = LogManager.getLogger(); + private static Map i = new HashMap(); + private static Map j = new HashMap(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ebbda63..3143d6e 100644 +index 93c476c..b1f294d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -13,6 +13,7 @@ import java.util.concurrent.Callable; @@ -208,7 +209,7 @@ index ebbda63..3143d6e 100644 import org.bukkit.craftbukkit.util.UnsafeList; import org.bukkit.generator.ChunkGenerator; import org.bukkit.craftbukkit.CraftServer; -@@ -123,6 +124,8 @@ public abstract class World implements IBlockAccess { +@@ -131,6 +132,8 @@ public abstract class World implements IBlockAccess { final Object chunkLock = new Object(); public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -217,7 +218,7 @@ index ebbda63..3143d6e 100644 public CraftWorld getWorld() { return this.world; } -@@ -200,6 +203,7 @@ public abstract class World implements IBlockAccess { +@@ -210,6 +213,7 @@ public abstract class World implements IBlockAccess { this.a(); this.getServer().addWorld(this.world); // CraftBukkit @@ -225,7 +226,7 @@ index ebbda63..3143d6e 100644 } protected abstract IChunkProvider j(); -@@ -1272,6 +1276,7 @@ public abstract class World implements IBlockAccess { +@@ -1250,6 +1254,7 @@ public abstract class World implements IBlockAccess { this.f.clear(); this.methodProfiler.c("regular"); @@ -233,7 +234,7 @@ index ebbda63..3143d6e 100644 for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); -@@ -1294,7 +1299,9 @@ public abstract class World implements IBlockAccess { +@@ -1272,7 +1277,9 @@ public abstract class World implements IBlockAccess { this.methodProfiler.a("tick"); if (!entity.dead) { try { @@ -243,17 +244,17 @@ index ebbda63..3143d6e 100644 } catch (Throwable throwable1) { crashreport = CrashReport.a(throwable1, "Ticking entity"); crashreportsystemdetails = crashreport.a("Entity being ticked"); -@@ -1319,7 +1326,9 @@ public abstract class World implements IBlockAccess { +@@ -1297,7 +1304,9 @@ public abstract class World implements IBlockAccess { this.methodProfiler.b(); } + timings.entityTick.stopTiming(); // Spigot - this.methodProfiler.c("tileEntities"); + this.methodProfiler.c("blockEntities"); + timings.tileEntityTick.startTiming(); // Spigot this.N = true; Iterator iterator = this.tileEntityList.iterator(); -@@ -1334,8 +1343,11 @@ public abstract class World implements IBlockAccess { +@@ -1312,8 +1321,11 @@ public abstract class World implements IBlockAccess { if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { try { @@ -262,10 +263,10 @@ index ebbda63..3143d6e 100644 + tileentity.tickTimer.stopTiming(); // Spigot } catch (Throwable throwable2) { + tileentity.tickTimer.stopTiming(); // Spigot - crashreport = CrashReport.a(throwable2, "Ticking tile entity"); - crashreportsystemdetails = crashreport.a("Tile entity being ticked"); + crashreport = CrashReport.a(throwable2, "Ticking block entity"); + crashreportsystemdetails = crashreport.a("Block entity being ticked"); tileentity.a(crashreportsystemdetails); -@@ -1355,6 +1367,8 @@ public abstract class World implements IBlockAccess { +@@ -1333,6 +1345,8 @@ public abstract class World implements IBlockAccess { } } @@ -274,7 +275,7 @@ index ebbda63..3143d6e 100644 this.N = false; if (!this.b.isEmpty()) { this.tileEntityList.removeAll(this.b); -@@ -1393,6 +1407,7 @@ public abstract class World implements IBlockAccess { +@@ -1371,6 +1385,7 @@ public abstract class World implements IBlockAccess { this.a.clear(); } @@ -282,15 +283,15 @@ index ebbda63..3143d6e 100644 this.methodProfiler.b(); this.methodProfiler.b(); } -@@ -1415,6 +1430,7 @@ public abstract class World implements IBlockAccess { +@@ -1393,6 +1408,7 @@ public abstract class World implements IBlockAccess { byte b0 = 32; - if (!flag || this.e(i - b0, 0, j - b0, i + b0, 0, j + b0)) { + if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) { + entity.tickTimer.startTiming(); // Spigot - entity.U = entity.locX; - entity.V = entity.locY; - entity.W = entity.locZ; -@@ -1476,6 +1492,7 @@ public abstract class World implements IBlockAccess { + entity.T = entity.locX; + entity.U = entity.locY; + entity.V = entity.locZ; +@@ -1454,6 +1470,7 @@ public abstract class World implements IBlockAccess { entity.passenger = null; } } @@ -299,23 +300,25 @@ index ebbda63..3143d6e 100644 } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 88a9f88..3afcc0e 100644 +index 9f09a3d..74a2d45 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -179,9 +179,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -184,10 +184,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals long time = this.worldData.getTime(); if (this.getGameRules().getBoolean("doMobSpawning") && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) { + timings.mobSpawn.startTiming(); // Spigot - this.Q.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); + this.R.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); +- // CraftBukkit end + timings.mobSpawn.stopTiming(); // Spigot } - // CraftBukkit end +- ++ // CraftBukkit end + timings.doChunkUnload.startTiming(); // Spigot this.methodProfiler.c("chunkSource"); this.chunkProvider.unloadChunks(); int j = this.a(1.0F); -@@ -195,21 +198,36 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -201,21 +203,36 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.worldData.setDayTime(this.worldData.getDayTime() + 1L); } @@ -324,7 +327,7 @@ index 88a9f88..3afcc0e 100644 + timings.doTickPending.startTiming(); // Spigot this.a(false); + timings.doTickPending.stopTiming(); // Spigot - this.methodProfiler.c("tickTiles"); + this.methodProfiler.c("tickBlocks"); + timings.doTickTiles.startTiming(); // Spigot this.g(); + timings.doTickTiles.stopTiming(); // Spigot @@ -339,11 +342,11 @@ index 88a9f88..3afcc0e 100644 + timings.doVillages.stopTiming(); // Spigot this.methodProfiler.c("portalForcer"); + timings.doPortalForcer.startTiming(); // Spigot - this.P.a(this.getTime()); + this.Q.a(this.getTime()); + timings.doPortalForcer.stopTiming(); // Spigot this.methodProfiler.b(); + timings.doSounds.startTiming(); // Spigot - this.aa(); + this.Z(); + timings.doSounds.stopTiming(); // Spigot + timings.doChunkGC.startTiming(); // Spigot diff --git a/CraftBukkit-Patches/0018-Orebfuscator.patch b/CraftBukkit-Patches/0017-Orebfuscator.patch similarity index 89% rename from CraftBukkit-Patches/0018-Orebfuscator.patch rename to CraftBukkit-Patches/0017-Orebfuscator.patch index c1bdd7f25..9fbcc1206 100644 --- a/CraftBukkit-Patches/0018-Orebfuscator.patch +++ b/CraftBukkit-Patches/0017-Orebfuscator.patch @@ -1,11 +1,11 @@ -From 61bd37b5410c326094dde16492c13924c032416a Mon Sep 17 00:00:00 2001 +From 29223bf84a6cc1301032e98df9c76f170b78f99e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 16 May 2013 18:51:05 +1000 Subject: [PATCH] Orebfuscator diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index b552421..8617474 100644 +index 991a765..e15840b 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -86,6 +86,7 @@ public class EntityFallingBlock extends Entity { @@ -18,20 +18,20 @@ index b552421..8617474 100644 if (this.onGround) { @@ -101,6 +102,7 @@ public class EntityFallingBlock extends Entity { } - this.world.setTypeIdAndData(i, j, k, this.id, this.data, 3); + this.world.setTypeAndData(i, j, k, this.id, this.data, 3); // CraftBukkit end + world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot - if (Block.byId[this.id] instanceof BlockSand) { - ((BlockSand) Block.byId[this.id]).a_(this.world, i, j, k, this.data); + if (this.id instanceof BlockFalling) { + ((BlockFalling) this.id).a(this.world, i, j, k, this.data); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 758d447..1d1c88c 100644 +index 39e5b5b..d2587c1 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -240,6 +240,7 @@ public class Explosion { +@@ -239,6 +239,7 @@ public class Explosion { j = chunkposition.y; k = chunkposition.z; - l = this.world.getTypeId(i, j, k); + block = this.world.getType(i, j, k); + world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot if (flag) { double d0 = (double) ((float) i + this.world.random.nextFloat()); @@ -48,21 +48,21 @@ index fa10397..91d7feb 100644 try { this.inflatedBuffer = chunkmap.a; -diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java -index 04c44fc..a6e3be2 100644 ---- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java -+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java -@@ -28,6 +28,7 @@ public class Packet56MapChunkBulk extends Packet { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +index 3eac231..c3cfdc7 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +@@ -26,6 +26,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { } }; // CraftBukkit end + private World world; // Spigot - public Packet56MapChunkBulk() {} + public PacketPlayOutMapChunkBulk() {} -@@ -46,6 +47,9 @@ public class Packet56MapChunkBulk extends Packet { +@@ -44,6 +45,9 @@ public class PacketPlayOutMapChunkBulk extends Packet { Chunk chunk = (Chunk) list.get(k); - ChunkMap chunkmap = Packet51MapChunk.a(chunk, true, '\uffff'); + ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff'); + // Spigot start + world = chunk.world; @@ -70,16 +70,16 @@ index 04c44fc..a6e3be2 100644 if (buildBuffer.length < j + chunkmap.a.length) { byte[] abyte = new byte[j + chunkmap.a.length]; -@@ -54,6 +58,8 @@ public class Packet56MapChunkBulk extends Packet { +@@ -52,6 +56,8 @@ public class PacketPlayOutMapChunkBulk extends Packet { } System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length); + */ + // Spigot end j += chunkmap.a.length; - this.c[k] = chunk.x; - this.d[k] = chunk.z; -@@ -81,6 +87,22 @@ public class Packet56MapChunkBulk extends Packet { + this.a[k] = chunk.locX; + this.b[k] = chunk.locZ; +@@ -79,6 +85,22 @@ public class PacketPlayOutMapChunkBulk extends Packet { if (this.buffer != null) { return; } @@ -103,11 +103,11 @@ index 04c44fc..a6e3be2 100644 Deflater deflater = localDeflater.get(); deflater.reset(); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 16420e4..db2e2a7 100644 +index 3028404..e24d4b5 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -184,6 +184,7 @@ public class PlayerInteractManager { - this.o = j1; +@@ -173,6 +173,7 @@ public class PlayerInteractManager { + this.o = i1; } } + world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot @@ -115,17 +115,17 @@ index 16420e4..db2e2a7 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 3143d6e..48fbd2b 100644 +index b1f294d..2e03b42 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -482,6 +482,7 @@ public abstract class World implements IBlockAccess { - this.g(i, j + 1, k, l); - this.g(i, j, k - 1, l); - this.g(i, j, k + 1, l); +@@ -464,6 +464,7 @@ public abstract class World implements IBlockAccess { + this.e(i, j + 1, k, block); + this.e(i, j, k - 1, block); + this.e(i, j, k + 1, block); + spigotConfig.antiXrayInstance.updateNearbyBlocks(this, i, j, k); // Spigot } - public void c(int i, int j, int k, int l, int i1) { + public void b(int i, int j, int k, Block block, int l) { diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java new file mode 100644 index 0000000..c165304 diff --git a/CraftBukkit-Patches/0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch b/CraftBukkit-Patches/0018-Fix-Mob-Spawning-Relative-to-View-Distance.patch similarity index 94% rename from CraftBukkit-Patches/0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch rename to CraftBukkit-Patches/0018-Fix-Mob-Spawning-Relative-to-View-Distance.patch index 099ea4925..7bf1dc94b 100644 --- a/CraftBukkit-Patches/0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch +++ b/CraftBukkit-Patches/0018-Fix-Mob-Spawning-Relative-to-View-Distance.patch @@ -1,24 +1,24 @@ -From 774f4afb154aafc002d1bd87843b2cafafeea32f Mon Sep 17 00:00:00 2001 +From 01e36b7b71f41815e86bc7c29f9878559c6ca756 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 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 5b13dea..c353b29 100644 +index 95b4704..3bcca91 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -33,6 +33,7 @@ public class Chunk { - public int p; - public long q; - private int u; +@@ -40,6 +40,7 @@ public class Chunk { + public int r; + public long s; + private int x; + protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot public Chunk(World world, int i, int j) { this.sections = new ChunkSection[16]; -@@ -552,6 +553,22 @@ public class Chunk { - entity.ak = k; - entity.al = this.z; +@@ -601,6 +602,22 @@ public class Chunk { + entity.aj = k; + entity.ak = this.locZ; this.entitySlices[k].add(entity); + // Spigot start - increment creature type count + // Keep this synced up with World.a(Class) @@ -39,7 +39,7 @@ index 5b13dea..c353b29 100644 } public void b(Entity entity) { -@@ -568,6 +585,22 @@ public class Chunk { +@@ -617,6 +634,22 @@ public class Chunk { } this.entitySlices[i].remove(entity); @@ -63,7 +63,7 @@ index 5b13dea..c353b29 100644 public boolean d(int i, int j, int k) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 9812538..ecf13aa 100644 +index f514b78..3f0dd70 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -27,6 +27,23 @@ public final class SpawnerCreature { @@ -131,7 +131,7 @@ index 9812538..ecf13aa 100644 + continue label110; + } + // Spigot end - if (j2 >= entityinsentient.bv()) { + if (j2 >= entityinsentient.bz()) { continue label110; } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -151,5 +151,5 @@ index bab9d8f..9f95452 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0020-Handle-Null-Tile-Entities.patch b/CraftBukkit-Patches/0019-Handle-Null-Tile-Entities.patch similarity index 86% rename from CraftBukkit-Patches/0020-Handle-Null-Tile-Entities.patch rename to CraftBukkit-Patches/0019-Handle-Null-Tile-Entities.patch index 26326b10d..622f56eb1 100644 --- a/CraftBukkit-Patches/0020-Handle-Null-Tile-Entities.patch +++ b/CraftBukkit-Patches/0019-Handle-Null-Tile-Entities.patch @@ -1,14 +1,14 @@ -From 68c93664b0745e9249dafc95a562c0db1f8199d9 Mon Sep 17 00:00:00 2001 +From 05fb18bad02b47254f06de1d117946b509454305 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 3 Feb 2013 09:20:19 +1100 Subject: [PATCH] Handle Null Tile Entities diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 48fbd2b..805b8eb 100644 +index 2e03b42..d89ef3c 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1335,6 +1335,13 @@ public abstract class World implements IBlockAccess { +@@ -1313,6 +1313,13 @@ public abstract class World implements IBlockAccess { while (iterator.hasNext()) { TileEntity tileentity = (TileEntity) iterator.next(); diff --git a/CraftBukkit-Patches/0021-Entity-Activation-Range.patch b/CraftBukkit-Patches/0020-Entity-Activation-Range.patch similarity index 95% rename from CraftBukkit-Patches/0021-Entity-Activation-Range.patch rename to CraftBukkit-Patches/0020-Entity-Activation-Range.patch index d262b3dee..fcfe55b3d 100644 --- a/CraftBukkit-Patches/0021-Entity-Activation-Range.patch +++ b/CraftBukkit-Patches/0020-Entity-Activation-Range.patch @@ -1,4 +1,4 @@ -From 8e12cb3752d63dd7febab152ce56319e0671e9fc Mon Sep 17 00:00:00 2001 +From c501d75e14fe07c06bee42ce7781d2c873b5970b Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 3 Feb 2013 05:10:21 -0500 Subject: [PATCH] Entity Activation Range @@ -9,7 +9,7 @@ This will drastically cut down on tick timings for entities that are not in rang This change can have dramatic impact on gameplay if configured too low. Balance according to your servers desired gameplay. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index d65c123..4183297 100644 +index 0c1350e..4d573e6 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -88,7 +88,7 @@ public abstract class Entity { @@ -21,23 +21,21 @@ index d65c123..4183297 100644 public int noDamageTicks; private boolean justCreated; protected boolean fireProof; -@@ -111,8 +111,15 @@ public abstract class Entity { +@@ -111,7 +111,13 @@ public abstract class Entity { public EnumEntitySize at; public boolean valid; // CraftBukkit + // Spigot start public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot - + public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); + public final boolean defaultActivationState; + public long activatedTick = 0; + public void inactiveTick() { } + // Spigot end -+ - public Entity(World world) { - this.id = entityCount++; - this.l = 1.0D; -@@ -131,7 +138,12 @@ public abstract class Entity { + + public int getId() { + return this.id; +@@ -138,7 +144,12 @@ public abstract class Entity { this.setPosition(0.0D, 0.0D, 0.0D); if (world != null) { this.dimension = world.worldProvider.dimension; @@ -48,10 +46,10 @@ index d65c123..4183297 100644 } + // Spigot end + this.datawatcher = new DataWatcher(this); this.datawatcher.a(0, Byte.valueOf((byte) 0)); - this.datawatcher.a(1, Short.valueOf((short) 300)); diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java -index 5ba19f3..4c73a5f 100644 +index 36ed831..7ddca48 100644 --- a/src/main/java/net/minecraft/server/EntityAgeable.java +++ b/src/main/java/net/minecraft/server/EntityAgeable.java @@ -6,6 +6,31 @@ public abstract class EntityAgeable extends EntityCreature { @@ -87,12 +85,12 @@ index 5ba19f3..4c73a5f 100644 super(world); } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index c9ec78a..b1d3de8 100644 +index 4b3e5dd..3fd3de9 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -14,7 +14,7 @@ public class EntityArrow extends Entity implements IProjectile { private int f = -1; - private int g; + private Block g; private int h; - private boolean inGround; + public boolean inGround = false; // Spigot - private -> public @@ -100,7 +98,7 @@ index c9ec78a..b1d3de8 100644 public int shake; public Entity shooter; diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 16a16cf..76dfa81 100644 +index 75b1ec1..a61001d 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -78,6 +78,13 @@ public abstract class EntityLiving extends Entity { @@ -118,10 +116,10 @@ index 16a16cf..76dfa81 100644 public EntityLiving(World world) { super(world); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 805b8eb..ab1ac5e 100644 +index d89ef3c..f53e51d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1277,6 +1277,7 @@ public abstract class World implements IBlockAccess { +@@ -1255,6 +1255,7 @@ public abstract class World implements IBlockAccess { this.f.clear(); this.methodProfiler.c("regular"); @@ -129,22 +127,19 @@ index 805b8eb..ab1ac5e 100644 timings.entityTick.startTiming(); // Spigot for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); -@@ -1437,8 +1438,13 @@ public abstract class World implements IBlockAccess { +@@ -1415,7 +1416,11 @@ public abstract class World implements IBlockAccess { int j = MathHelper.floor(entity.locZ); byte b0 = 32; -- if (!flag || this.e(i - b0, 0, j - b0, i + b0, 0, j + b0)) { -- entity.tickTimer.startTiming(); // Spigot +- if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) { + // Spigot start + if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { + entity.ticksLived++; + entity.inactiveTick(); + } else { -+ entity.tickTimer.startTiming(); -+ // Spigot end - entity.U = entity.locX; - entity.V = entity.locY; - entity.W = entity.locZ; + entity.tickTimer.startTiming(); // Spigot + entity.T = entity.locX; + entity.U = entity.locY; diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java index 8340c13..541dfe4 100644 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java diff --git a/CraftBukkit-Patches/0022-Metrics.patch b/CraftBukkit-Patches/0021-Metrics.patch similarity index 99% rename from CraftBukkit-Patches/0022-Metrics.patch rename to CraftBukkit-Patches/0021-Metrics.patch index f5cab7e79..48b0da76d 100644 --- a/CraftBukkit-Patches/0022-Metrics.patch +++ b/CraftBukkit-Patches/0021-Metrics.patch @@ -1,4 +1,4 @@ -From 9b4f7770cae78ac23e89a6cb92bfcdac3517da6c Mon Sep 17 00:00:00 2001 +From ce4cce7fa8d4f2c732f1b0c678a87921b10d39f0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Feb 2013 08:58:35 +1100 Subject: [PATCH] Metrics @@ -657,7 +657,7 @@ index 0000000..f1690a2 +} \ No newline at end of file diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index f97a80b..b11499b 100644 +index b5d611b..6a37636 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -36,6 +36,7 @@ public class SpigotConfig @@ -688,5 +688,5 @@ index f97a80b..b11499b 100644 static void readConfig(Class clazz, Object instance) -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0024-PlayerItemDamageEvent.patch b/CraftBukkit-Patches/0022-PlayerItemDamageEvent.patch similarity index 81% rename from CraftBukkit-Patches/0024-PlayerItemDamageEvent.patch rename to CraftBukkit-Patches/0022-PlayerItemDamageEvent.patch index e09e04a7a..1f78c520d 100644 --- a/CraftBukkit-Patches/0024-PlayerItemDamageEvent.patch +++ b/CraftBukkit-Patches/0022-PlayerItemDamageEvent.patch @@ -1,15 +1,15 @@ -From 70e523db2b07a95427820829af2c9b025585dbd6 Mon Sep 17 00:00:00 2001 +From 95f1227925ed89e4582ce588573b111bfdc493cf Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 4 Mar 2013 18:45:52 +1100 Subject: [PATCH] PlayerItemDamageEvent diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 69f81ca..f3a6027 100644 +index 53c665b..123e4a5 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -178,7 +178,13 @@ public final class ItemStack { - return Item.byId[this.id].getMaxDurability(); +@@ -175,7 +175,13 @@ public final class ItemStack { + return this.item.getMaxDurability(); } + // Spigot start @@ -22,7 +22,7 @@ index 69f81ca..f3a6027 100644 if (!this.g()) { return false; } else { -@@ -193,7 +199,16 @@ public final class ItemStack { +@@ -190,7 +196,16 @@ public final class ItemStack { } i -= k; @@ -40,15 +40,15 @@ index 69f81ca..f3a6027 100644 return false; } } -@@ -206,7 +221,7 @@ public final class ItemStack { +@@ -203,7 +218,7 @@ public final class ItemStack { public void damage(int i, EntityLiving entityliving) { if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) { if (this.g()) { -- if (this.isDamaged(i, entityliving.aD())) { -+ if (this.isDamaged(i, entityliving.aD(), entityliving)) { +- if (this.isDamaged(i, entityliving.aI())) { ++ if (this.isDamaged(i, entityliving.aI(), entityliving)) { entityliving.a(this); --this.count; if (entityliving instanceof EntityHuman) { -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0025-Faster-UUID-for-entities.patch b/CraftBukkit-Patches/0023-Faster-UUID-for-entities.patch similarity index 77% rename from CraftBukkit-Patches/0025-Faster-UUID-for-entities.patch rename to CraftBukkit-Patches/0023-Faster-UUID-for-entities.patch index 781646853..c5d483161 100644 --- a/CraftBukkit-Patches/0025-Faster-UUID-for-entities.patch +++ b/CraftBukkit-Patches/0023-Faster-UUID-for-entities.patch @@ -1,4 +1,4 @@ -From 8266b2fa8f23a47ae4120d7eb37f466539187269 Mon Sep 17 00:00:00 2001 +From 1269d4ea0528dbf92fcd1b1c9c40ed2917b6a572 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 17 Mar 2013 19:02:50 +1100 Subject: [PATCH] Faster UUID for entities @@ -6,18 +6,17 @@ Subject: [PATCH] Faster UUID for entities It is overkill to create a new SecureRandom on each entity create and then use it to make a new Entity ID for every entity instance created. Instead we will just use a pseudo random UUID based off the random instance we already have. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 4183297..852dfd3 100644 +index 4d573e6..621e6c2 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -132,7 +132,7 @@ public abstract class Entity { +@@ -139,6 +139,7 @@ public abstract class Entity { this.maxFireTicks = 1; this.justCreated = true; - this.datawatcher = new DataWatcher(); -- this.uniqueID = UUID.randomUUID(); + this.uniqueID = UUID.randomUUID(); + this.uniqueID = new UUID(random.nextLong(), random.nextLong()); // Spigot this.at = EnumEntitySize.SIZE_2; this.world = world; this.setPosition(0.0D, 0.0D, 0.0D); -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0023-Netty.patch b/CraftBukkit-Patches/0023-Netty.patch deleted file mode 100644 index 29809f8d1..000000000 --- a/CraftBukkit-Patches/0023-Netty.patch +++ /dev/null @@ -1,1492 +0,0 @@ -From 37c05ef56a5463e718e6ce1dcc01b35949af4ddb Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 2 Jul 2013 09:06:29 +1000 -Subject: [PATCH] Netty - - -diff --git a/pom.xml b/pom.xml -index e165937..cc5d9da 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -114,6 +114,21 @@ - trove4j - 3.0.3 - -+ -+ io.netty -+ netty-codec -+ 4.0.9.Final -+ -+ -+ io.netty -+ netty-handler -+ 4.0.9.Final -+ -+ -+ org.javassist -+ javassist -+ 3.18.0-GA -+ - - - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0cca057..4759f6a 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -101,7 +101,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - this.getLogger().info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.I()); - - try { -- this.s = new DedicatedServerConnection(this, inetaddress, this.I()); -+ // Spigot start -+ this.s = ( org.spigotmc.SpigotConfig.listeners.get( 0 ).netty ) -+ ? new org.spigotmc.netty.NettyServerConnection( this, inetaddress, this.I() ) -+ : new DedicatedServerConnection( this, inetaddress, this.I() ); -+ // Spigot end - } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable - this.getLogger().warning("**** FAILED TO BIND TO PORT!"); - this.getLogger().warning("The exception was: {0}", new Object[] { ioexception.toString()}); -diff --git a/src/main/java/net/minecraft/server/INetworkManager.java b/src/main/java/net/minecraft/server/INetworkManager.java -new file mode 100644 -index 0000000..6fcc5d7 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/INetworkManager.java -@@ -0,0 +1,26 @@ -+package net.minecraft.server; -+ -+import java.net.SocketAddress; -+ -+public interface INetworkManager { -+ -+ void a(Connection connection); -+ -+ void queue(Packet packet); -+ -+ void a(); -+ -+ void b(); -+ -+ SocketAddress getSocketAddress(); -+ -+ void d(); -+ -+ int e(); -+ -+ void a(String s, Object... aobject); -+ -+ java.net.Socket getSocket(); // Spigot -+ -+ void setSocketAddress(java.net.SocketAddress address); // Spigot -+} -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index a2bdfa3..fd6acab 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -27,7 +27,7 @@ public class NetworkManager implements INetworkManager { - private final Object h = new Object(); - private final IConsoleLogManager i; - public Socket socket; // CraftBukkit - private -> public -- private final SocketAddress k; -+ private SocketAddress k; // Spigot - remove final - private volatile DataInputStream input; - private volatile DataOutputStream output; - private volatile boolean n = true; -@@ -374,4 +374,6 @@ public class NetworkManager implements INetworkManager { - static Thread h(NetworkManager networkmanager) { - return networkmanager.u; - } -+ -+ public void setSocketAddress(SocketAddress address) { k = address; } // Spigot - } -diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java -index 2a96168..6ffc927 100644 ---- a/src/main/java/net/minecraft/server/PendingConnection.java -+++ b/src/main/java/net/minecraft/server/PendingConnection.java -@@ -16,7 +16,7 @@ public class PendingConnection extends Connection { - private static Random random = new Random(); - private byte[] d; - private final MinecraftServer server; -- public final NetworkManager networkManager; -+ public final INetworkManager networkManager; - public boolean b; - private int f; - private String g; -@@ -26,10 +26,15 @@ public class PendingConnection extends Connection { - private SecretKey k; - public String hostname = ""; // CraftBukkit - add field - -+ public PendingConnection(MinecraftServer minecraftserver, org.spigotmc.netty.NettyNetworkManager networkManager) { -+ this.server = minecraftserver; -+ this.networkManager = networkManager; -+ } -+ - public PendingConnection(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException - this.server = minecraftserver; - this.networkManager = new NetworkManager(minecraftserver.getLogger(), socket, s, this, minecraftserver.H().getPrivate()); -- this.networkManager.e = 0; -+ // this.networkManager.e = 0; - } - - // CraftBukkit start -@@ -148,7 +153,7 @@ public class PendingConnection extends Connection { - String s = null; - // CraftBukkit - org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers()); -- if (packet254getinfo.d()) { -+ if (false) { // Spigot: TODO: Use trick from Bungee maybe? - // CraftBukkit - s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers(); - } else { -@@ -177,9 +182,18 @@ public class PendingConnection extends Connection { - - this.networkManager.queue(new Packet255KickDisconnect(s)); - this.networkManager.d(); -- if (inetaddress != null && this.server.ag() instanceof DedicatedServerConnection) { -- ((DedicatedServerConnection) this.server.ag()).a(inetaddress); -+ // Spigot start -+ if ( inetaddress != null ) -+ { -+ if ( this.server.ag() instanceof DedicatedServerConnection ) -+ { -+ ((DedicatedServerConnection) this.server.ag()).a(inetaddress); -+ } else -+ { -+ ((org.spigotmc.netty.NettyServerConnection)this.server.ag()).unThrottle( inetaddress ); -+ } - } -+ // Spigot end - - this.b = true; - } catch (Exception exception) { -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 8ef108d..637fcf2 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -6,6 +6,8 @@ import java.io.IOException; - import java.lang.reflect.InvocationTargetException; - import java.lang.reflect.Method; - import java.lang.reflect.Modifier; -+import java.util.ArrayList; -+import java.util.Collections; - import java.util.HashMap; - import java.util.List; - import java.util.Map; -@@ -142,4 +144,62 @@ public class SpigotConfig - { - commands.put( "tps", new TicksPerSecondCommand( "tps" ) ); - } -+ -+ public static class Listener -+ { -+ -+ public String host; -+ public int port; -+ public boolean netty; -+ public long connectionThrottle; -+ -+ public Listener(String host, int port, boolean netty, long connectionThrottle) -+ { -+ this.host = host; -+ this.port = port; -+ this.netty = netty; -+ this.connectionThrottle = connectionThrottle; -+ } -+ } -+ public static List listeners = new ArrayList(); -+ public static int nettyThreads; -+ private static void listeners() -+ { -+ listeners.clear(); // We don't rebuild listeners on reload but we should clear them out! -+ -+ Map def = new HashMap(); -+ def.put( "host", "default" ); -+ def.put( "port", "default" ); -+ def.put( "netty", true ); -+ // def.put( "throttle", "default" ); -+ -+ config.addDefault( "listeners", Collections.singletonList( def ) ); -+ for ( Map info : (List>) config.getList( "listeners" ) ) -+ { -+ String host = (String) info.get( "host" ); -+ if ( "default".equals( host ) ) -+ { -+ host = Bukkit.getIp(); -+ } else -+ { -+ throw new IllegalArgumentException( "Can only bind listener to default! Configure it in server.properties" ); -+ } -+ int port ; -+ -+ if (info.get( "port" ) instanceof Integer){ -+ throw new IllegalArgumentException( "Can only bind port to default! Configure it in server.properties"); -+ } else{ -+ port = Bukkit.getPort(); -+ } -+ boolean netty = (Boolean) info.get( "netty" ); -+ // long connectionThrottle = ( info.get( "throttle" ) instanceof Number ) ? ( (Number) info.get( "throttle" ) ).longValue() : Bukkit.getConnectionThrottle(); -+ listeners.add( new Listener( host, port, netty, Bukkit.getConnectionThrottle() ) ); -+ } -+ if ( listeners.size() != 1 ) -+ { -+ throw new IllegalArgumentException( "May only have one listener!" ); -+ } -+ -+ nettyThreads = getInt( "settings.netty-threads", 3 ); -+ } - } -diff --git a/src/main/java/org/spigotmc/netty/CipherBase.java b/src/main/java/org/spigotmc/netty/CipherBase.java -new file mode 100644 -index 0000000..c4306f7 ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/CipherBase.java -@@ -0,0 +1,73 @@ -+package org.spigotmc.netty; -+ -+import io.netty.buffer.ByteBuf; -+import io.netty.channel.ChannelHandlerContext; -+import javax.crypto.Cipher; -+import javax.crypto.ShortBufferException; -+ -+/** -+ * Class to expose an -+ * {@link #cipher(io.netty.buffer.ByteBuf, io.netty.buffer.ByteBuf)} method to -+ * aid in the efficient passing of ByteBuffers through a cipher. -+ */ -+class CipherBase -+{ -+ -+ private final Cipher cipher; -+ private ThreadLocal heapInLocal = new EmptyByteThreadLocal(); -+ private ThreadLocal heapOutLocal = new EmptyByteThreadLocal(); -+ -+ private static class EmptyByteThreadLocal extends ThreadLocal -+ { -+ -+ @Override -+ protected byte[] initialValue() -+ { -+ return new byte[ 0 ]; -+ } -+ } -+ -+ protected CipherBase(Cipher cipher) -+ { -+ this.cipher = cipher; -+ } -+ -+ private byte[] bufToByte(ByteBuf in) -+ { -+ byte[] heapIn = heapInLocal.get(); -+ int readableBytes = in.readableBytes(); -+ if ( heapIn.length < readableBytes ) -+ { -+ heapIn = new byte[ readableBytes ]; -+ heapInLocal.set( heapIn ); -+ } -+ in.readBytes( heapIn, 0, readableBytes ); -+ return heapIn; -+ } -+ -+ protected ByteBuf cipher(ChannelHandlerContext ctx, ByteBuf in) throws ShortBufferException -+ { -+ int readableBytes = in.readableBytes(); -+ byte[] heapIn = bufToByte( in ); -+ -+ ByteBuf heapOut = ctx.alloc().heapBuffer( cipher.getOutputSize( readableBytes ) ); -+ heapOut.writerIndex( cipher.update( heapIn, 0, readableBytes, heapOut.array(), heapOut.arrayOffset() ) ); -+ -+ return heapOut; -+ } -+ -+ protected void cipher(ByteBuf in, ByteBuf out) throws ShortBufferException -+ { -+ int readableBytes = in.readableBytes(); -+ byte[] heapIn = bufToByte( in ); -+ -+ byte[] heapOut = heapOutLocal.get(); -+ int outputSize = cipher.getOutputSize( readableBytes ); -+ if ( heapOut.length < outputSize ) -+ { -+ heapOut = new byte[ outputSize ]; -+ heapOutLocal.set( heapOut ); -+ } -+ out.writeBytes( heapOut, 0, cipher.update( heapIn, 0, readableBytes, heapOut ) ); -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/CipherDecoder.java b/src/main/java/org/spigotmc/netty/CipherDecoder.java -new file mode 100644 -index 0000000..e37bae7 ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/CipherDecoder.java -@@ -0,0 +1,24 @@ -+package org.spigotmc.netty; -+ -+import io.netty.buffer.ByteBuf; -+import io.netty.channel.ChannelHandlerContext; -+import io.netty.handler.codec.MessageToMessageDecoder; -+import java.util.List; -+import javax.crypto.Cipher; -+ -+public class CipherDecoder extends MessageToMessageDecoder -+{ -+ -+ private final CipherBase cipher; -+ -+ public CipherDecoder(Cipher cipher) -+ { -+ this.cipher = new CipherBase( cipher ); -+ } -+ -+ @Override -+ protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List out) throws Exception -+ { -+ out.add( cipher.cipher( ctx, msg ) ); -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/CipherEncoder.java b/src/main/java/org/spigotmc/netty/CipherEncoder.java -new file mode 100644 -index 0000000..2eb1dcb ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/CipherEncoder.java -@@ -0,0 +1,23 @@ -+package org.spigotmc.netty; -+ -+import io.netty.buffer.ByteBuf; -+import io.netty.channel.ChannelHandlerContext; -+import io.netty.handler.codec.MessageToByteEncoder; -+import javax.crypto.Cipher; -+ -+public class CipherEncoder extends MessageToByteEncoder -+{ -+ -+ private final CipherBase cipher; -+ -+ public CipherEncoder(Cipher cipher) -+ { -+ this.cipher = new CipherBase( cipher ); -+ } -+ -+ @Override -+ protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception -+ { -+ cipher.cipher( in, out ); -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/NettyNetworkManager.java b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java -new file mode 100644 -index 0000000..7dc16ac ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/NettyNetworkManager.java -@@ -0,0 +1,307 @@ -+package org.spigotmc.netty; -+ -+import com.google.common.util.concurrent.ThreadFactoryBuilder; -+import io.netty.channel.Channel; -+import io.netty.channel.ChannelHandlerContext; -+import io.netty.channel.SimpleChannelInboundHandler; -+import io.netty.channel.socket.SocketChannel; -+import java.net.Socket; -+import java.net.SocketAddress; -+import java.security.PrivateKey; -+import java.util.AbstractList; -+import java.util.List; -+import java.util.Queue; -+import java.util.concurrent.ConcurrentLinkedQueue; -+import java.util.concurrent.ExecutorService; -+import java.util.concurrent.Executors; -+import javax.crypto.Cipher; -+import javax.crypto.SecretKey; -+import net.minecraft.server.Connection; -+import net.minecraft.server.INetworkManager; -+import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.Packet; -+import net.minecraft.server.Packet252KeyResponse; -+import net.minecraft.server.Packet255KickDisconnect; -+import net.minecraft.server.PendingConnection; -+import net.minecraft.server.PlayerConnection; -+ -+/** -+ * This class forms the basis of the Netty integration. It implements -+ * {@link INetworkManager} and handles all events and inbound messages provided -+ * by the upstream Netty process. -+ */ -+public class NettyNetworkManager extends SimpleChannelInboundHandler implements INetworkManager -+{ -+ -+ private static final ExecutorService threadPool = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat( "Async Packet Handler - %1$d" ).build() ); -+ private static final MinecraftServer server = MinecraftServer.getServer(); -+ private static final PrivateKey key = server.H().getPrivate(); -+ private static final NettyServerConnection serverConnection = (NettyServerConnection) server.ag(); -+ /*========================================================================*/ -+ private final Queue syncPackets = new ConcurrentLinkedQueue(); -+ private final List highPriorityQueue = new AbstractList() -+ { -+ @Override -+ public void add(int index, Packet element) -+ { -+ // NOP -+ } -+ -+ @Override -+ public Packet get(int index) -+ { -+ throw new UnsupportedOperationException(); -+ } -+ -+ @Override -+ public int size() -+ { -+ return 0; -+ } -+ }; -+ private volatile boolean connected; -+ private Channel channel; -+ private SocketAddress address; -+ Connection connection; -+ private SecretKey secret; -+ private String dcReason; -+ private Object[] dcArgs; -+ private Socket socketAdaptor; -+ private long writtenBytes; -+ private PacketWriter writer; -+ -+ @Override -+ public void channelActive(ChannelHandlerContext ctx) throws Exception -+ { -+ // Channel and address groundwork first -+ channel = ctx.channel(); -+ address = channel.remoteAddress(); -+ // Then the socket adaptor -+ socketAdaptor = NettySocketAdaptor.adapt( (SocketChannel) channel ); -+ // Followed by their first handler -+ connection = new PendingConnection( server, this ); -+ writer = new PacketWriter(); -+ // Finally register the connection -+ connected = true; -+ serverConnection.register( (PendingConnection) connection ); -+ } -+ -+ @Override -+ public void channelInactive(ChannelHandlerContext ctx) throws Exception -+ { -+ a( "disconnect.endOfStream", new Object[ 0 ] ); -+ } -+ -+ @Override -+ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception -+ { -+ // TODO: Remove this once we are more stable -+ // Bukkit.getServer().getLogger().severe("======================= Start Netty Debug Log ======================="); -+ // Bukkit.getServer().getLogger().log(Level.SEVERE, "Error caught whilst handling " + channel, cause); -+ // Bukkit.getServer().getLogger().severe("======================= End Netty Debug Log ======================="); -+ // Disconnect with generic reason + exception -+ a( "disconnect.genericReason", new Object[] -+ { -+ "Internal exception: " + cause -+ } ); -+ } -+ -+ @Override -+ protected void channelRead0(ChannelHandlerContext ctx, final Packet msg) throws Exception -+ { -+ if ( connected ) -+ { -+ if ( msg instanceof Packet252KeyResponse ) -+ { -+ secret = ( (Packet252KeyResponse) msg ).a( key ); -+ Cipher decrypt = NettyServerConnection.getCipher( Cipher.DECRYPT_MODE, secret ); -+ channel.pipeline().addBefore( "decoder", "decrypt", new CipherDecoder( decrypt ) ); -+ } -+ -+ if ( msg.a_() ) -+ { -+ threadPool.submit( new Runnable() -+ { -+ public void run() -+ { -+ Packet packet = PacketListener.callReceived( NettyNetworkManager.this, connection, msg ); -+ if ( packet != null ) -+ { -+ packet.handle( connection ); -+ } -+ } -+ } ); -+ } else -+ { -+ syncPackets.add( msg ); -+ } -+ } -+ } -+ -+ public Socket getSocket() -+ { -+ return socketAdaptor; -+ } -+ -+ /** -+ * setHandler. Set the {@link NetHandler} used to process received packets. -+ * -+ * @param nh the new {@link NetHandler} instance -+ */ -+ public void a(Connection nh) -+ { -+ connection = nh; -+ } -+ -+ /** -+ * queue. Queue a packet for sending, or in this case send it to be write it -+ * straight to the channel. -+ * -+ * @param packet the packet to queue -+ */ -+ public void queue(final Packet packet) -+ { -+ // Only send if channel is still connected -+ if ( connected ) -+ { -+ // Process packet via handler -+ final Packet packet0 = PacketListener.callQueued( this, connection, packet ); -+ highPriorityQueue.add( packet0 ); -+ // If handler indicates packet send -+ if ( packet0 != null ) -+ { -+ if ( channel.eventLoop().inEventLoop() ) -+ { -+ queue0( packet0 ); -+ } else -+ { -+ channel.eventLoop().execute( new Runnable() -+ { -+ public void run() -+ { -+ queue0( packet0 ); -+ } -+ } ); -+ } -+ } -+ } -+ } -+ -+ private void queue0(Packet packet) -+ { -+ if ( packet instanceof Packet255KickDisconnect ) -+ { -+ writer.lastFlush = 0; -+ } -+ -+ writer.write( channel, this, packet ); -+ if ( packet instanceof Packet252KeyResponse ) -+ { -+ Cipher encrypt = NettyServerConnection.getCipher( Cipher.ENCRYPT_MODE, secret ); -+ channel.pipeline().addBefore( "decoder", "encrypt", new CipherEncoder( encrypt ) ); -+ } -+ } -+ -+ /** -+ * wakeThreads. In Vanilla this method will interrupt the network read and -+ * write threads, thus waking them. -+ */ -+ public void a() -+ { -+ } -+ -+ /** -+ * processPackets. Remove up to 1000 packets from the queue and process -+ * them. This method should only be called from the main server thread. -+ */ -+ public void b() -+ { -+ for ( int i = 1000; !syncPackets.isEmpty() && i >= 0; i-- ) -+ { -+ if ( connection instanceof PendingConnection ? ( (PendingConnection) connection ).b : ( (PlayerConnection) connection ).disconnected ) -+ { -+ syncPackets.clear(); -+ break; -+ } -+ -+ Packet packet = PacketListener.callReceived( this, connection, syncPackets.poll() ); -+ if ( packet != null ) -+ { -+ packet.handle( connection ); -+ } -+ } -+ -+ // Disconnect via the handler - this performs all plugin related cleanup + logging -+ if ( !connected && ( dcReason != null || dcArgs != null ) ) -+ { -+ connection.a( dcReason, dcArgs ); -+ } -+ } -+ -+ /** -+ * getSocketAddress. Return the remote address of the connected user. It is -+ * important that this method returns a value even after disconnect. -+ * -+ * @return the remote address of this connection -+ */ -+ public SocketAddress getSocketAddress() -+ { -+ return address; -+ } -+ -+ public void setSocketAddress(SocketAddress address) -+ { -+ this.address = address; -+ } -+ -+ /** -+ * close. Close and release all resources associated with this connection. -+ */ -+ public void d() -+ { -+ if ( connected ) -+ { -+ connected = false; -+ channel.close(); -+ } -+ } -+ -+ /** -+ * queueSize. Return the number of packets in the low priority queue. In a -+ * NIO environment this will always be 0. -+ * -+ * @return the size of the packet send queue -+ */ -+ public int e() -+ { -+ return 0; -+ } -+ -+ /** -+ * networkShutdown. Shuts down this connection, storing the reason and -+ * parameters, used to notify the current {@link Connection}. -+ * -+ * @param reason the main disconnect reason -+ * @param arguments additional disconnect arguments, for example, the -+ * exception which triggered the disconnect. -+ */ -+ public void a(String reason, Object... arguments) -+ { -+ if ( connected ) -+ { -+ dcReason = reason; -+ dcArgs = arguments; -+ d(); -+ } -+ } -+ -+ public long getWrittenBytes() -+ { -+ return writtenBytes; -+ } -+ -+ public void addWrittenBytes(int written) -+ { -+ writtenBytes += written; -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/NettyServerConnection.java b/src/main/java/org/spigotmc/netty/NettyServerConnection.java -new file mode 100644 -index 0000000..7e5671d ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/NettyServerConnection.java -@@ -0,0 +1,177 @@ -+package org.spigotmc.netty; -+ -+import com.google.common.util.concurrent.ThreadFactoryBuilder; -+import io.netty.bootstrap.ServerBootstrap; -+import io.netty.channel.Channel; -+import io.netty.channel.ChannelException; -+import io.netty.channel.ChannelFuture; -+import io.netty.channel.ChannelInitializer; -+import io.netty.channel.ChannelOption; -+import io.netty.channel.EventLoopGroup; -+import io.netty.channel.nio.NioEventLoopGroup; -+import io.netty.channel.socket.nio.NioServerSocketChannel; -+import io.netty.handler.timeout.ReadTimeoutHandler; -+import java.net.InetAddress; -+import java.net.InetSocketAddress; -+import java.security.GeneralSecurityException; -+import java.security.Key; -+import java.util.ArrayList; -+import java.util.Collections; -+import java.util.HashMap; -+import java.util.List; -+import java.util.Map; -+import java.util.logging.Level; -+import javax.crypto.Cipher; -+import javax.crypto.spec.IvParameterSpec; -+import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.PendingConnection; -+import net.minecraft.server.ServerConnection; -+import org.bukkit.Bukkit; -+import org.spigotmc.SpigotConfig; -+ -+/** -+ * This is the NettyServerConnection class. It implements -+ * {@link ServerConnection} and is the main interface between the Minecraft -+ * server and this NIO implementation. It handles starting, stopping and -+ * processing the Netty backend. -+ */ -+public class NettyServerConnection extends ServerConnection -+{ -+ -+ private final ChannelFuture socket; -+ private static EventLoopGroup group; -+ private final Map throttle = new HashMap(); -+ private final List pending = Collections.synchronizedList( new ArrayList() ); -+ -+ public void unThrottle(InetAddress address) -+ { -+ if ( address != null ) -+ { -+ synchronized ( throttle ) -+ { -+ throttle.remove( address ); -+ } -+ } -+ } -+ -+ public boolean throttle(InetAddress address) -+ { -+ long currentTime = System.currentTimeMillis(); -+ synchronized ( throttle ) -+ { -+ Long value = throttle.get( address ); -+ if ( value != null && !address.isLoopbackAddress() && currentTime - value < d().server.getConnectionThrottle() ) -+ { -+ throttle.put( address, currentTime ); -+ return true; -+ } -+ -+ throttle.put( address, currentTime ); -+ } -+ return false; -+ } -+ -+ public NettyServerConnection(final MinecraftServer ms, InetAddress host, int port) -+ { -+ super( ms ); -+ if ( group == null ) -+ { -+ group = new NioEventLoopGroup( SpigotConfig.nettyThreads, new ThreadFactoryBuilder().setNameFormat( "Netty IO Thread - %1$d" ).build() ); -+ } -+ -+ socket = new ServerBootstrap().channel( NioServerSocketChannel.class ).childHandler( new ChannelInitializer() -+ { -+ @Override -+ public void initChannel(Channel ch) throws Exception -+ { -+ // Check the throttle -+ if ( throttle( ( (InetSocketAddress) ch.remoteAddress() ).getAddress() ) ) -+ { -+ ch.close(); -+ return; -+ } -+ // Set IP_TOS -+ try -+ { -+ ch.config().setOption( ChannelOption.IP_TOS, 0x18 ); -+ } catch ( ChannelException ex ) -+ { -+ // IP_TOS is not supported (Windows XP / Windows Server 2003) -+ } -+ try -+ { -+ ch.config().setOption( ChannelOption.TCP_NODELAY, false ); -+ } catch ( ChannelException ex ) -+ { -+ // TCP_NODELAY is not supported (Mac) -+ } -+ -+ NettyNetworkManager networkManager = new NettyNetworkManager(); -+ ch.pipeline() -+ .addLast( "timer", new ReadTimeoutHandler( 30 ) ) -+ .addLast( "decoder", new PacketDecoder() ) -+ .addLast( "manager", networkManager ); -+ } -+ } ).group( group ).localAddress( host, port ).bind().syncUninterruptibly(); -+ } -+ -+ /** -+ * Shutdown. This method is called when the server is shutting down and the -+ * server socket and all clients should be terminated with no further -+ * action. -+ */ -+ @Override -+ public void a() -+ { -+ socket.channel().close().syncUninterruptibly(); -+ } -+ -+ @Override -+ public void b() -+ { -+ super.b(); // pulse PlayerConnections -+ for ( int i = 0; i < pending.size(); ++i ) -+ { -+ PendingConnection connection = pending.get( i ); -+ -+ try -+ { -+ connection.d(); -+ } catch ( Exception ex ) -+ { -+ connection.disconnect( "Internal server error" ); -+ Bukkit.getServer().getLogger().log( Level.WARNING, "Failed to handle packet: " + ex, ex ); -+ } -+ -+ if ( connection.b ) -+ { -+ pending.remove( i-- ); -+ } -+ } -+ } -+ -+ public void register(PendingConnection conn) -+ { -+ pending.add( conn ); -+ } -+ -+ /** -+ * Return a Minecraft compatible cipher instance from the specified key. -+ * -+ * @param opMode the mode to initialize the cipher in -+ * @param key to use as the initial vector -+ * @return the initialized cipher -+ */ -+ public static Cipher getCipher(int opMode, Key key) -+ { -+ try -+ { -+ Cipher cip = Cipher.getInstance( "AES/CFB8/NoPadding" ); -+ cip.init( opMode, key, new IvParameterSpec( key.getEncoded() ) ); -+ return cip; -+ } catch ( GeneralSecurityException ex ) -+ { -+ throw new RuntimeException( ex ); -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/NettySocketAdaptor.java b/src/main/java/org/spigotmc/netty/NettySocketAdaptor.java -new file mode 100644 -index 0000000..5da8a59 ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/NettySocketAdaptor.java -@@ -0,0 +1,294 @@ -+package org.spigotmc.netty; -+ -+import io.netty.channel.Channel; -+import io.netty.channel.ChannelOption; -+import java.io.IOException; -+import java.io.InputStream; -+import java.io.OutputStream; -+import java.net.InetAddress; -+import java.net.Socket; -+import java.net.SocketAddress; -+import java.net.SocketException; -+import java.nio.channels.SocketChannel; -+ -+/** -+ * This class wraps a Netty {@link Channel} in a {@link Socket}. It overrides -+ * all methods in {@link Socket} to ensure that calls are not mistakingly made -+ * to the unsupported super socket. All operations that can be sanely applied to -+ * a {@link Channel} are implemented here. Those which cannot will throw an -+ * {@link UnsupportedOperationException}. -+ */ -+public class NettySocketAdaptor extends Socket -+{ -+ -+ private final io.netty.channel.socket.SocketChannel ch; -+ -+ private NettySocketAdaptor(io.netty.channel.socket.SocketChannel ch) -+ { -+ this.ch = ch; -+ } -+ -+ public static NettySocketAdaptor adapt(io.netty.channel.socket.SocketChannel ch) -+ { -+ return new NettySocketAdaptor( ch ); -+ } -+ -+ @Override -+ public void bind(SocketAddress bindpoint) throws IOException -+ { -+ ch.bind( bindpoint ).syncUninterruptibly(); -+ } -+ -+ @Override -+ public synchronized void close() throws IOException -+ { -+ ch.close().syncUninterruptibly(); -+ } -+ -+ @Override -+ public void connect(SocketAddress endpoint) throws IOException -+ { -+ ch.connect( endpoint ).syncUninterruptibly(); -+ } -+ -+ @Override -+ public void connect(SocketAddress endpoint, int timeout) throws IOException -+ { -+ ch.config().setConnectTimeoutMillis( timeout ); -+ ch.connect( endpoint ).syncUninterruptibly(); -+ } -+ -+ @Override -+ public boolean equals(Object obj) -+ { -+ return obj instanceof NettySocketAdaptor && ch.equals( ( (NettySocketAdaptor) obj ).ch ); -+ } -+ -+ @Override -+ public SocketChannel getChannel() -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public InetAddress getInetAddress() -+ { -+ return ch.remoteAddress().getAddress(); -+ } -+ -+ @Override -+ public InputStream getInputStream() throws IOException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public boolean getKeepAlive() throws SocketException -+ { -+ return ch.config().getOption( ChannelOption.SO_KEEPALIVE ); -+ } -+ -+ @Override -+ public InetAddress getLocalAddress() -+ { -+ return ch.localAddress().getAddress(); -+ } -+ -+ @Override -+ public int getLocalPort() -+ { -+ return ch.localAddress().getPort(); -+ } -+ -+ @Override -+ public SocketAddress getLocalSocketAddress() -+ { -+ return ch.localAddress(); -+ } -+ -+ @Override -+ public boolean getOOBInline() throws SocketException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public OutputStream getOutputStream() throws IOException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public int getPort() -+ { -+ return ch.remoteAddress().getPort(); -+ } -+ -+ @Override -+ public synchronized int getReceiveBufferSize() throws SocketException -+ { -+ return ch.config().getOption( ChannelOption.SO_RCVBUF ); -+ } -+ -+ @Override -+ public SocketAddress getRemoteSocketAddress() -+ { -+ return ch.remoteAddress(); -+ } -+ -+ @Override -+ public boolean getReuseAddress() throws SocketException -+ { -+ return ch.config().getOption( ChannelOption.SO_REUSEADDR ); -+ } -+ -+ @Override -+ public synchronized int getSendBufferSize() throws SocketException -+ { -+ return ch.config().getOption( ChannelOption.SO_SNDBUF ); -+ } -+ -+ @Override -+ public int getSoLinger() throws SocketException -+ { -+ return ch.config().getOption( ChannelOption.SO_LINGER ); -+ } -+ -+ @Override -+ public synchronized int getSoTimeout() throws SocketException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public boolean getTcpNoDelay() throws SocketException -+ { -+ return ch.config().getOption( ChannelOption.TCP_NODELAY ); -+ } -+ -+ @Override -+ public int getTrafficClass() throws SocketException -+ { -+ return ch.config().getOption( ChannelOption.IP_TOS ); -+ } -+ -+ @Override -+ public int hashCode() -+ { -+ return ch.hashCode(); -+ } -+ -+ @Override -+ public boolean isBound() -+ { -+ return ch.localAddress() != null; -+ } -+ -+ @Override -+ public boolean isClosed() -+ { -+ return !ch.isOpen(); -+ } -+ -+ @Override -+ public boolean isConnected() -+ { -+ return ch.isActive(); -+ } -+ -+ @Override -+ public boolean isInputShutdown() -+ { -+ return ch.isInputShutdown(); -+ } -+ -+ @Override -+ public boolean isOutputShutdown() -+ { -+ return ch.isOutputShutdown(); -+ } -+ -+ @Override -+ public void sendUrgentData(int data) throws IOException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public void setKeepAlive(boolean on) throws SocketException -+ { -+ ch.config().setOption( ChannelOption.SO_KEEPALIVE, on ); -+ } -+ -+ @Override -+ public void setOOBInline(boolean on) throws SocketException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public synchronized void setReceiveBufferSize(int size) throws SocketException -+ { -+ ch.config().setOption( ChannelOption.SO_RCVBUF, size ); -+ } -+ -+ @Override -+ public void setReuseAddress(boolean on) throws SocketException -+ { -+ ch.config().setOption( ChannelOption.SO_REUSEADDR, on ); -+ } -+ -+ @Override -+ public synchronized void setSendBufferSize(int size) throws SocketException -+ { -+ ch.config().setOption( ChannelOption.SO_SNDBUF, size ); -+ } -+ -+ @Override -+ public void setSoLinger(boolean on, int linger) throws SocketException -+ { -+ ch.config().setOption( ChannelOption.SO_LINGER, linger ); -+ } -+ -+ @Override -+ public synchronized void setSoTimeout(int timeout) throws SocketException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public void setTcpNoDelay(boolean on) throws SocketException -+ { -+ ch.config().setOption( ChannelOption.TCP_NODELAY, on ); -+ } -+ -+ @Override -+ public void setTrafficClass(int tc) throws SocketException -+ { -+ ch.config().setOption( ChannelOption.IP_TOS, tc ); -+ } -+ -+ @Override -+ public void shutdownInput() throws IOException -+ { -+ throw new UnsupportedOperationException( "Operation not supported on Channel wrapper." ); -+ } -+ -+ @Override -+ public void shutdownOutput() throws IOException -+ { -+ ch.shutdownOutput().syncUninterruptibly(); -+ } -+ -+ @Override -+ public String toString() -+ { -+ return ch.toString(); -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/PacketDecoder.java b/src/main/java/org/spigotmc/netty/PacketDecoder.java -new file mode 100644 -index 0000000..7e43b14 ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/PacketDecoder.java -@@ -0,0 +1,80 @@ -+package org.spigotmc.netty; -+ -+import io.netty.buffer.ByteBuf; -+import io.netty.buffer.ByteBufInputStream; -+import io.netty.channel.ChannelHandlerContext; -+import io.netty.handler.codec.ReplayingDecoder; -+import java.io.DataInput; -+import java.io.DataInputStream; -+import java.io.EOFException; -+import java.io.IOException; -+import java.util.List; -+import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.Packet; -+import net.minecraft.server.Packet254GetInfo; -+ -+/** -+ * Packet decoding class backed by a reusable {@link DataInputStream} which -+ * backs the input {@link ByteBuf}. Reads an unsigned byte packet header and -+ * then decodes the packet accordingly. -+ */ -+public class PacketDecoder extends ReplayingDecoder -+{ -+ -+ private DataInput input; -+ private Packet packet; -+ private boolean shutdown; -+ -+ public PacketDecoder() -+ { -+ super( ReadState.HEADER ); -+ } -+ -+ @Override -+ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception -+ { -+ if ( shutdown ) -+ { -+ in.readByte(); // Discard -+ return; -+ } -+ -+ if ( input == null ) -+ { -+ input = new ByteBufInputStream( in ); -+ } -+ -+ try -+ { -+ while ( true ) -+ { -+ switch ( state() ) -+ { -+ case HEADER: -+ int packetId = input.readUnsignedByte(); -+ packet = Packet.a( MinecraftServer.getServer().getLogger(), packetId ); -+ if ( packet == null ) -+ { -+ throw new IOException( "Bad packet id " + packetId ); -+ } -+ checkpoint( ReadState.DATA ); -+ case DATA: -+ packet.a( input ); -+ checkpoint( ReadState.HEADER ); -+ out.add( packet ); -+ if ( packet instanceof Packet254GetInfo ) -+ { -+ shutdown = true; -+ return; -+ } -+ packet = null; -+ break; -+ default: -+ throw new IllegalStateException(); -+ } -+ } -+ } catch ( EOFException ex ) -+ { -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/PacketListener.java b/src/main/java/org/spigotmc/netty/PacketListener.java -new file mode 100644 -index 0000000..965ba12 ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/PacketListener.java -@@ -0,0 +1,112 @@ -+package org.spigotmc.netty; -+ -+import com.google.common.base.Preconditions; -+import java.util.Arrays; -+import java.util.HashMap; -+import java.util.Map; -+import java.util.logging.Level; -+import net.minecraft.server.Connection; -+import net.minecraft.server.INetworkManager; -+import net.minecraft.server.Packet; -+import org.bukkit.Bukkit; -+import org.bukkit.plugin.Plugin; -+ -+/** -+ * This class is used for plugins that wish to register to listen to incoming -+ * and outgoing packets. To use this class, simply create a new instance, -+ * override the methods you wish to use, and call -+ * {@link #register(org.spigotmc.netty.PacketListener, org.bukkit.plugin.Plugin)}. -+ */ -+public class PacketListener -+{ -+ -+ /** -+ * A mapping of all registered listeners and their owning plugins. -+ */ -+ private static final Map listeners = new HashMap(); -+ /** -+ * A baked list of all listeners, for efficiency sake. -+ */ -+ private static PacketListener[] baked = new PacketListener[ 0 ]; -+ -+ /** -+ * Used to register a handler for receiving notifications of packet -+ * activity. -+ * -+ * @param listener the listener to register -+ * @param plugin the plugin owning this listener -+ */ -+ public static synchronized void register(PacketListener listener, Plugin plugin) -+ { -+ Preconditions.checkNotNull( listener, "listener" ); -+ Preconditions.checkNotNull( plugin, "plugin" ); -+ Preconditions.checkState( !listeners.containsKey( listener ), "listener already registered" ); -+ -+ int size = listeners.size(); -+ Preconditions.checkState( baked.length == size ); -+ listeners.put( listener, plugin ); -+ baked = Arrays.copyOf( baked, size + 1 ); -+ baked[size] = listener; -+ } -+ -+ static Packet callReceived(INetworkManager networkManager, Connection connection, Packet packet) -+ { -+ for ( PacketListener listener : baked ) -+ { -+ try -+ { -+ packet = listener.packetReceived( networkManager, connection, packet ); -+ } catch ( Throwable t ) -+ { -+ Bukkit.getServer().getLogger().log( Level.SEVERE, "Error whilst firing receive hook for packet", t ); -+ } -+ } -+ return packet; -+ } -+ -+ static Packet callQueued(INetworkManager networkManager, Connection connection, Packet packet) -+ { -+ for ( PacketListener listener : baked ) -+ { -+ try -+ { -+ packet = listener.packetQueued( networkManager, connection, packet ); -+ } catch ( Throwable t ) -+ { -+ Bukkit.getServer().getLogger().log( Level.SEVERE, "Error whilst firing queued hook for packet", t ); -+ } -+ } -+ return packet; -+ } -+ -+ /** -+ * Called when a packet has been received and is about to be handled by the -+ * current {@link Connection}. The returned packet will be the packet passed -+ * on for handling, or in the case of null being returned, not handled at -+ * all. -+ * -+ * @param networkManager the NetworkManager receiving the packet -+ * @param connection the connection which will handle the packet -+ * @param packet the received packet -+ * @return the packet to be handled, or null to cancel -+ */ -+ public Packet packetReceived(INetworkManager networkManager, Connection connection, Packet packet) -+ { -+ return packet; -+ } -+ -+ /** -+ * Called when a packet is queued to be sent. The returned packet will be -+ * the packet sent. In the case of null being returned, the packet will not -+ * be sent. -+ * -+ * @param networkManager the NetworkManager which will send the packet -+ * @param connection the connection which queued the packet -+ * @param packet the queue packet -+ * @return the packet to be sent, or null if the packet will not be sent. -+ */ -+ public Packet packetQueued(INetworkManager networkManager, Connection connection, Packet packet) -+ { -+ return packet; -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/PacketWriter.java b/src/main/java/org/spigotmc/netty/PacketWriter.java -new file mode 100644 -index 0000000..9d947bc ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/PacketWriter.java -@@ -0,0 +1,85 @@ -+package org.spigotmc.netty; -+ -+import io.netty.buffer.ByteBuf; -+import io.netty.buffer.ByteBufOutputStream; -+import io.netty.channel.Channel; -+import io.netty.handler.codec.EncoderException; -+import java.io.DataOutput; -+import java.io.IOException; -+import java.util.ArrayDeque; -+import java.util.Queue; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PendingConnection; -+ -+/** -+ * Netty encoder which takes a packet and encodes it, and adds a byte packet id -+ * header. -+ */ -+public class PacketWriter -+{ -+ -+ private static final int FLUSH_TIME = 1; -+ /*========================================================================*/ -+ long lastFlush; -+ private final Queue queue = new ArrayDeque( 64 ); -+ -+ void write(Channel channel, NettyNetworkManager networkManager, Packet msg) -+ { -+ // Append messages to queue -+ queue.add( msg ); -+ -+ // If we are not in the pending connect phase, and we have not reached our timer -+ if ( !( networkManager.connection instanceof PendingConnection ) && System.currentTimeMillis() - lastFlush < FLUSH_TIME ) -+ { -+ return; -+ } -+ // Update our last write time -+ lastFlush = System.currentTimeMillis(); -+ -+ // Since we are writing in batches it can be useful to guess the size of our output to limit memcpy -+ int estimatedSize = 0; -+ for ( Packet packet : queue ) -+ { -+ estimatedSize += packet.a(); -+ } -+ // Allocate an output buffer of estimated size -+ ByteBuf outBuf = channel.alloc().buffer( estimatedSize ); -+ // And a stream to which we can write this buffer to -+ DataOutput dataOut = new ByteBufOutputStream( outBuf ); -+ // If we aren't a success, we free the buf in the finally -+ boolean success = false; -+ -+ try -+ { -+ // Iterate through all packets, this is safe as we know we will only ever get packets in the pipeline -+ for ( Packet packet : queue ) -+ { -+ // Write packet ID -+ outBuf.writeByte( packet.n() ); -+ // Write packet data -+ try -+ { -+ packet.a( dataOut ); -+ } catch ( IOException ex ) -+ { -+ throw new EncoderException( ex ); -+ } -+ } -+ // Add to the courtesy API providing number of written bytes -+ networkManager.addWrittenBytes( outBuf.readableBytes() ); -+ // Let Netty handle any errors from here on -+ success = true; -+ // Write down our single ByteBuf -+ channel.writeAndFlush( outBuf ); -+ } finally -+ { -+ // Reset packet queue -+ queue.clear(); -+ // If Netty didn't handle the freeing because we didn't get there, we must -+ if ( !success ) -+ { -+ outBuf.release(); -+ } -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/netty/ReadState.java b/src/main/java/org/spigotmc/netty/ReadState.java -new file mode 100644 -index 0000000..d3a9cab ---- /dev/null -+++ b/src/main/java/org/spigotmc/netty/ReadState.java -@@ -0,0 +1,17 @@ -+package org.spigotmc.netty; -+ -+/** -+ * Stores the state of the packet currently being read. -+ */ -+public enum ReadState -+{ -+ -+ /** -+ * Indicates the byte representing the ID has been read. -+ */ -+ HEADER, -+ /** -+ * Shows the packet body is being read. -+ */ -+ DATA; -+} --- -1.8.3.2 - diff --git a/CraftBukkit-Patches/0026-Prevent-NPE-in-CraftSign.patch b/CraftBukkit-Patches/0024-Prevent-NPE-in-CraftSign.patch similarity index 95% rename from CraftBukkit-Patches/0026-Prevent-NPE-in-CraftSign.patch rename to CraftBukkit-Patches/0024-Prevent-NPE-in-CraftSign.patch index 0a8b9fdb7..74ad8e2d8 100644 --- a/CraftBukkit-Patches/0026-Prevent-NPE-in-CraftSign.patch +++ b/CraftBukkit-Patches/0024-Prevent-NPE-in-CraftSign.patch @@ -1,4 +1,4 @@ -From 08668583e7fe45e2cae6330d4a69861300fb3740 Mon Sep 17 00:00:00 2001 +From f0f90a6b9732962e719dd67d946a69b3550ca127 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 18 Mar 2013 20:01:44 +1100 Subject: [PATCH] Prevent NPE in CraftSign @@ -32,5 +32,5 @@ index 1647100..43c4434 100644 if(lines[i] != null) { sign.lines[i] = lines[i]; -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0027-Entity-Tracking-Ranges.patch b/CraftBukkit-Patches/0025-Entity-Tracking-Ranges.patch similarity index 95% rename from CraftBukkit-Patches/0027-Entity-Tracking-Ranges.patch rename to CraftBukkit-Patches/0025-Entity-Tracking-Ranges.patch index d2281dd22..c67401576 100644 --- a/CraftBukkit-Patches/0027-Entity-Tracking-Ranges.patch +++ b/CraftBukkit-Patches/0025-Entity-Tracking-Ranges.patch @@ -1,4 +1,4 @@ -From 85d83e03d344fff2a6ef62a657ab250ed1375583 Mon Sep 17 00:00:00 2001 +From da8c410852c7404861f3ebc96e6d36ff5a9d2274 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 20 Feb 2013 11:58:47 -0500 Subject: [PATCH] Entity Tracking Ranges @@ -12,16 +12,16 @@ This has multiple benefits: 4) Less client lag - Not trying to render distant item frames and paintings and entities will reduce entity count on the client, which is major for shop/town worlds which may use tons of item frames. diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -index ebbef6a..e833454 100644 +index 97d0bbb..fc679ae 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java -@@ -88,6 +88,7 @@ public class EntityTracker { +@@ -92,6 +92,7 @@ public class EntityTracker { public void addEntity(Entity entity, int i, int j, boolean flag) { if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous entity track!"); // Spigot + i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot - if (i > this.d) { - i = this.d; + if (i > this.e) { + i = this.e; } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index cca32b5..8ef6c6a 100644 @@ -99,5 +99,5 @@ index 0000000..bc6438d + } +} -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0029-Limit-Custom-Map-Rendering.patch b/CraftBukkit-Patches/0026-Limit-Custom-Map-Rendering.patch similarity index 95% rename from CraftBukkit-Patches/0029-Limit-Custom-Map-Rendering.patch rename to CraftBukkit-Patches/0026-Limit-Custom-Map-Rendering.patch index 0c118af37..5b2aa6ca8 100644 --- a/CraftBukkit-Patches/0029-Limit-Custom-Map-Rendering.patch +++ b/CraftBukkit-Patches/0026-Limit-Custom-Map-Rendering.patch @@ -1,4 +1,4 @@ -From 6d55041a2fa334f514a7bc01c7c41c160fecfe1b Mon Sep 17 00:00:00 2001 +From 4a3cd24fec99d9d0a41dfa3d90d64ae29aabd31a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Mar 2013 19:08:41 +1100 Subject: [PATCH] Limit Custom Map Rendering @@ -6,10 +6,10 @@ Subject: [PATCH] Limit Custom Map Rendering The default CraftBukkit render sequence for maps is ridiculously slow. By only using it when a custom renderer has been added (rarely in most cases), we can fallback to the Vanilla renderer for general usage. This leads to a much higher effiency overall, especially if no plugins are rendering such maps. diff --git a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java -index 22d9c7e..bed8705 100644 +index ec708d1..ef56386 100644 --- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java +++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java -@@ -38,23 +38,29 @@ public class WorldMapHumanTracker { +@@ -37,23 +37,29 @@ public class WorldMapHumanTracker { int i; int j; @@ -47,7 +47,7 @@ index 22d9c7e..bed8705 100644 // CraftBukkit end boolean flag = !itemstack.A(); -@@ -89,7 +95,7 @@ public class WorldMapHumanTracker { +@@ -88,7 +94,7 @@ public class WorldMapHumanTracker { abyte1[2] = (byte) j; for (int i1 = 0; i1 < abyte1.length - 3; ++i1) { @@ -70,5 +70,5 @@ index b28d6a3..e70e4e4 100644 protected final WorldMap worldMap; -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0030-Enable-Improved-Ping-Sending.patch b/CraftBukkit-Patches/0027-Enable-Improved-Ping-Sending.patch similarity index 77% rename from CraftBukkit-Patches/0030-Enable-Improved-Ping-Sending.patch rename to CraftBukkit-Patches/0027-Enable-Improved-Ping-Sending.patch index 7e286f80a..a572dccc3 100644 --- a/CraftBukkit-Patches/0030-Enable-Improved-Ping-Sending.patch +++ b/CraftBukkit-Patches/0027-Enable-Improved-Ping-Sending.patch @@ -1,27 +1,27 @@ -From a87ea76cdfdaefe17fd09b8639cbc35d13e97293 Mon Sep 17 00:00:00 2001 +From dfcebcb9344ef7922d9ab62754ab1f7699948ddc Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Feb 2013 20:45:20 +1100 Subject: [PATCH] Enable Improved Ping Sending diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 2e234f1..d054efe 100644 +index 42fa9e0..af08d2f 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -54,6 +54,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -62,6 +62,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public int newTotalExp = 0; public boolean keepLevel = false; public double maxHealthCache; + public int lastPing = -1; // Spigot // CraftBukkit end - public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) { + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index a85fc5b..20b9c5d 100644 +index df28a59..ad3c3cf 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -720,6 +720,25 @@ public abstract class PlayerList { - this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, entityplayer.ping)); +@@ -765,6 +765,25 @@ public abstract class PlayerList { + this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, entityplayer.ping)); } // CraftBukkit end */ + // Spigot start @@ -47,5 +47,5 @@ index a85fc5b..20b9c5d 100644 public void sendAll(Packet packet) { -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0028-BungeeCord-Support.patch b/CraftBukkit-Patches/0028-BungeeCord-Support.patch deleted file mode 100644 index 7f2549955..000000000 --- a/CraftBukkit-Patches/0028-BungeeCord-Support.patch +++ /dev/null @@ -1,106 +0,0 @@ -From ab31e3b5708f623c6a83b08c12b8505fe40e6e02 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 23 Mar 2013 11:15:11 +1100 -Subject: [PATCH] BungeeCord Support - -- Allows BungeeCord to set the players real IP address very early in the login process, so that the BungeeCord proxy IP is never even seen by a plugin. - -diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java -index 6ffc927..8f1c214 100644 ---- a/src/main/java/net/minecraft/server/PendingConnection.java -+++ b/src/main/java/net/minecraft/server/PendingConnection.java -@@ -236,4 +236,17 @@ public class PendingConnection extends Connection { - static boolean a(PendingConnection pendingconnection, boolean flag) { - return pendingconnection.h = flag; - } -+ -+ // Spigot start -+ @Override -+ public void a(Packet250CustomPayload pcp) { -+ if (pcp.tag.equals("BungeeCord") && org.spigotmc.SpigotConfig.bungee && org.spigotmc.SpigotConfig.bungeeAddresses.contains(getSocket().getInetAddress().getHostAddress())) { -+ com.google.common.io.ByteArrayDataInput in = com.google.common.io.ByteStreams.newDataInput(pcp.data); -+ String subTag = in.readUTF(); -+ if (subTag.equals("Login")) { -+ networkManager.setSocketAddress(new java.net.InetSocketAddress(in.readUTF(), in.readInt())); -+ } -+ } -+ } -+ // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 5dafeaf..a85fc5b 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -296,7 +296,7 @@ public abstract class PlayerList { - // depending on the outcome. - EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.O() ? new DemoPlayerInteractManager(this.server.getWorldServer(0)) : new PlayerInteractManager(this.server.getWorldServer(0))); - Player player = entity.getBukkitEntity(); -- PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, pendingconnection.getSocket().getInetAddress()); -+ PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) pendingconnection.networkManager.getSocketAddress()).getAddress(), pendingconnection.getSocket().getInetAddress()); // Spigot - - SocketAddress socketaddress = pendingconnection.networkManager.getSocketAddress(); - -diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -index f87ebf9..f5032be 100644 ---- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -@@ -45,11 +45,11 @@ class ThreadLoginVerifier extends Thread { - return; - } - -- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress()); -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), ((java.net.InetSocketAddress) this.pendingConnection.networkManager.getSocketAddress()).getAddress()); // Spigot - this.server.getPluginManager().callEvent(asyncEvent); - - if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { -- final PlayerPreLoginEvent event = new PlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress()); -+ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), ((java.net.InetSocketAddress) this.pendingConnection.networkManager.getSocketAddress()).getAddress()); // Spigot - if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { - event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 20be022..e242f7d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1077,6 +1077,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - // Spigot start - private final Player.Spigot spigot = new Player.Spigot() - { -+ @Override -+ public InetSocketAddress getRawAddress() -+ { -+ return ( getHandle().playerConnection == null ) ? null : (InetSocketAddress) getHandle().playerConnection.networkManager.getSocket().getRemoteSocketAddress(); -+ } - }; - - public Player.Spigot spigot() -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 637fcf2..92cfac6 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -7,6 +7,7 @@ import java.lang.reflect.InvocationTargetException; - import java.lang.reflect.Method; - import java.lang.reflect.Modifier; - import java.util.ArrayList; -+import java.util.Arrays; - import java.util.Collections; - import java.util.HashMap; - import java.util.List; -@@ -202,4 +203,14 @@ public class SpigotConfig - - nettyThreads = getInt( "settings.netty-threads", 3 ); - } -+ public static List bungeeAddresses = Arrays.asList( new String[] -+ { -+ "127.0.0.1" -+ } ); -+ public static boolean bungee = true; -+ private static void bungee() -+ { -+ bungeeAddresses = getList( "settings.bungeecord-addresses", bungeeAddresses ); -+ bungee = getBoolean( "settings.bungeecord", true ); -+ } - } --- -1.8.1.2 - diff --git a/CraftBukkit-Patches/0028-Thread-Naming-and-Tweaks.patch b/CraftBukkit-Patches/0028-Thread-Naming-and-Tweaks.patch new file mode 100644 index 000000000..ce21c222e --- /dev/null +++ b/CraftBukkit-Patches/0028-Thread-Naming-and-Tweaks.patch @@ -0,0 +1,23 @@ +From 379a06c3df065bc8ea719c01ce7a0a25e9d3e017 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Tue, 23 Apr 2013 11:50:27 +1000 +Subject: [PATCH] Thread Naming and Tweaks + +Removes the sleep forever thread and adds useful names for debugging to all staged thread files. + +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +index 84dcfcc..a30f217 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +@@ -71,7 +71,7 @@ public class CraftScheduler implements BukkitScheduler { + */ + private final ConcurrentHashMap runners = new ConcurrentHashMap(); + private volatile int currentTick = -1; +- private final Executor executor = Executors.newCachedThreadPool(); ++ private final Executor executor = Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build()); // Spigot + private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}}; + private CraftAsyncDebugger debugTail = debugHead; + private static final int RECENT_TICKS; +-- +1.8.3.2 + diff --git a/CraftBukkit-Patches/0033-Close-Unloaded-Save-Files.patch b/CraftBukkit-Patches/0029-Close-Unloaded-Save-Files.patch similarity index 92% rename from CraftBukkit-Patches/0033-Close-Unloaded-Save-Files.patch rename to CraftBukkit-Patches/0029-Close-Unloaded-Save-Files.patch index a33d9399f..2a119b002 100644 --- a/CraftBukkit-Patches/0033-Close-Unloaded-Save-Files.patch +++ b/CraftBukkit-Patches/0029-Close-Unloaded-Save-Files.patch @@ -1,4 +1,4 @@ -From 5bc49050726a39ddfe0497a44127469e5c5ec403 Mon Sep 17 00:00:00 2001 +From 34d90bfbf38c020b7e10bb1fa2d3d95090f1a687 Mon Sep 17 00:00:00 2001 From: Antony Riley Date: Wed, 27 Mar 2013 01:41:54 +0200 Subject: [PATCH] Close Unloaded Save Files @@ -18,10 +18,10 @@ index 900ed68..829f4a3 100644 public static synchronized RegionFile a(File file1, int i, int j) { File file2 = new File(file1, "region"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 906ae33..b4c4f21 100644 +index 5eefd0d..5f5174b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -37,6 +37,8 @@ import net.minecraft.server.MinecraftServer; +@@ -41,6 +41,8 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.MobEffectList; import net.minecraft.server.PropertyManager; import net.minecraft.server.ServerCommand; @@ -30,7 +30,7 @@ index 906ae33..b4c4f21 100644 import net.minecraft.server.ServerNBTManager; import net.minecraft.server.WorldLoaderServer; import net.minecraft.server.WorldManager; -@@ -822,6 +824,30 @@ public final class CraftServer implements Server { +@@ -850,6 +852,30 @@ public final class CraftServer implements Server { worlds.remove(world.getName().toLowerCase()); console.worlds.remove(console.worlds.indexOf(handle)); diff --git a/CraftBukkit-Patches/0034-Improve-NextTickList-Performance.patch b/CraftBukkit-Patches/0030-Improve-NextTickList-Performance.patch similarity index 73% rename from CraftBukkit-Patches/0034-Improve-NextTickList-Performance.patch rename to CraftBukkit-Patches/0030-Improve-NextTickList-Performance.patch index a6e581fcb..894e989c0 100644 --- a/CraftBukkit-Patches/0034-Improve-NextTickList-Performance.patch +++ b/CraftBukkit-Patches/0030-Improve-NextTickList-Performance.patch @@ -1,4 +1,4 @@ -From 131db6fa5dabe5cc1563b6b57fb98a4d44b63030 Mon Sep 17 00:00:00 2001 +From e6404134e65bbc8cd3511970a0cfa38c98e54820 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 24 Apr 2013 01:43:33 -0500 Subject: [PATCH] Improve NextTickList Performance @@ -20,57 +20,59 @@ index acf8838..1e3e0f8 100644 public NextTickListEntry a(long i) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3afcc0e..5eb335f 100644 +index 74a2d45..b860ce8 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -25,8 +25,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -29,8 +29,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate private final MinecraftServer server; public EntityTracker tracker; // CraftBukkit - private final -> public private final PlayerChunkMap manager; -- private Set L; -- private TreeSet M; +- private Set M; +- private TreeSet N; + private org.bukkit.craftbukkit.util.LongObjectHashMap> tickEntriesByChunk; // Spigot - switch to something better for chunk-wise access + private TreeSet tickEntryQueue; // Spigot public ChunkProviderServer chunkProviderServer; public boolean savingDisabled; - private boolean N; -@@ -36,7 +36,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - private NoteDataList[] R = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)}; - private int S; - private static final StructurePieceTreasure[] T = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)}; -- private List U = new ArrayList(); + private boolean O; +@@ -40,7 +40,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate + private NoteDataList[] S = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)}; + private int T; + private static final StructurePieceTreasure[] U = new StructurePieceTreasure[] { new StructurePieceTreasure(Items.STICK, 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.WOOD), 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG), 0, 1, 3, 10), new StructurePieceTreasure(Items.STONE_AXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOOD_AXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.STONE_PICKAXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOOD_PICKAXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.APPLE, 0, 2, 3, 5), new StructurePieceTreasure(Items.BREAD, 0, 2, 3, 3), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG2), 0, 1, 3, 10)}; +- private List V = new ArrayList(); + private ArrayList pendingTickEntries = new ArrayList(); // Spigot + private int nextPendingTickEntry; // Spigot private IntHashMap entitiesById; // CraftBukkit start -@@ -54,13 +55,15 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -59,13 +60,15 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.entitiesById = new IntHashMap(); } -- if (this.L == null) { -- this.L = new HashSet(); +- if (this.M == null) { +- this.M = new HashSet(); + // Spigot start + if (this.tickEntriesByChunk == null) { + this.tickEntriesByChunk = new org.bukkit.craftbukkit.util.LongObjectHashMap>(); } -- if (this.M == null) { -- this.M = new TreeSet(); +- if (this.N == null) { +- this.N = new TreeSet(); + if (this.tickEntryQueue == null) { + this.tickEntryQueue = new TreeSet(); } + // Spigot end - this.P = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit + this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit this.scoreboard = new ScoreboardServer(minecraftserver); -@@ -440,9 +443,16 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -438,10 +441,17 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate + } } - public boolean a(int i, int j, int k, int l) { -- NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l); +- public boolean a(int i, int j, int k, Block block) { +- NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, block); - -- return this.U.contains(nextticklistentry); +- return this.V.contains(nextticklistentry); ++ public boolean a(int i, int j, int k, Block block) { // Block was l + // Spigot start + int te_cnt = this.pendingTickEntries.size(); + for (int idx = this.nextPendingTickEntry; idx < te_cnt; idx++) { @@ -83,14 +85,14 @@ index 3afcc0e..5eb335f 100644 + // Spigot end } - public void a(int i, int j, int k, int l, int i1) { -@@ -476,10 +486,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - nextticklistentry.a(j1); + public void a(int i, int j, int k, Block block, int l) { +@@ -475,10 +485,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate + nextticklistentry.a(i1); } -- if (!this.L.contains(nextticklistentry)) { -- this.L.add(nextticklistentry); +- if (!this.M.contains(nextticklistentry)) { - this.M.add(nextticklistentry); +- this.N.add(nextticklistentry); - } + // Spigot start + addNextTickIfNeeded(nextticklistentry); @@ -98,13 +100,13 @@ index 3afcc0e..5eb335f 100644 } } -@@ -491,10 +500,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - nextticklistentry.a((long) i1 + this.worldData.getTime()); +@@ -490,10 +499,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate + nextticklistentry.a((long) l + this.worldData.getTime()); } -- if (!this.L.contains(nextticklistentry)) { -- this.L.add(nextticklistentry); +- if (!this.M.contains(nextticklistentry)) { - this.M.add(nextticklistentry); +- this.N.add(nextticklistentry); - } + // Spigot start + addNextTickIfNeeded(nextticklistentry); @@ -112,15 +114,15 @@ index 3afcc0e..5eb335f 100644 } public void tickEntities() { -@@ -514,11 +522,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -513,11 +521,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } public boolean a(boolean flag) { -- int i = this.M.size(); +- int i = this.N.size(); + // Spigot start + int i = this.tickEntryQueue.size(); -- if (i != this.L.size()) { +- if (i != this.M.size()) { - throw new IllegalStateException("TickNextTick list out of synch"); - } else { + this.nextPendingTickEntry = 0; @@ -129,19 +131,20 @@ index 3afcc0e..5eb335f 100644 if (i > 1000) { // CraftBukkit start - If the server has too much to process over time, try to alleviate that if (i > 20 * 1000) { -@@ -534,23 +543,24 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -533,23 +542,24 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate NextTickListEntry nextticklistentry; for (int j = 0; j < i; ++j) { -- nextticklistentry = (NextTickListEntry) this.M.first(); +- nextticklistentry = (NextTickListEntry) this.N.first(); +- if (!flag && nextticklistentry.d > this.worldData.getTime()) { + nextticklistentry = (NextTickListEntry) this.tickEntryQueue.first(); // Spigot - if (!flag && nextticklistentry.e > this.worldData.getTime()) { ++ if (!flag && nextticklistentry.e > this.worldData.getTime()) { break; } +- this.N.remove(nextticklistentry); - this.M.remove(nextticklistentry); -- this.L.remove(nextticklistentry); -- this.U.add(nextticklistentry); +- this.V.add(nextticklistentry); + // Spigot start + this.removeNextTickIfNeeded(nextticklistentry); + this.pendingTickEntries.add(nextticklistentry); @@ -150,7 +153,7 @@ index 3afcc0e..5eb335f 100644 this.methodProfiler.b(); this.methodProfiler.a("ticking"); -- Iterator iterator = this.U.iterator(); +- Iterator iterator = this.V.iterator(); - - while (iterator.hasNext()) { - nextticklistentry = (NextTickListEntry) iterator.next(); @@ -162,13 +165,13 @@ index 3afcc0e..5eb335f 100644 + // Spigot end byte b0 = 0; - if (this.e(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) { -@@ -581,52 +591,18 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate + if (this.b(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) { +@@ -580,50 +590,18 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } this.methodProfiler.b(); -- this.U.clear(); -- return !this.M.isEmpty(); +- this.V.clear(); +- return !this.N.isEmpty(); - } + // Spigot start + this.pendingTickEntries.clear(); @@ -190,14 +193,12 @@ index 3afcc0e..5eb335f 100644 - Iterator iterator; - - if (i1 == 0) { -- iterator = this.M.iterator(); +- iterator = this.N.iterator(); - } else { -- iterator = this.U.iterator(); -- /* CraftBukkit start - Comment out debug spam -- if (!this.U.isEmpty()) { -- System.out.println(this.U.size()); +- iterator = this.V.iterator(); +- if (!this.V.isEmpty()) { +- a.debug("toBeTicked = " + this.V.size()); - } -- // CraftBukkit end */ - } - - while (iterator.hasNext()) { @@ -205,7 +206,7 @@ index 3afcc0e..5eb335f 100644 - - if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) { - if (flag) { -- this.L.remove(nextticklistentry); +- this.M.remove(nextticklistentry); - iterator.remove(); - } - @@ -225,19 +226,19 @@ index 3afcc0e..5eb335f 100644 } /* CraftBukkit start - We prevent spawning in general, so this butchering is not needed -@@ -698,13 +674,15 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate +@@ -695,13 +673,15 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.entitiesById = new IntHashMap(); } -- if (this.L == null) { -- this.L = new HashSet(); +- if (this.M == null) { +- this.M = new HashSet(); + // Spigot start + if (this.tickEntriesByChunk == null) { + this.tickEntriesByChunk = new org.bukkit.craftbukkit.util.LongObjectHashMap>(); } -- if (this.M == null) { -- this.M = new TreeSet(); +- if (this.N == null) { +- this.N = new TreeSet(); + if (this.tickEntryQueue == null) { + this.tickEntryQueue = new TreeSet(); } @@ -245,8 +246,8 @@ index 3afcc0e..5eb335f 100644 this.b(worldsettings); super.a(worldsettings); -@@ -995,4 +973,62 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate - return this.setTypeIdAndData(x, y, z, typeId, data, 3); +@@ -1031,4 +1011,62 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate + return Block.b(getType(x, y, z)); } // CraftBukkit end + // Spigot start diff --git a/CraftBukkit-Patches/0031-Filter-Invalid-Names.patch b/CraftBukkit-Patches/0031-Filter-Invalid-Names.patch deleted file mode 100644 index 8a010d8b7..000000000 --- a/CraftBukkit-Patches/0031-Filter-Invalid-Names.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 915d36b2eadd6373c1e671d1f1ca90eb4bac08ad Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 25 Jul 2013 17:06:02 +1000 -Subject: [PATCH] Filter Invalid Names - - -diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java -index 8f1c214..d83d475 100644 ---- a/src/main/java/net/minecraft/server/PendingConnection.java -+++ b/src/main/java/net/minecraft/server/PendingConnection.java -@@ -66,13 +66,14 @@ public class PendingConnection extends Connection { - } - } - -+ private static final java.util.regex.Pattern validName = java.util.regex.Pattern.compile("^[a-zA-Z0-9_-]{2,16}$"); // Spigot - public void a(Packet2Handshake packet2handshake) { - if (this.g != null) { - this.disconnect("Quit repeating yourself!"); - } else { - this.hostname = packet2handshake.c + ':' + packet2handshake.d; // CraftBukkit - initialize field - this.g = packet2handshake.f(); -- if (!this.g.equals(StripColor.a(this.g))) { -+ if (!this.g.equals(StripColor.a(this.g)) || !validName.matcher( this.g ).matches() ) { // Spigot - this.disconnect("Invalid username!"); - } else { - PublicKey publickey = this.server.H().getPublic(); --- -1.8.1.2 - diff --git a/CraftBukkit-Patches/0035-Remove-o-Option.patch b/CraftBukkit-Patches/0031-Remove-o-Option.patch similarity index 82% rename from CraftBukkit-Patches/0035-Remove-o-Option.patch rename to CraftBukkit-Patches/0031-Remove-o-Option.patch index 52b53914e..6ff718370 100644 --- a/CraftBukkit-Patches/0035-Remove-o-Option.patch +++ b/CraftBukkit-Patches/0031-Remove-o-Option.patch @@ -1,4 +1,4 @@ -From fe47ab3364fde7609ad22c4e98ca6fb713b243cf Mon Sep 17 00:00:00 2001 +From 0345c430b0b60309694c9c30dd4ac3e966f689d7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 19 May 2013 18:29:48 +1000 Subject: [PATCH] Remove -o Option @@ -6,10 +6,10 @@ Subject: [PATCH] Remove -o Option Serves no purpose other than to confuse users. diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java -index 03aa219..a45c4ea 100644 +index bb535c2..93968bd 100644 --- a/src/main/java/net/minecraft/server/PropertyManager.java +++ b/src/main/java/net/minecraft/server/PropertyManager.java -@@ -53,7 +53,7 @@ public class PropertyManager { +@@ -52,7 +52,7 @@ public class PropertyManager { } private T getOverride(String name, T value) { @@ -19,5 +19,5 @@ index 03aa219..a45c4ea 100644 } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0036-Recipe-Deconstruction.patch b/CraftBukkit-Patches/0032-Recipe-Deconstruction.patch similarity index 86% rename from CraftBukkit-Patches/0036-Recipe-Deconstruction.patch rename to CraftBukkit-Patches/0032-Recipe-Deconstruction.patch index 7ef0168b9..cc56aeed7 100644 --- a/CraftBukkit-Patches/0036-Recipe-Deconstruction.patch +++ b/CraftBukkit-Patches/0032-Recipe-Deconstruction.patch @@ -1,4 +1,4 @@ -From e3c6863c014cf05fd149bf2ab25491117164fb8a Mon Sep 17 00:00:00 2001 +From cf69c189b9d4f9adeded504065f9f1141338a4f7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 1 Jun 2013 16:34:38 +1000 Subject: [PATCH] Recipe Deconstruction @@ -17,7 +17,7 @@ index bb28c12..c0836e4 100644 + java.util.List getIngredients(); // Spigot } diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java -index 8f4246b..ac92050 100644 +index cc444db..867dd07 100644 --- a/src/main/java/net/minecraft/server/ShapedRecipes.java +++ b/src/main/java/net/minecraft/server/ShapedRecipes.java @@ -10,7 +10,7 @@ public class ShapedRecipes implements IRecipe { @@ -26,11 +26,11 @@ index 8f4246b..ac92050 100644 private ItemStack[] items; - private ItemStack result; + public ItemStack result; // Spigot - public final int a; - private boolean f; + private boolean e; -@@ -158,4 +158,11 @@ public class ShapedRecipes implements IRecipe { - this.f = true; + public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) { +@@ -156,4 +156,11 @@ public class ShapedRecipes implements IRecipe { + this.e = true; return this; } + @@ -42,7 +42,7 @@ index 8f4246b..ac92050 100644 + // Spigot end } diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java -index fbdad80..dc0ce9e 100644 +index 0fab83c..21181fb 100644 --- a/src/main/java/net/minecraft/server/ShapelessRecipes.java +++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java @@ -11,7 +11,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; @@ -67,5 +67,5 @@ index fbdad80..dc0ce9e 100644 + // Spigot end } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0032-Thread-Naming-and-Tweaks.patch b/CraftBukkit-Patches/0032-Thread-Naming-and-Tweaks.patch deleted file mode 100644 index fdb1bf73f..000000000 --- a/CraftBukkit-Patches/0032-Thread-Naming-and-Tweaks.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 6e2f5a24eec742f5d23f95aaf2808d3e9f300a7f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 23 Apr 2013 11:50:27 +1000 -Subject: [PATCH] Thread Naming and Tweaks - -Removes the sleep forever thread and adds useful names for debugging to all staged thread files. - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 4759f6a..32f0e75 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -34,7 +34,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - super(options); - // CraftBukkit end - this.m = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument -- new ThreadSleepForever(this); -+ // new ThreadSleepForever(this); - } - - protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException -diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java -index 489e184..bfd219c 100644 ---- a/src/main/java/net/minecraft/server/ThreadCommandReader.java -+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java -@@ -11,6 +11,7 @@ class ThreadCommandReader extends Thread { - final DedicatedServer server; - - ThreadCommandReader(DedicatedServer dedicatedserver) { -+ super("Command Reader"); // Spigot - this.server = dedicatedserver; - } - -diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -index f5032be..5e45cae 100644 ---- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -@@ -21,6 +21,7 @@ class ThreadLoginVerifier extends Thread { - CraftServer server; - - ThreadLoginVerifier(PendingConnection pendingconnection, CraftServer server) { -+ super("Login Verifier - " + pendingconnection.getName()); - this.server = server; - // CraftBukkit end - this.pendingConnection = pendingconnection; -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 84dcfcc..a30f217 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -71,7 +71,7 @@ public class CraftScheduler implements BukkitScheduler { - */ - private final ConcurrentHashMap runners = new ConcurrentHashMap(); - private volatile int currentTick = -1; -- private final Executor executor = Executors.newCachedThreadPool(); -+ private final Executor executor = Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build()); // Spigot - private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {@Override StringBuilder debugTo(StringBuilder string) {return string;}}; - private CraftAsyncDebugger debugTail = debugHead; - private static final int RECENT_TICKS; --- -1.8.1.2 - diff --git a/CraftBukkit-Patches/0037-Implement-Arrow-API.patch b/CraftBukkit-Patches/0033-Implement-Arrow-API.patch similarity index 92% rename from CraftBukkit-Patches/0037-Implement-Arrow-API.patch rename to CraftBukkit-Patches/0033-Implement-Arrow-API.patch index 417ea9555..8d04bfb1d 100644 --- a/CraftBukkit-Patches/0037-Implement-Arrow-API.patch +++ b/CraftBukkit-Patches/0033-Implement-Arrow-API.patch @@ -1,4 +1,4 @@ -From de25dbdf3ecc440ee522364a9f535af596ca15c6 Mon Sep 17 00:00:00 2001 +From ffd15463a41ddcbb6aebe9c6cff9664be5ddd804 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 15:16:05 +1000 Subject: [PATCH] Implement Arrow API @@ -27,5 +27,5 @@ index a386001..e976b83 100644 public Arrow.Spigot spigot() -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0039-Hopper-Cooldowns.patch b/CraftBukkit-Patches/0034-Hopper-Cooldowns.patch similarity index 96% rename from CraftBukkit-Patches/0039-Hopper-Cooldowns.patch rename to CraftBukkit-Patches/0034-Hopper-Cooldowns.patch index f1ef536fe..edad8d4d1 100644 --- a/CraftBukkit-Patches/0039-Hopper-Cooldowns.patch +++ b/CraftBukkit-Patches/0034-Hopper-Cooldowns.patch @@ -1,11 +1,11 @@ -From 43d0965a4e505944e32e156b6a0e39baeb82ebd5 Mon Sep 17 00:00:00 2001 +From 9517fbacec37f55447c78c4eb0d188416e7133ba Mon Sep 17 00:00:00 2001 From: erocs Date: Sun, 8 Sep 2013 12:06:15 -0700 Subject: [PATCH] Hopper Cooldowns diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index e8cd525..5793b5c 100644 +index 730eb78..7d17d37 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -182,12 +182,17 @@ public class TileEntityHopper extends TileEntity implements IHopper { @@ -36,7 +36,7 @@ index e8cd525..5793b5c 100644 + this.c(world.spigotConfig.hopperTransfer); // Spigot return false; } - ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.c(this.p())]); + ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.b(this.p())]); @@ -299,9 +304,9 @@ public class TileEntityHopper extends TileEntity implements IHopper { iinventory.setItem(i, itemstack1); @@ -81,5 +81,5 @@ index 8ef6c6a..b63d3ad 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0040-Prevent-Shutdown-Hang.patch b/CraftBukkit-Patches/0035-Prevent-Shutdown-Hang.patch similarity index 74% rename from CraftBukkit-Patches/0040-Prevent-Shutdown-Hang.patch rename to CraftBukkit-Patches/0035-Prevent-Shutdown-Hang.patch index 818207959..8a2688b21 100644 --- a/CraftBukkit-Patches/0040-Prevent-Shutdown-Hang.patch +++ b/CraftBukkit-Patches/0035-Prevent-Shutdown-Hang.patch @@ -1,4 +1,4 @@ -From 9bc27c7532f54fe34ead4dbb2940c3724639d5e0 Mon Sep 17 00:00:00 2001 +From dd097bf3d6d43451da1b1e6f50e4079e4eabe19d Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 11 Jun 2013 11:54:32 +1000 Subject: [PATCH] Prevent Shutdown Hang @@ -6,14 +6,16 @@ Subject: [PATCH] Prevent Shutdown Hang Prevents server hanging if players disconnect during the shutdown sequence. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 20b9c5d..a85157b 100644 +index ad3c3cf..5b12cb4 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1064,7 +1064,14 @@ public abstract class PlayerList { +@@ -1115,8 +1115,15 @@ public abstract class PlayerList { + } public void r() { - while (!this.players.isEmpty()) { -- ((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message +- for (int i = 0; i < this.players.size(); ++i) { +- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message ++ while (!this.players.isEmpty()) { + // Spigot start + EntityPlayer p = (EntityPlayer) this.players.get( 0 ); + p.playerConnection.disconnect( this.server.server.getShutdownMessage() ); @@ -26,5 +28,5 @@ index 20b9c5d..a85157b 100644 } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0041-Implement-SpawnerSpawnEvent.patch b/CraftBukkit-Patches/0036-Implement-SpawnerSpawnEvent.patch similarity index 91% rename from CraftBukkit-Patches/0041-Implement-SpawnerSpawnEvent.patch rename to CraftBukkit-Patches/0036-Implement-SpawnerSpawnEvent.patch index aa93f49fb..0846285de 100644 --- a/CraftBukkit-Patches/0041-Implement-SpawnerSpawnEvent.patch +++ b/CraftBukkit-Patches/0036-Implement-SpawnerSpawnEvent.patch @@ -1,4 +1,4 @@ -From 572345b8ef0a594cd823a4b2c7e3228974047eab Mon Sep 17 00:00:00 2001 +From 9965936524d50d63d287ede6a2ded4e7a8453ca1 Mon Sep 17 00:00:00 2001 From: Andy Shulman Date: Mon, 15 Apr 2013 20:06:37 -0500 Subject: [PATCH] Implement SpawnerSpawnEvent. @@ -6,7 +6,7 @@ Subject: [PATCH] Implement SpawnerSpawnEvent. Adds BUKKIT-267 diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 108b375..4edd5e3 100644 +index 67c3397..bb6b3d5 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -5,7 +5,11 @@ import java.util.Collection; @@ -22,7 +22,7 @@ index 108b375..4edd5e3 100644 public abstract class MobSpawnerAbstract { -@@ -127,7 +131,12 @@ public abstract class MobSpawnerAbstract { +@@ -128,7 +132,12 @@ public abstract class MobSpawnerAbstract { entity.f(nbttagcompound); if (entity.world != null) { @@ -36,7 +36,7 @@ index 108b375..4edd5e3 100644 } NBTTagCompound nbttagcompound1; -@@ -150,6 +159,11 @@ public abstract class MobSpawnerAbstract { +@@ -152,6 +161,11 @@ public abstract class MobSpawnerAbstract { entity2.f(nbttagcompound2); entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch); @@ -48,7 +48,7 @@ index 108b375..4edd5e3 100644 if (entity.world != null) { entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit } -@@ -161,7 +175,12 @@ public abstract class MobSpawnerAbstract { +@@ -163,7 +177,12 @@ public abstract class MobSpawnerAbstract { } } else if (entity instanceof EntityLiving && entity.world != null) { ((EntityInsentient) entity).a((GroupDataEntity) null); @@ -63,7 +63,7 @@ index 108b375..4edd5e3 100644 return entity; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index cccfe75..d8f56e9 100644 +index 902aa88..a994264 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -35,6 +35,7 @@ import org.bukkit.Server; @@ -74,7 +74,7 @@ index cccfe75..d8f56e9 100644 import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CraftBlock; -@@ -115,6 +116,22 @@ public class CraftEventFactory { +@@ -116,6 +117,22 @@ public class CraftEventFactory { } /** @@ -98,5 +98,5 @@ index cccfe75..d8f56e9 100644 */ public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemInHand) { -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0042-Firework-Meta-Crash-Fix.patch b/CraftBukkit-Patches/0037-Firework-Meta-Crash-Fix.patch similarity index 91% rename from CraftBukkit-Patches/0042-Firework-Meta-Crash-Fix.patch rename to CraftBukkit-Patches/0037-Firework-Meta-Crash-Fix.patch index c3dead276..eda64fc73 100644 --- a/CraftBukkit-Patches/0042-Firework-Meta-Crash-Fix.patch +++ b/CraftBukkit-Patches/0037-Firework-Meta-Crash-Fix.patch @@ -1,11 +1,11 @@ -From d77eee29901ec8045af7dd5bd945c0ee6b70a6ef Mon Sep 17 00:00:00 2001 +From 445f5d003c74ff2bdada5b4925bd541ad48aefdd Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 15 Jun 2013 21:34:48 +1000 Subject: [PATCH] Firework Meta Crash Fix diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -index 3f9e4a3..93a1ce0 100644 +index 0f7da6b..5a409ae 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java @@ -145,7 +145,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { @@ -27,5 +27,5 @@ index 3f9e4a3..93a1ce0 100644 } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0043-Do-Not-Search-for-Offline-Players.patch b/CraftBukkit-Patches/0038-Do-Not-Search-for-Offline-Players.patch similarity index 82% rename from CraftBukkit-Patches/0043-Do-Not-Search-for-Offline-Players.patch rename to CraftBukkit-Patches/0038-Do-Not-Search-for-Offline-Players.patch index 4778cf999..59619cf42 100644 --- a/CraftBukkit-Patches/0043-Do-Not-Search-for-Offline-Players.patch +++ b/CraftBukkit-Patches/0038-Do-Not-Search-for-Offline-Players.patch @@ -1,4 +1,4 @@ -From 9ec77bb432ca9e73c89419d7198b7cb5976fce13 Mon Sep 17 00:00:00 2001 +From 61e2bd2016bf217937001d19ba059f2e8dbed088 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 16 Jun 2013 08:20:26 +1000 Subject: [PATCH] Do Not Search for Offline Players @@ -6,10 +6,10 @@ Subject: [PATCH] Do Not Search for Offline Players By default we do not want to search as this leads to massive load times for plugins wanting to do mass data lookups. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b4c4f21..30239a7 100644 +index 5f5174b..33cadfe 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1104,7 +1104,7 @@ public final class CraftServer implements Server { +@@ -1132,7 +1132,7 @@ public final class CraftServer implements Server { } public OfflinePlayer getOfflinePlayer(String name) { diff --git a/CraftBukkit-Patches/0038-Particle-API.patch b/CraftBukkit-Patches/0038-Particle-API.patch deleted file mode 100644 index 35b437387..000000000 --- a/CraftBukkit-Patches/0038-Particle-API.patch +++ /dev/null @@ -1,240 +0,0 @@ -From 298046b76051b6baf697fa083a28c6c41ce67472 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 16:14:30 +1000 -Subject: [PATCH] Particle API - - -diff --git a/src/main/java/net/minecraft/server/Packet63WorldParticles.java b/src/main/java/net/minecraft/server/Packet63WorldParticles.java -index f036c53..60e1237 100644 ---- a/src/main/java/net/minecraft/server/Packet63WorldParticles.java -+++ b/src/main/java/net/minecraft/server/Packet63WorldParticles.java -@@ -17,6 +17,20 @@ public class Packet63WorldParticles extends Packet { - - public Packet63WorldParticles() {} - -+ // Spigot start - Added constructor -+ public Packet63WorldParticles(String particleName, float x, float y, float z, float offsetX, float offsetY, float offsetZ, float speed, int count) { -+ a = particleName; -+ b = x; -+ c = y; -+ d = z; -+ e = offsetX; -+ f = offsetY; -+ g = offsetZ; -+ h = speed; -+ i = count; -+ } -+ // Spigot end -+ - public void a(DataInput datainput) throws java.io.IOException { // Spigot - throws - this.a = a(datainput, 64); - this.b = datainput.readFloat(); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java -index 7de0de5..7eca388 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java -@@ -55,6 +55,8 @@ public class CraftEffect { - Validate.isTrue(((Material) data).isBlock(), "Material is not a block!"); - datavalue = ((Material) data).getId(); - break; -+ case ITEM_BREAK: -+ datavalue = ((Material) data).getId(); - default: - datavalue = 0; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 15e28cb..4076e6d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -766,31 +766,21 @@ public class CraftWorld implements World { - } else { - Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); - } -- -- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); -- playEffect(loc, effect, datavalue, radius); -+ if (data != null && data.getClass().equals(org.bukkit.material.MaterialData.class)) { -+ org.bukkit.material.MaterialData materialData = (org.bukkit.material.MaterialData) data; -+ Validate.isTrue(materialData.getItemType().isBlock(), "Material must be block"); -+ spigot().playEffect(loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, radius); -+ } else { -+ int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); -+ playEffect(loc, effect, datavalue, radius); -+ } - } - - public void playEffect(Location location, Effect effect, int data, int radius) { -- Validate.notNull(location, "Location cannot be null"); -- Validate.notNull(effect, "Effect cannot be null"); -- Validate.notNull(location.getWorld(), "World cannot be null"); -- int packetData = effect.getId(); -- Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data, false); -- int distance; -- radius *= radius; -- -- for (Player player : getPlayers()) { -- if (((CraftPlayer) player).getHandle().playerConnection == null) continue; -- if (!location.getWorld().equals(player.getWorld())) continue; -- -- distance = (int) player.getLocation().distanceSquared(location); -- if (distance <= radius) { -- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); -- } -- } -+ spigot().playEffect(location,effect, data, 0, 0f, 0f, 0f, 1f, 1, radius); - } - -+ - public T spawn(Location location, Class clazz) throws IllegalArgumentException { - return spawn(location, clazz, SpawnReason.CUSTOM); - } -@@ -1274,6 +1264,62 @@ public class CraftWorld implements World { - // Spigot start - private final Spigot spigot = new Spigot() - { -+ @Override -+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) -+ { -+ Validate.notNull( location, "Location cannot be null" ); -+ Validate.notNull( effect, "Effect cannot be null" ); -+ Validate.notNull( location.getWorld(), "World cannot be null" ); -+ -+ Packet packet; -+ if ( effect.getType() != Effect.Type.PARTICLE ) -+ { -+ int packetData = effect.getId(); -+ packet = new Packet61WorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); -+ } else -+ { -+ StringBuilder particleFullName = new StringBuilder(); -+ particleFullName.append( effect.getName() ); -+ -+ if ( effect.getData() != null && ( effect.getData().equals( Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ) -+ { -+ particleFullName.append( '_' ).append( id ); -+ } -+ -+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) -+ { -+ particleFullName.append( '_' ).append( data ); -+ } -+ packet = new Packet63WorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount ); -+ } -+ -+ int distance; -+ radius *= radius; -+ -+ for ( Player player : getPlayers() ) -+ { -+ if ( ( (CraftPlayer) player ).getHandle().playerConnection == null ) -+ { -+ continue; -+ } -+ if ( !location.getWorld().equals( player.getWorld() ) ) -+ { -+ continue; -+ } -+ -+ distance = (int) player.getLocation().distanceSquared( location ); -+ if ( distance <= radius ) -+ { -+ ( (CraftPlayer) player ).getHandle().playerConnection.sendPacket( packet ); -+ } -+ } -+ } -+ -+ @Override -+ public void playEffect(Location location, Effect effect) -+ { -+ CraftWorld.this.playEffect( location, effect, 0 ); -+ } - }; - - public Spigot spigot() -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e242f7d..4bae056 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -277,13 +277,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getHandle().playerConnection.sendPacket(packet); - } - -- public void playEffect(Location loc, Effect effect, int data) { -- if (getHandle().playerConnection == null) return; -- -- int packetData = effect.getId(); -- Packet61WorldEvent packet = new Packet61WorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false); -- getHandle().playerConnection.sendPacket(packet); -+ // Spigot start -+ public void playEffect(Location location, Effect effect, int data) { -+ spigot().playEffect(location, effect, data, 0, 0f, 0f, 0f, 1f, 1, 64); - } -+ // Spigot end - - public void playEffect(Location loc, Effect effect, T data) { - if (data != null) { -@@ -291,9 +289,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } else { - Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); - } -- -- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); -- playEffect(loc, effect, datavalue); -+ if (data != null && data.getClass().equals(org.bukkit.material.MaterialData.class)) { -+ org.bukkit.material.MaterialData materialData = (org.bukkit.material.MaterialData) data; -+ Validate.isTrue(!materialData.getItemType().isBlock(), "Material must be block"); -+ spigot().playEffect(loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, 64); -+ } else { -+ int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); -+ playEffect(loc, effect, datavalue); -+ } - } - - public void sendBlockChange(Location loc, Material material, byte data) { -@@ -1082,6 +1085,43 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - { - return ( getHandle().playerConnection == null ) ? null : (InetSocketAddress) getHandle().playerConnection.networkManager.getSocket().getRemoteSocketAddress(); - } -+ -+ @Override -+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) -+ { -+ Validate.notNull( location, "Location cannot be null" ); -+ Validate.notNull( effect, "Effect cannot be null" ); -+ Validate.notNull( location.getWorld(), "World cannot be null" ); -+ -+ Packet packet; -+ if ( effect.getType() != Effect.Type.PARTICLE ) -+ { -+ int packetData = effect.getId(); -+ packet = new Packet61WorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); -+ } else -+ { -+ StringBuilder particleFullName = new StringBuilder(); -+ particleFullName.append( effect.getName() ); -+ -+ if ( effect.getData() != null && ( effect.getData().equals( Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ) -+ { -+ particleFullName.append( '_' ).append( id ); -+ } -+ -+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) -+ { -+ particleFullName.append( '_' ).append( data ); -+ } -+ packet = new Packet63WorldParticles( effect.getName(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, particleCount, radius ); -+ } -+ -+ if ( !location.getWorld().equals( getWorld() ) ) -+ { -+ return; -+ } -+ -+ getHandle().playerConnection.sendPacket( packet ); -+ } - }; - - public Player.Spigot spigot() --- -1.8.3.2 - diff --git a/CraftBukkit-Patches/0046-Allow-Disabling-of-Command-Logging.patch b/CraftBukkit-Patches/0039-Allow-Disabling-of-Command-Logging.patch similarity index 66% rename from CraftBukkit-Patches/0046-Allow-Disabling-of-Command-Logging.patch rename to CraftBukkit-Patches/0039-Allow-Disabling-of-Command-Logging.patch index 9343de031..9566ecf22 100644 --- a/CraftBukkit-Patches/0046-Allow-Disabling-of-Command-Logging.patch +++ b/CraftBukkit-Patches/0039-Allow-Disabling-of-Command-Logging.patch @@ -1,34 +1,34 @@ -From c94b0568262d0bf5f9fb4817903fb1e908d370e0 Mon Sep 17 00:00:00 2001 +From 4edcbe30edadeb74f69735329648e349dffbc860 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 759dc89..c867fcf 100644 +index 4e41695..8a5e257 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -976,7 +976,12 @@ public class PlayerConnection extends Connection { +@@ -921,7 +921,12 @@ public class PlayerConnection implements PacketPlayInListener { } try { -- this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit +- this.c.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit + // Spigot Start + if ( org.spigotmc.SpigotConfig.logCommands ) + { -+ this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit ++ this.c.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit + } + // Spigot end if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot return; diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 86e3680..babedc0 100644 +index 6a37636..837fcc9 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -222,4 +222,10 @@ public class SpigotConfig - "/skill" - } ) ); +@@ -136,4 +136,10 @@ public class SpigotConfig + { + commands.put( "tps", new TicksPerSecondCommand( "tps" ) ); } + + public static boolean logCommands; diff --git a/CraftBukkit-Patches/0047-Allow-Disabling-of-Command-TabComplete.patch b/CraftBukkit-Patches/0040-Allow-Disabling-of-Command-TabComplete.patch similarity index 86% rename from CraftBukkit-Patches/0047-Allow-Disabling-of-Command-TabComplete.patch rename to CraftBukkit-Patches/0040-Allow-Disabling-of-Command-TabComplete.patch index 48c532176..c4e723e4f 100644 --- a/CraftBukkit-Patches/0047-Allow-Disabling-of-Command-TabComplete.patch +++ b/CraftBukkit-Patches/0040-Allow-Disabling-of-Command-TabComplete.patch @@ -1,14 +1,14 @@ -From eca50c612dffde50a1ed1d1aa14dd87335f8f7dd Mon Sep 17 00:00:00 2001 +From 7e8c1890f4c3dd7dc5d4966298c5aa644c0ceae5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 18:05:54 +1000 Subject: [PATCH] Allow Disabling of Command TabComplete diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 30239a7..b216aaf 100644 +index 33cadfe..5178808 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1371,7 +1371,7 @@ public final class CraftServer implements Server { +@@ -1399,7 +1399,7 @@ public final class CraftServer implements Server { public List tabCompleteCommand(Player player, String message) { List completions = null; try { @@ -18,10 +18,10 @@ index 30239a7..b216aaf 100644 player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command"); getLogger().log(Level.SEVERE, "Exception when " + player.getName() + " attempted to tab complete " + message, ex); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index babedc0..e146926 100644 +index 837fcc9..3cdd6ac 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -228,4 +228,10 @@ public class SpigotConfig +@@ -142,4 +142,10 @@ public class SpigotConfig { logCommands = getBoolean( "commands.log", true ); } diff --git a/CraftBukkit-Patches/0048-Configurable-Messages.patch b/CraftBukkit-Patches/0041-Configurable-Messages.patch similarity index 60% rename from CraftBukkit-Patches/0048-Configurable-Messages.patch rename to CraftBukkit-Patches/0041-Configurable-Messages.patch index 1813cec88..274864cbc 100644 --- a/CraftBukkit-Patches/0048-Configurable-Messages.patch +++ b/CraftBukkit-Patches/0041-Configurable-Messages.patch @@ -1,52 +1,36 @@ -From 970b4ae4d7f0ed9c3114609d2c6a56b1dd041071 Mon Sep 17 00:00:00 2001 +From 53374efe82a99cd366b4b3b88be0cc4fc0f2baae Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 19:21:58 +1000 Subject: [PATCH] Configurable Messages -diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java -index d83d475..2b1df38 100644 ---- a/src/main/java/net/minecraft/server/PendingConnection.java -+++ b/src/main/java/net/minecraft/server/PendingConnection.java -@@ -80,9 +80,9 @@ public class PendingConnection extends Connection { - - if (packet2handshake.d() != 78) { - if (packet2handshake.d() > 78) { -- this.disconnect("Outdated server!"); -+ this.disconnect(org.spigotmc.SpigotConfig.outdatedServerMessage); // Spigot - } else { -- this.disconnect("Outdated client!"); -+ this.disconnect(org.spigotmc.SpigotConfig.outdatedClientMessage); // Spigot - } - } else { - this.loginKey = this.server.getOnlineMode() ? Long.toString(random.nextLong(), 16) : "-"; diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index a85157b..e5a259d 100644 +index 5b12cb4..3ddf3ae 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -310,7 +310,7 @@ public abstract class PlayerList { - - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s1); - } else if (!this.isWhitelisted(s)) { +@@ -335,7 +335,7 @@ public abstract class PlayerList { + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); + } else if (!this.isWhitelisted(gameprofile.getName())) { + // return "You are not white-listed on this server!"; - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!"); + event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot } else { - String s2 = socketaddress.toString(); + String s1 = socketaddress.toString(); -@@ -326,7 +326,7 @@ public abstract class PlayerList { - - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s3); - } else if (this.players.size() >= this.maxPlayers) { -- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!"); -+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot +@@ -354,7 +354,7 @@ public abstract class PlayerList { } else { - event.disallow(PlayerLoginEvent.Result.ALLOWED, s2); + // return this.players.size() >= this.maxPlayers ? "The server is full!" : null; + if (this.players.size() >= this.maxPlayers) { +- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!"); ++ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot + } } + } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0d7b044..20719f7 100644 +index 5178808..82a566d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -533,11 +533,7 @@ public final class CraftServer implements Server { +@@ -548,11 +548,7 @@ public final class CraftServer implements Server { return true; } @@ -60,10 +44,10 @@ index 0d7b044..20719f7 100644 return false; } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index e146926..1d9d3c9 100644 +index 3cdd6ac..a3ddb99 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -15,6 +15,7 @@ import java.util.Map; +@@ -12,6 +12,7 @@ import java.util.Map; import java.util.logging.Level; import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; @@ -71,7 +55,7 @@ index e146926..1d9d3c9 100644 import org.bukkit.command.Command; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.craftbukkit.command.TicksPerSecondCommand; -@@ -234,4 +235,22 @@ public class SpigotConfig +@@ -148,4 +149,22 @@ public class SpigotConfig { tabComplete = getBoolean( "commands.tab-complete", true ); } diff --git a/CraftBukkit-Patches/0049-Allow-Disabling-of-Random-Lighting-Updates.patch b/CraftBukkit-Patches/0042-Allow-Disabling-of-Random-Lighting-Updates.patch similarity index 90% rename from CraftBukkit-Patches/0049-Allow-Disabling-of-Random-Lighting-Updates.patch rename to CraftBukkit-Patches/0042-Allow-Disabling-of-Random-Lighting-Updates.patch index 073060d22..8008549a1 100644 --- a/CraftBukkit-Patches/0049-Allow-Disabling-of-Random-Lighting-Updates.patch +++ b/CraftBukkit-Patches/0042-Allow-Disabling-of-Random-Lighting-Updates.patch @@ -1,14 +1,14 @@ -From 60c96ecddddb89969bbda55baf687b42402df903 Mon Sep 17 00:00:00 2001 +From d2104b9150b700f8c3d3155eda9b7d422a4b9404 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 22 Jun 2013 16:12:02 +1000 Subject: [PATCH] Allow Disabling of Random Lighting Updates diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ab1ac5e..e594b04 100644 +index f53e51d..3f4e2d5 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -2104,7 +2104,7 @@ public abstract class World implements IBlockAccess { +@@ -2045,7 +2045,7 @@ public abstract class World implements IBlockAccess { } this.methodProfiler.a("playerCheckLight"); diff --git a/CraftBukkit-Patches/0050-Add-Log-Filtering.patch b/CraftBukkit-Patches/0043-Add-Log-Filtering.patch similarity index 92% rename from CraftBukkit-Patches/0050-Add-Log-Filtering.patch rename to CraftBukkit-Patches/0043-Add-Log-Filtering.patch index 4cec3021b..16926f0e2 100644 --- a/CraftBukkit-Patches/0050-Add-Log-Filtering.patch +++ b/CraftBukkit-Patches/0043-Add-Log-Filtering.patch @@ -1,4 +1,4 @@ -From 65315609f8f437e29da1a66df0633b050b789b11 Mon Sep 17 00:00:00 2001 +From b2abcc850b4c50b043f8ef3548ea3c82e839050a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 22 Jun 2013 16:40:11 +1000 Subject: [PATCH] Add Log Filtering @@ -35,10 +35,10 @@ index 0000000..aa7e9ab + } +} diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 1d9d3c9..8d8bc97 100644 +index a3ddb99..e65978b 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -13,6 +13,8 @@ import java.util.HashMap; +@@ -10,6 +10,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -47,7 +47,7 @@ index 1d9d3c9..8d8bc97 100644 import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -@@ -253,4 +255,27 @@ public class SpigotConfig +@@ -167,4 +169,27 @@ public class SpigotConfig outdatedClientMessage = transform( getString( "messages.outdated-client", "Outdated client!" ) ); outdatedServerMessage = transform( getString( "messages.outdated-server", "Outdated server!" ) ); } @@ -76,5 +76,5 @@ index 1d9d3c9..8d8bc97 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0044-Enable-Foreign-Language-Signs.patch b/CraftBukkit-Patches/0044-Enable-Foreign-Language-Signs.patch deleted file mode 100644 index 4601d2c27..000000000 --- a/CraftBukkit-Patches/0044-Enable-Foreign-Language-Signs.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 4eae57efe800fe1a98a83fb2b22352e6c2c79bf0 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 21 Jun 2013 17:53:03 +1000 -Subject: [PATCH] Enable Foreign Language Signs - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8443731..a836111 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1586,7 +1586,7 @@ public class PlayerConnection extends Connection { - flag = false; - } else { - for (i = 0; i < packet130updatesign.lines[j].length(); ++i) { -- if (SharedConstants.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) { -+ if (!SharedConstants.isAllowedChatCharacter(packet130updatesign.lines[j].charAt(i))) { // Spigot - flag = false; - } - } --- -1.8.3.2 - diff --git a/CraftBukkit-Patches/0051-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch b/CraftBukkit-Patches/0044-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch similarity index 97% rename from CraftBukkit-Patches/0051-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch rename to CraftBukkit-Patches/0044-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch index 63a3eddd9..2e53eb7ef 100644 --- a/CraftBukkit-Patches/0051-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch +++ b/CraftBukkit-Patches/0044-Make-AnvilInventory.getItem-use-both-containers.-Fix.patch @@ -1,4 +1,4 @@ -From d3b7ead5953c0cb7389eb15001a2386092eba4ee Mon Sep 17 00:00:00 2001 +From c0e37b19f9d11820289d0edb5624d493fca0c55b Mon Sep 17 00:00:00 2001 From: Andre LeBlanc Date: Sat, 6 Apr 2013 12:00:31 -0400 Subject: [PATCH] Make AnvilInventory.getItem() use both containers. Fixes @@ -53,5 +53,5 @@ index a91d81a..46a1d38 100644 return getResultInventory().getSize() + getIngredientsInventory().getSize(); } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0053-Properly-Close-Inventories.patch b/CraftBukkit-Patches/0045-Properly-Close-Inventories.patch similarity index 91% rename from CraftBukkit-Patches/0053-Properly-Close-Inventories.patch rename to CraftBukkit-Patches/0045-Properly-Close-Inventories.patch index 2828f596e..f1d6bf7e7 100644 --- a/CraftBukkit-Patches/0053-Properly-Close-Inventories.patch +++ b/CraftBukkit-Patches/0045-Properly-Close-Inventories.patch @@ -1,4 +1,4 @@ -From 1139ef1777c64479f0664e4b3bbe5842a6dacb34 Mon Sep 17 00:00:00 2001 +From 345300a113335095d65efe3e842bbd3cf716895f Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 27 Jun 2013 17:26:09 +1000 Subject: [PATCH] Properly Close Inventories @@ -6,10 +6,10 @@ Subject: [PATCH] Properly Close Inventories Properly close inventories when unloading and switching worlds. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 8665ef2..8c98f3e 100644 +index 3bcca91..99c30f9 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -704,6 +704,15 @@ public class Chunk { +@@ -749,6 +749,15 @@ public class Chunk { while (iterator.hasNext()) { TileEntity tileentity = (TileEntity) iterator.next(); @@ -25,7 +25,7 @@ index 8665ef2..8c98f3e 100644 this.world.a(tileentity); } -@@ -713,6 +722,15 @@ public class Chunk { +@@ -758,6 +767,15 @@ public class Chunk { java.util.Iterator iter = this.entitySlices[i].iterator(); while (iter.hasNext()) { Entity entity = (Entity) iter.next(); @@ -42,7 +42,7 @@ index 8665ef2..8c98f3e 100644 // Do not pass along players, as doing so can get them stuck outside of time. // (which for example disables inventory icon updates and prevents block breaking) diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index e89b106..f58cd7e 100644 +index 1d997e1..1c64d42 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java @@ -149,6 +149,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -59,5 +59,5 @@ index e89b106..f58cd7e 100644 super.b(i); } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0045-Spam-Filter-Exclusions.patch b/CraftBukkit-Patches/0045-Spam-Filter-Exclusions.patch deleted file mode 100644 index e83998b8f..000000000 --- a/CraftBukkit-Patches/0045-Spam-Filter-Exclusions.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 86d91741f9b8c49805e5473a6ded05dae11c11da Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 21 Jun 2013 17:59:22 +1000 -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 a836111..759dc89 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -843,7 +843,17 @@ public class PlayerConnection extends Connection { - } - - // This section stays because it is only applicable to packets -- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam -+ // Spigot - spam exclusions -+ boolean counted = true; -+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions ) -+ { -+ if ( exclude != null && s.startsWith( exclude ) ) -+ { -+ counted = false; -+ break; -+ } -+ } -+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam - if (packet3chat.a_()) { - Waitable waitable = new Waitable() { - @Override -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 92cfac6..86e3680 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -213,4 +213,13 @@ public class SpigotConfig - bungeeAddresses = getList( "settings.bungeecord-addresses", bungeeAddresses ); - bungee = getBoolean( "settings.bungeecord", true ); - } -+ -+ public static List spamExclusions; -+ private static void spamExclusions() -+ { -+ spamExclusions = getList( "commands.spam-exclusions", Arrays.asList( new String[] -+ { -+ "/skill" -+ } ) ); -+ } - } --- -1.8.3.2 - diff --git a/CraftBukkit-Patches/0054-Disallow-Interaction-With-Self.patch b/CraftBukkit-Patches/0046-Disallow-Interaction-With-Self.patch similarity index 67% rename from CraftBukkit-Patches/0054-Disallow-Interaction-With-Self.patch rename to CraftBukkit-Patches/0046-Disallow-Interaction-With-Self.patch index 852e983fd..8753d0e40 100644 --- a/CraftBukkit-Patches/0054-Disallow-Interaction-With-Self.patch +++ b/CraftBukkit-Patches/0046-Disallow-Interaction-With-Self.patch @@ -1,17 +1,17 @@ -From 0bc311b8717924ada1e4fa43cc81d3caa7563ae8 Mon Sep 17 00:00:00 2001 +From 8a8e127c2db46ac38c3aa1b576ec93f9c5274473 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 c867fcf..6c8aa41 100644 +index 8a5e257..2e04e71 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1096,6 +1096,13 @@ public class PlayerConnection extends Connection { - +@@ -1028,6 +1028,13 @@ public class PlayerConnection implements PacketPlayInListener { + if (this.player.dead) return; // CraftBukkit WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - Entity entity = worldserver.getEntity(packet7useentity.target); + Entity entity = packetplayinuseentity.a((World) worldserver); + // Spigot Start + if ( entity == player ) + { @@ -20,7 +20,7 @@ index c867fcf..6c8aa41 100644 + } + // Spigot End - this.player.u(); + this.player.w(); if (entity != null) { -- 1.8.3.2 diff --git a/CraftBukkit-Patches/0055-Lower-Chunk-Compression.patch b/CraftBukkit-Patches/0047-Lower-Chunk-Compression.patch similarity index 70% rename from CraftBukkit-Patches/0055-Lower-Chunk-Compression.patch rename to CraftBukkit-Patches/0047-Lower-Chunk-Compression.patch index 10cf8c2dd..85fc5a0e2 100644 --- a/CraftBukkit-Patches/0055-Lower-Chunk-Compression.patch +++ b/CraftBukkit-Patches/0047-Lower-Chunk-Compression.patch @@ -1,4 +1,4 @@ -From 32e80b7320273f138bec13031eb9151c776cf3af Mon Sep 17 00:00:00 2001 +From d6e3678b8c413d9ffb2cedc75aecb609d81d3dc8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 2 Jul 2013 09:07:54 +1000 Subject: [PATCH] Lower Chunk Compression @@ -18,11 +18,11 @@ index 91d7feb..29baf6d 100644 this.d = chunkmap.c; this.c = chunkmap.b; -diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java -index a6e3be2..63dd8d3 100644 ---- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java -+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java -@@ -24,7 +24,7 @@ public class Packet56MapChunkBulk extends Packet { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +index c3cfdc7..8e1c4cb 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +@@ -22,7 +22,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { @Override protected Deflater initialValue() { // Don't use higher compression level, slows things down too much @@ -32,5 +32,5 @@ index a6e3be2..63dd8d3 100644 }; // CraftBukkit end -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0056-Entity-Mount-and-Dismount-Events.patch b/CraftBukkit-Patches/0048-Entity-Mount-and-Dismount-Events.patch similarity index 88% rename from CraftBukkit-Patches/0056-Entity-Mount-and-Dismount-Events.patch rename to CraftBukkit-Patches/0048-Entity-Mount-and-Dismount-Events.patch index 4faeb6f4e..5721dd271 100644 --- a/CraftBukkit-Patches/0056-Entity-Mount-and-Dismount-Events.patch +++ b/CraftBukkit-Patches/0048-Entity-Mount-and-Dismount-Events.patch @@ -1,14 +1,14 @@ -From b4fb566fcfe84a9048824e187c3881e87108f8e7 Mon Sep 17 00:00:00 2001 +From 3ba92e1abcd9685e94f0d708d0124df9557277a6 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 2 Jul 2013 20:32:49 +1000 Subject: [PATCH] Entity Mount and Dismount Events diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 852dfd3..92d7dc4 100644 +index 621e6c2..3450502 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1427,6 +1427,7 @@ public abstract class Entity { +@@ -1452,6 +1452,7 @@ public abstract class Entity { } } // CraftBukkit end @@ -16,7 +16,7 @@ index 852dfd3..92d7dc4 100644 this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); this.vehicle.passenger = null; -@@ -1462,6 +1463,17 @@ public abstract class Entity { +@@ -1487,6 +1488,17 @@ public abstract class Entity { } } // CraftBukkit end @@ -35,10 +35,10 @@ index 852dfd3..92d7dc4 100644 if (this.vehicle != null) { this.vehicle.passenger = null; diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index e4fe770..8c5a8ba 100644 +index c12a08f..7442943 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -304,6 +304,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -323,6 +323,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void setPassengerOf(Entity entity) { // CraftBukkit end if (this.vehicle != null && entity == null) { @@ -47,5 +47,5 @@ index e4fe770..8c5a8ba 100644 Entity originalVehicle = this.vehicle; // First statement moved down, second statement handled in parent method. -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0058-Properly-Consume-Bonemeal-in-Dispensers.patch b/CraftBukkit-Patches/0049-Properly-Consume-Bonemeal-in-Dispensers.patch similarity index 95% rename from CraftBukkit-Patches/0058-Properly-Consume-Bonemeal-in-Dispensers.patch rename to CraftBukkit-Patches/0049-Properly-Consume-Bonemeal-in-Dispensers.patch index 27731e019..2360f5a52 100644 --- a/CraftBukkit-Patches/0058-Properly-Consume-Bonemeal-in-Dispensers.patch +++ b/CraftBukkit-Patches/0049-Properly-Consume-Bonemeal-in-Dispensers.patch @@ -1,4 +1,4 @@ -From 0b8dd5fe77226811be5a3e1e49b4f6c09c584c78 Mon Sep 17 00:00:00 2001 +From ce6c551ec78c1733ade8eed48a279371a004ee3a Mon Sep 17 00:00:00 2001 From: Alex Ciuba Date: Mon, 10 Jun 2013 16:04:38 -0400 Subject: [PATCH] Properly Consume Bonemeal in Dispensers @@ -6,7 +6,7 @@ Subject: [PATCH] Properly Consume Bonemeal in Dispensers Don't consume bonemeal if there is no crop in front. Fixes BUKKIT-3790 diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java -index 1a58814..b83a803 100644 +index 713bbe8..92b3789 100644 --- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java +++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java @@ -20,9 +20,8 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem { @@ -43,5 +43,5 @@ index 1a58814..b83a803 100644 world.triggerEffect(2005, i, j, k, 0); } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0059-Prevent-Ghost-Players-Caused-by-Plugins.patch b/CraftBukkit-Patches/0050-Prevent-Ghost-Players-Caused-by-Plugins.patch similarity index 85% rename from CraftBukkit-Patches/0059-Prevent-Ghost-Players-Caused-by-Plugins.patch rename to CraftBukkit-Patches/0050-Prevent-Ghost-Players-Caused-by-Plugins.patch index 632e68d79..8be84587b 100644 --- a/CraftBukkit-Patches/0059-Prevent-Ghost-Players-Caused-by-Plugins.patch +++ b/CraftBukkit-Patches/0050-Prevent-Ghost-Players-Caused-by-Plugins.patch @@ -1,4 +1,4 @@ -From db5688a7eb8b6133a1ea28ecf0d59523a6fd56c4 Mon Sep 17 00:00:00 2001 +From 091244bc49de615628a6f3c70b50af9a30b3e1ef Mon Sep 17 00:00:00 2001 From: Alex Ciuba Date: Tue, 11 Jun 2013 15:23:03 -0400 Subject: [PATCH] Prevent Ghost Players Caused by Plugins @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent Ghost Players Caused by Plugins Check if the player is still connected after firing event. Fixes BUKKIT-4327 diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index e5a259d..bb13b41 100644 +index 3ddf3ae..7497560 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -423,6 +423,9 @@ public abstract class PlayerList { +@@ -467,6 +467,9 @@ public abstract class PlayerList { Player respawnPlayer = this.cserver.getPlayer(entityplayer1); PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); this.cserver.getPluginManager().callEvent(respawnEvent); @@ -20,5 +20,5 @@ index e5a259d..bb13b41 100644 location = respawnEvent.getRespawnLocation(); entityplayer.reset(); -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0060-Entity-ticking-chunk-caching.patch b/CraftBukkit-Patches/0051-Entity-ticking-chunk-caching.patch similarity index 89% rename from CraftBukkit-Patches/0060-Entity-ticking-chunk-caching.patch rename to CraftBukkit-Patches/0051-Entity-ticking-chunk-caching.patch index 1ee0365c2..5082727c5 100644 --- a/CraftBukkit-Patches/0060-Entity-ticking-chunk-caching.patch +++ b/CraftBukkit-Patches/0051-Entity-ticking-chunk-caching.patch @@ -1,4 +1,4 @@ -From 7e3f4169dfdf4b85dce2e1fa1e9a9e242cfbb030 Mon Sep 17 00:00:00 2001 +From 409b4a97107927b2825494d918cb57180710d9f1 Mon Sep 17 00:00:00 2001 From: Ammar Askar Date: Tue, 16 Jul 2013 03:32:32 +0500 Subject: [PATCH] Entity ticking chunk caching @@ -6,10 +6,10 @@ Subject: [PATCH] Entity ticking chunk caching Cache known loaded chunks so we avoid making a potentially expensive contains call for every single entity in exchange for some simple arithmetic. Best case scenario, this cuts down contains call to once per chunk, worst case it adds on some simple arithmetic operations diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e594b04..690f768 100644 +index 3f4e2d5..35537c6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1222,6 +1222,7 @@ public abstract class World implements IBlockAccess { +@@ -1200,6 +1200,7 @@ public abstract class World implements IBlockAccess { CrashReport crashreport; CrashReportSystemDetails crashreportsystemdetails; @@ -17,7 +17,7 @@ index e594b04..690f768 100644 for (i = 0; i < this.i.size(); ++i) { entity = (Entity) this.i.get(i); // CraftBukkit start - Fixed an NPE, don't process entities in chunks queued for unload -@@ -1230,10 +1231,15 @@ public abstract class World implements IBlockAccess { +@@ -1208,10 +1209,15 @@ public abstract class World implements IBlockAccess { } ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer; @@ -35,7 +35,7 @@ index e594b04..690f768 100644 try { ++entity.ticksLived; -@@ -1254,6 +1260,7 @@ public abstract class World implements IBlockAccess { +@@ -1232,6 +1238,7 @@ public abstract class World implements IBlockAccess { this.i.remove(i--); } } @@ -43,7 +43,7 @@ index e594b04..690f768 100644 this.methodProfiler.c("remove"); this.entityList.removeAll(this.f); -@@ -1284,10 +1291,15 @@ public abstract class World implements IBlockAccess { +@@ -1262,10 +1269,15 @@ public abstract class World implements IBlockAccess { // CraftBukkit start - Don't tick entities in chunks queued for unload ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer; diff --git a/CraftBukkit-Patches/0052-Always-Fire-PreLoginEvent.patch b/CraftBukkit-Patches/0052-Always-Fire-PreLoginEvent.patch deleted file mode 100644 index f125ec2f1..000000000 --- a/CraftBukkit-Patches/0052-Always-Fire-PreLoginEvent.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 508049cfb6f0192e44667d9c2594cf7211cfa3db Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 25 Jun 2013 18:09:26 +1000 -Subject: [PATCH] Always Fire PreLoginEvent - - -diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java -index 2b1df38..358cba4 100644 ---- a/src/main/java/net/minecraft/server/PendingConnection.java -+++ b/src/main/java/net/minecraft/server/PendingConnection.java -@@ -113,7 +113,7 @@ public class PendingConnection extends Connection { - } - - this.j = true; -- if (this.server.getOnlineMode()) { -+ if (true) { // Spigot - Always fire - (new ThreadLoginVerifier(this, server.server)).start(); // CraftBukkit - add CraftServer - } else { - this.h = true; -diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -index 5e45cae..70f9fea 100644 ---- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java -@@ -27,24 +27,29 @@ class ThreadLoginVerifier extends Thread { - this.pendingConnection = pendingconnection; - } - -+ private boolean auth() throws java.io.IOException { -+ String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).H().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16); -+ URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8")); -+ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openConnection(PendingConnection.b(this.pendingConnection).ap()).getInputStream())); -+ String s1 = bufferedreader.readLine(); -+ -+ bufferedreader.close(); -+ if (!"YES".equals(s1)) { -+ this.pendingConnection.disconnect("Failed to verify username!"); -+ return false; -+ } -+ -+ // CraftBukkit start -+ if (this.pendingConnection.getSocket() == null) { -+ return false; -+ } -+ return true; -+ } -+ - public void run() { - try { - if (org.spigotmc.SpamHaus.filterIp(pendingConnection)) return; // Spigot -- String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).H().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16); -- URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8")); -- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openConnection(PendingConnection.b(this.pendingConnection).ap()).getInputStream())); -- String s1 = bufferedreader.readLine(); -- -- bufferedreader.close(); -- if (!"YES".equals(s1)) { -- this.pendingConnection.disconnect("Failed to verify username!"); -- return; -- } -- -- // CraftBukkit start -- if (this.pendingConnection.getSocket() == null) { -- return; -- } -+ if (server.getOnlineMode() && !auth()) return; // Spigot - - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), ((java.net.InetSocketAddress) this.pendingConnection.networkManager.getSocketAddress()).getAddress()); // Spigot - this.server.getPluginManager().callEvent(asyncEvent); --- -1.8.1.2 - diff --git a/CraftBukkit-Patches/0061-Plug-World-Unload-Memory-Leak.patch b/CraftBukkit-Patches/0052-Plug-World-Unload-Memory-Leak.patch similarity index 88% rename from CraftBukkit-Patches/0061-Plug-World-Unload-Memory-Leak.patch rename to CraftBukkit-Patches/0052-Plug-World-Unload-Memory-Leak.patch index d926cf037..7f8f7303f 100644 --- a/CraftBukkit-Patches/0061-Plug-World-Unload-Memory-Leak.patch +++ b/CraftBukkit-Patches/0052-Plug-World-Unload-Memory-Leak.patch @@ -1,11 +1,11 @@ -From 8454656a6b1eaff2ac3e95b1104f2b196a0c2b13 Mon Sep 17 00:00:00 2001 +From 3d5b88405fa9bac3f3c128fc373bb65b577c23ca Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Aug 2013 19:02:59 +1000 Subject: [PATCH] Plug World Unload Memory Leak diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -index f176e66..d4f3c51 100644 +index 8e01414..e0469bb 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -11,7 +11,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit @@ -18,5 +18,5 @@ index f176e66..d4f3c51 100644 private boolean a(World world, int i, int j, int k, boolean flag) { if (!b.containsKey(world)) { -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0062-Player-Collision-API.patch b/CraftBukkit-Patches/0053-Player-Collision-API.patch similarity index 78% rename from CraftBukkit-Patches/0062-Player-Collision-API.patch rename to CraftBukkit-Patches/0053-Player-Collision-API.patch index 6e8ca2ebe..8dee22319 100644 --- a/CraftBukkit-Patches/0062-Player-Collision-API.patch +++ b/CraftBukkit-Patches/0053-Player-Collision-API.patch @@ -1,14 +1,14 @@ -From 4800f114024eadb7b30fcb894ce1348f3bd42359 Mon Sep 17 00:00:00 2001 +From 905390073f7d65f8c0963b5fed4e1cd85daa458d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Aug 2013 19:27:07 +1000 Subject: [PATCH] Player Collision API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 8c5a8ba..b180933 100644 +index 7442943..14f5510 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -411,7 +411,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -430,7 +430,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen List list = this.world.getEntities(this, axisalignedbb); @@ -18,11 +18,11 @@ index 8c5a8ba..b180933 100644 Entity entity = (Entity) list.get(i); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 76dfa81..de07560 100644 +index a61001d..35d30f1 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1463,7 +1463,7 @@ public abstract class EntityLiving extends Entity { - protected void bj() { +@@ -1478,7 +1478,7 @@ public abstract class EntityLiving extends Entity { + protected void bo() { List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (list != null && !list.isEmpty()) { @@ -31,10 +31,10 @@ index 76dfa81..de07560 100644 Entity entity = (Entity) list.get(i); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index d054efe..6c55250 100644 +index af08d2f..d6a384b 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -56,6 +56,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -64,6 +64,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public double maxHealthCache; public int lastPing = -1; // Spigot // CraftBukkit end @@ -54,16 +54,16 @@ index d054efe..6c55250 100644 + } + // Spigot end - public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) { - super(world, s); + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, gameprofile); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4bae056..e7ea9b4 100644 +index 0b8b324..fb53781 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1122,6 +1122,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - - getHandle().playerConnection.sendPacket( packet ); - } +@@ -1130,6 +1130,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + // Spigot start + private final Player.Spigot spigot = new Player.Spigot() + { + + @Override + public boolean getCollidesWithEntities() @@ -81,5 +81,5 @@ index 4bae056..e7ea9b4 100644 public Player.Spigot spigot() -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0063-Fully-Disable-Snooper-When-Not-Required.patch b/CraftBukkit-Patches/0054-Fully-Disable-Snooper-When-Not-Required.patch similarity index 63% rename from CraftBukkit-Patches/0063-Fully-Disable-Snooper-When-Not-Required.patch rename to CraftBukkit-Patches/0054-Fully-Disable-Snooper-When-Not-Required.patch index ac70cf4af..7d651878e 100644 --- a/CraftBukkit-Patches/0063-Fully-Disable-Snooper-When-Not-Required.patch +++ b/CraftBukkit-Patches/0054-Fully-Disable-Snooper-When-Not-Required.patch @@ -1,27 +1,27 @@ -From 0a366cc0e18159db488f1245e5ebf1b12b714351 Mon Sep 17 00:00:00 2001 +From 102e1936c0748aa6f3ead6c5afd487cb77db2cde Mon Sep 17 00:00:00 2001 From: agentk20 Date: Sat, 3 Aug 2013 19:28:48 +1000 Subject: [PATCH] Fully Disable Snooper When Not Required diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c0dfdb5..5a153de 100644 +index 5a07791..2ab8366 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -498,11 +498,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - this.I = Packet.p; +@@ -545,11 +545,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + this.f[this.ticks % 100] = System.nanoTime() - i; this.methodProfiler.b(); this.methodProfiler.a("snooper"); -- if (!this.n.d() && this.ticks > 100) { -+ if (getSnooperEnabled() && !this.n.d() && this.ticks > 100) { // Spigot - this.n.a(); +- if (!this.k.d() && this.ticks > 100) { ++ if (getSnooperEnabled() && !this.k.d() && this.ticks > 100) { // Spigot + this.k.a(); } - if (this.ticks % 6000 == 0) { + if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot - this.n.b(); + this.k.b(); } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0064-Add-Getter-for-Entity-Invulnerability.patch b/CraftBukkit-Patches/0055-Add-Getter-for-Entity-Invulnerability.patch similarity index 80% rename from CraftBukkit-Patches/0064-Add-Getter-for-Entity-Invulnerability.patch rename to CraftBukkit-Patches/0055-Add-Getter-for-Entity-Invulnerability.patch index fca181fd7..8e4ac64d5 100644 --- a/CraftBukkit-Patches/0064-Add-Getter-for-Entity-Invulnerability.patch +++ b/CraftBukkit-Patches/0055-Add-Getter-for-Entity-Invulnerability.patch @@ -1,14 +1,14 @@ -From ff0cd39627b4395a87f4190d6f9844530de8b189 Mon Sep 17 00:00:00 2001 +From dabdf5b931a35d41f2f843a35f8c3d9545892221 Mon Sep 17 00:00:00 2001 From: DerFlash Date: Sat, 3 Aug 2013 19:53:48 +1000 Subject: [PATCH] Add Getter for Entity Invulnerability diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 4f4b84f..65a77dc 100644 +index e026c1f..96d763b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -402,6 +402,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -403,6 +403,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { // Spigot start private final Spigot spigot = new Spigot() { @@ -21,5 +21,5 @@ index 4f4b84f..65a77dc 100644 public Spigot spigot() -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0065-Guard-entity-list.patch b/CraftBukkit-Patches/0056-Guard-entity-list.patch similarity index 85% rename from CraftBukkit-Patches/0065-Guard-entity-list.patch rename to CraftBukkit-Patches/0056-Guard-entity-list.patch index 62e2be5d5..454cc7bc7 100644 --- a/CraftBukkit-Patches/0065-Guard-entity-list.patch +++ b/CraftBukkit-Patches/0056-Guard-entity-list.patch @@ -1,11 +1,11 @@ -From 7fb383919a5aa0e3be32033ba0be45553a590393 Mon Sep 17 00:00:00 2001 +From e4739307ff133e2aead015ce083a58f2d3463d7e Mon Sep 17 00:00:00 2001 From: Ammar Askar Date: Sat, 3 Aug 2013 21:42:00 +0500 Subject: [PATCH] Guard entity list diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 690f768..e3ff733 100644 +index 35537c6..ede8912 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -29,7 +29,25 @@ import org.bukkit.event.weather.ThunderChangeEvent; @@ -35,15 +35,15 @@ index 690f768..e3ff733 100644 protected List f = new ArrayList(); public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet private List a = new ArrayList(); -@@ -74,6 +92,7 @@ public abstract class World implements IBlockAccess { - int[] H; - public boolean isStatic; +@@ -76,6 +94,7 @@ public abstract class World implements IBlockAccess { + int[] I; + // Spigot start + private boolean guardEntityList = false; protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; protected float growthOdds = 100; protected float modifiedOdds = 100; -@@ -1286,6 +1305,7 @@ public abstract class World implements IBlockAccess { +@@ -1264,6 +1283,7 @@ public abstract class World implements IBlockAccess { org.spigotmc.ActivationRange.activateEntities(this); // Spigot timings.entityTick.startTiming(); // Spigot @@ -51,7 +51,7 @@ index 690f768..e3ff733 100644 for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); -@@ -1333,12 +1353,15 @@ public abstract class World implements IBlockAccess { +@@ -1311,12 +1331,15 @@ public abstract class World implements IBlockAccess { this.getChunkAt(j, k).b(entity); } @@ -66,7 +66,7 @@ index 690f768..e3ff733 100644 + guardEntityList = false; // Spigot timings.entityTick.stopTiming(); // Spigot - this.methodProfiler.c("tileEntities"); + this.methodProfiler.c("blockEntities"); -- 1.8.3.2 diff --git a/CraftBukkit-Patches/0066-Cap-Minimum-Player-Speed.patch b/CraftBukkit-Patches/0057-Cap-Minimum-Player-Speed.patch similarity index 77% rename from CraftBukkit-Patches/0066-Cap-Minimum-Player-Speed.patch rename to CraftBukkit-Patches/0057-Cap-Minimum-Player-Speed.patch index 0f6a713ad..1ff9e8833 100644 --- a/CraftBukkit-Patches/0066-Cap-Minimum-Player-Speed.patch +++ b/CraftBukkit-Patches/0057-Cap-Minimum-Player-Speed.patch @@ -1,14 +1,14 @@ -From 9d02a6efdc53c838fd41d6c354f9dbd235c59b11 Mon Sep 17 00:00:00 2001 +From a9e2039b9c817fd82bf8796da1b344dbeceb6475 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 5 Aug 2013 20:17:20 +1000 Subject: [PATCH] Cap Minimum Player Speed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e7ea9b4..33674b1 100644 +index fb53781..bcfda5b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -952,7 +952,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1002,7 +1002,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setFlySpeed(float value) { validateSpeed(value); EntityPlayer player = getHandle(); @@ -17,7 +17,7 @@ index e7ea9b4..33674b1 100644 player.updateAbilities(); } -@@ -960,7 +960,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1010,7 +1010,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setWalkSpeed(float value) { validateSpeed(value); EntityPlayer player = getHandle(); @@ -27,5 +27,5 @@ index e7ea9b4..33674b1 100644 } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0057-Colour-Console-Messages.patch b/CraftBukkit-Patches/0057-Colour-Console-Messages.patch deleted file mode 100644 index d6f39b932..000000000 --- a/CraftBukkit-Patches/0057-Colour-Console-Messages.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 101c4c46597d7dfd482177fe22ddc0ef7df9d6b5 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 4 Jul 2013 10:11:46 +1000 -Subject: [PATCH] Colour Console Messages - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index dec46bd..c0dfdb5 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -917,7 +917,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - } - - public void sendMessage(ChatMessage chatmessage) { -- this.getLogger().info(chatmessage.toString()); -+ this.console.sendMessage(chatmessage.toString()); // Spigot - we want coloured and pretty messages too! - } - - public boolean a(int i, String s) { --- -1.8.1.2 - diff --git a/CraftBukkit-Patches/0067-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch b/CraftBukkit-Patches/0058-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch similarity index 74% rename from CraftBukkit-Patches/0067-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch rename to CraftBukkit-Patches/0058-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch index 821ec758f..d786913ec 100644 --- a/CraftBukkit-Patches/0067-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch +++ b/CraftBukkit-Patches/0058-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch @@ -1,17 +1,17 @@ -From e967122cbe41d627ea98e32d55f321212e57b26b Mon Sep 17 00:00:00 2001 +From e7b9d56645ff0e83b26e9e6621ffe96001288c4e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 14 Sep 2013 10:16:38 +1000 Subject: [PATCH] Update Inventory and Health for PlayerConsumeItemEvent diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index b180933..36eca0f 100644 +index 14f5510..a14e3d9 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -258,6 +258,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -277,6 +277,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen // Update client if (this instanceof EntityPlayer) { - ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + // Spigot Start + ((EntityPlayer) this).getBukkitEntity().updateInventory(); + ((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); @@ -20,5 +20,5 @@ index b180933..36eca0f 100644 return; } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0069-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch b/CraftBukkit-Patches/0059-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch similarity index 95% rename from CraftBukkit-Patches/0069-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch rename to CraftBukkit-Patches/0059-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch index 24d90d281..4c3952834 100644 --- a/CraftBukkit-Patches/0069-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch +++ b/CraftBukkit-Patches/0059-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch @@ -1,4 +1,4 @@ -From 8e379c60ac61ac1a226407eaf6bcfe97e0165501 Mon Sep 17 00:00:00 2001 +From 2df0995cba9ed8b162392ebe8bb8719b8cab7864 Mon Sep 17 00:00:00 2001 From: BlackHole Date: Tue, 16 Jul 2013 22:34:50 +0200 Subject: [PATCH] Call EntityChangeBlockEvent for Fire Arrows hitting TNT @@ -31,5 +31,5 @@ index 9acd4f2..312b4c8 100644 world.setAir(i, j, k); } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0070-Allow-Disabling-of-1.6.3-Structure-Saving.patch b/CraftBukkit-Patches/0060-Allow-Disabling-of-1.6.3-Structure-Saving.patch similarity index 96% rename from CraftBukkit-Patches/0070-Allow-Disabling-of-1.6.3-Structure-Saving.patch rename to CraftBukkit-Patches/0060-Allow-Disabling-of-1.6.3-Structure-Saving.patch index b33d14f4d..9dba14853 100644 --- a/CraftBukkit-Patches/0070-Allow-Disabling-of-1.6.3-Structure-Saving.patch +++ b/CraftBukkit-Patches/0060-Allow-Disabling-of-1.6.3-Structure-Saving.patch @@ -1,4 +1,4 @@ -From 43abae864c7a6003f326e1c8649102e9695fff3c Mon Sep 17 00:00:00 2001 +From b8c36f916c18da6c3446eb6298bfa9cdc15e8b4d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 21 Sep 2013 12:33:09 +1000 Subject: [PATCH] Allow Disabling of 1.6.3 Structure Saving @@ -47,5 +47,5 @@ index 2caafa2..a34670e 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0071-Item-Despawn-Rate.patch b/CraftBukkit-Patches/0061-Item-Despawn-Rate.patch similarity index 64% rename from CraftBukkit-Patches/0071-Item-Despawn-Rate.patch rename to CraftBukkit-Patches/0061-Item-Despawn-Rate.patch index 33eea810e..73187c75f 100644 --- a/CraftBukkit-Patches/0071-Item-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0061-Item-Despawn-Rate.patch @@ -1,22 +1,22 @@ -From cbe7a0b1db676b84316ecb88540df21103b43529 Mon Sep 17 00:00:00 2001 +From 888b4be4d4d65a9dae6c04f31efe23d1c136c00d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 22 Sep 2013 19:10:53 +1000 Subject: [PATCH] Item Despawn Rate diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 24c44ad..52878ff 100644 +index 08b9ac8..8ea7abc 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -100,7 +100,7 @@ public class EntityItem extends Entity { - } +@@ -104,7 +104,7 @@ public class EntityItem extends Entity { + } - // ++this.age; // CraftBukkit - Moved up -- if (!this.world.isStatic && this.age >= 6000) { -+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { - // CraftBukkit start - if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { - this.age = 0; + // ++this.age; // CraftBukkit - Moved up +- if (!this.world.isStatic && this.age >= 6000) { ++ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { + this.age = 0; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index a34670e..4631165 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -34,5 +34,5 @@ index a34670e..4631165 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0073-Don-t-Special-Case-X-Move-Value.patch b/CraftBukkit-Patches/0062-Don-t-Special-Case-X-Move-Value.patch similarity index 67% rename from CraftBukkit-Patches/0073-Don-t-Special-Case-X-Move-Value.patch rename to CraftBukkit-Patches/0062-Don-t-Special-Case-X-Move-Value.patch index 65b6c9a07..564cc47bc 100644 --- a/CraftBukkit-Patches/0073-Don-t-Special-Case-X-Move-Value.patch +++ b/CraftBukkit-Patches/0062-Don-t-Special-Case-X-Move-Value.patch @@ -1,22 +1,22 @@ -From 490c0a6236569702b6804ce60ad5833615302f58 Mon Sep 17 00:00:00 2001 +From 1e90d6dd86ba54a7fd68631543d9f40764aa5d41 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 10d853b..fbba359 100644 +index 2e04e71..5c86849 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -96,6 +96,7 @@ public class PlayerConnection extends Connection { +@@ -102,6 +102,7 @@ public class PlayerConnection implements PacketPlayInListener { private float lastPitch = Float.MAX_VALUE; private float lastYaw = Float.MAX_VALUE; private boolean justTeleported = false; + private boolean hasMoved; // Spigot - // For the packet15 hack :( + // For the PacketPlayOutBlockPlace hack :( Long lastPacket; -@@ -222,7 +223,7 @@ public class PlayerConnection extends Connection { +@@ -218,7 +219,7 @@ public class PlayerConnection implements PacketPlayInListener { this.lastPitch = to.getPitch(); // Skip the first time we do this @@ -25,7 +25,7 @@ index 10d853b..fbba359 100644 PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); this.server.getPluginManager().callEvent(event); -@@ -246,7 +247,7 @@ public class PlayerConnection extends Connection { +@@ -242,7 +243,7 @@ public class PlayerConnection implements PacketPlayInListener { this.justTeleported = false; return; } @@ -33,7 +33,7 @@ index 10d853b..fbba359 100644 + } else { hasMoved = true; } // Spigot - Better Check! } - if (Double.isNaN(packet10flying.x) || Double.isNaN(packet10flying.y) || Double.isNaN(packet10flying.z) || Double.isNaN(packet10flying.stance)) { + if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z) || Double.isNaN(packetplayinflying.stance)) { -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0074-Implement-respawn-API.patch b/CraftBukkit-Patches/0063-Implement-respawn-API.patch similarity index 83% rename from CraftBukkit-Patches/0074-Implement-respawn-API.patch rename to CraftBukkit-Patches/0063-Implement-respawn-API.patch index 1551fa67d..28b058c94 100644 --- a/CraftBukkit-Patches/0074-Implement-respawn-API.patch +++ b/CraftBukkit-Patches/0063-Implement-respawn-API.patch @@ -1,14 +1,14 @@ -From 6912aa737396aa58002642e475abb6f7daad090a Mon Sep 17 00:00:00 2001 +From 542bb89a252992890ee1c363339e05c3416f292b Mon Sep 17 00:00:00 2001 From: ninja- Date: Tue, 8 Oct 2013 14:34:49 +0200 Subject: [PATCH] Implement respawn API. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 33674b1..ed93040 100644 +index bcfda5b..7fecef9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1135,6 +1135,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1143,6 +1143,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getHandle().collidesWithEntities = collides; getHandle().m = collides; // First boolean of Entity } @@ -25,5 +25,5 @@ index 33674b1..ed93040 100644 public Player.Spigot spigot() -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0075-Fix-BrewingStands-Removing-NBT-Potions.patch b/CraftBukkit-Patches/0064-Fix-BrewingStands-Removing-NBT-Potions.patch similarity index 94% rename from CraftBukkit-Patches/0075-Fix-BrewingStands-Removing-NBT-Potions.patch rename to CraftBukkit-Patches/0064-Fix-BrewingStands-Removing-NBT-Potions.patch index 7ffbdfdba..1f3ea0f4f 100644 --- a/CraftBukkit-Patches/0075-Fix-BrewingStands-Removing-NBT-Potions.patch +++ b/CraftBukkit-Patches/0064-Fix-BrewingStands-Removing-NBT-Potions.patch @@ -1,4 +1,4 @@ -From 9a97b720c5e71939cb458b9f09c83a6446d1fd04 Mon Sep 17 00:00:00 2001 +From 06b934ee352dad1b2b6e8c3a3d3c794b85dab4b8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 9 Oct 2013 18:20:05 +1100 Subject: [PATCH] Fix BrewingStands Removing NBT / Potions @@ -24,5 +24,5 @@ index 270b2cb..308207a 100644 } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0076-Arrow-Despawn-Rate.patch b/CraftBukkit-Patches/0065-Arrow-Despawn-Rate.patch similarity index 85% rename from CraftBukkit-Patches/0076-Arrow-Despawn-Rate.patch rename to CraftBukkit-Patches/0065-Arrow-Despawn-Rate.patch index bbf615d47..b54418ba1 100644 --- a/CraftBukkit-Patches/0076-Arrow-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0065-Arrow-Despawn-Rate.patch @@ -1,16 +1,16 @@ -From f994c1f9c7f866dbc9defa92651248d01c324d8f Mon Sep 17 00:00:00 2001 +From 7fe7946cf5bfa020ff811aff91c7046f8e50f536 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 14 Oct 2013 19:20:10 +1100 Subject: [PATCH] Arrow Despawn Rate diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index b1d3de8..75fe81b 100644 +index 3fd3de9..a49519b 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -142,7 +142,7 @@ public class EntityArrow extends Entity implements IProjectile { +@@ -141,7 +141,7 @@ public class EntityArrow extends Entity implements IProjectile { - if (j == this.g && k == this.h) { + if (block == this.g && i == this.h) { ++this.j; - if (this.j == 1200) { + if (this.j == world.spigotConfig.arrowDespawnRate) { // Spigot @@ -34,5 +34,5 @@ index 4631165..300db67 100644 + } } -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0077-Watchdog-Thread.patch b/CraftBukkit-Patches/0066-Watchdog-Thread.patch similarity index 96% rename from CraftBukkit-Patches/0077-Watchdog-Thread.patch rename to CraftBukkit-Patches/0066-Watchdog-Thread.patch index f6c0d4fab..4e78c332d 100644 --- a/CraftBukkit-Patches/0077-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0066-Watchdog-Thread.patch @@ -1,22 +1,22 @@ -From d58927bfbd44ebba7f3fd4e55bfe75cac76110f6 Mon Sep 17 00:00:00 2001 +From d53c57c05f88c08c5cc27eb9fa227f4dccfce3f3 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Feb 2013 12:33:20 +1100 Subject: [PATCH] Watchdog Thread. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5a153de..fb8bc87 100644 +index 2ab8366..831707c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -415,6 +415,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - this.s(); +@@ -436,6 +436,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + this.t(); SpigotTimings.serverTickTimer.stopTiming(); org.spigotmc.CustomTimingsHandler.tick(); + org.spigotmc.WatchdogThread.tick(); } // Spigot end } else { -@@ -442,6 +443,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -462,6 +463,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo this.a(crashreport); } finally { try { @@ -142,10 +142,10 @@ index 0000000..3ca7a46 + } +} diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 8d8bc97..6c0a14d 100644 +index e65978b..94a1e3b 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -278,4 +278,18 @@ public class SpigotConfig +@@ -192,4 +192,18 @@ public class SpigotConfig Bukkit.getLogger().setFilter( new LogFilter() ); } @@ -292,5 +292,5 @@ index 0000000..8d6e1b4 + } +} -- -1.8.1.2 +1.8.3.2 diff --git a/CraftBukkit-Patches/0068-Nerf-Zombie-Lag-Issues.patch b/CraftBukkit-Patches/0068-Nerf-Zombie-Lag-Issues.patch deleted file mode 100644 index e57230b20..000000000 --- a/CraftBukkit-Patches/0068-Nerf-Zombie-Lag-Issues.patch +++ /dev/null @@ -1,106 +0,0 @@ -From a23ad3d71fd60b003ddeef47a6a98758a99280aa Mon Sep 17 00:00:00 2001 -From: Dylan Xaldin -Date: Sat, 14 Sep 2013 11:02:34 +1000 -Subject: [PATCH] Nerf Zombie Lag Issues - -Nerf the Zombie Lag issues in MC 1.6 - "Fixes" MC-17630 - -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java -index a07c6cf..ee4bc7e 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java -@@ -63,19 +63,88 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal { - this.b.getNavigation().h(); - } - -+ // Spigot start -+ private double pathX; -+ private double pathY; -+ private double pathZ; -+ private boolean prevPathOK; -+ private int fullRangeSearchDelay; -+ // Spigot end - public void e() { - EntityLiving entityliving = this.b.getGoalTarget(); - - this.b.getControllerLook().a(entityliving, 30.0F, 30.0F); -+ double goalDistanceSq = this.b.e( entityliving.locX, entityliving.boundingBox.b, entityliving.locZ ); // Spigot - if ((this.e || this.b.getEntitySenses().canSee(entityliving)) && --this.h <= 0) { -- this.h = 4 + this.b.aD().nextInt(7); -- this.b.getNavigation().a((Entity) entityliving, this.d); -+ // Spigot start -+ double targetMovement = entityliving.e( pathX, pathY, pathZ ); -+ // If this is true, then we are re-pathing -+ if ( ( this.h <= 0 && targetMovement >= 1.0D ) || ( this.h <= 0 && this.b.aD().nextInt( 200 ) == 0 ) ) /* EntityCreature random instance */ -+ -+ { -+ AttributeInstance rangeAttr = this.b.getAttributeInstance( GenericAttributes.b ); -+ double origRange = rangeAttr.getValue(); -+ if ( fullRangeSearchDelay > 0 ) -+ { -+ -+ double dist = Math.sqrt( goalDistanceSq ); -+ if ( dist <= 8.0D ) -+ { -+ dist = 8.0D; -+ } -+ if ( dist > origRange ) -+ { -+ dist = origRange; -+ } -+ rangeAttr.setValue( dist ); -+ } -+ -+ prevPathOK = this.b.getNavigation().a( (Entity) entityliving, this.d ); -+ -+ if ( fullRangeSearchDelay > 0 ) -+ { -+ fullRangeSearchDelay--; -+ if ( origRange > 40.0D ) -+ { -+ origRange = 40.0D; -+ } -+ rangeAttr.setValue( origRange ); -+ } -+ -+ pathX = entityliving.locX; -+ pathY = entityliving.boundingBox.b; -+ pathZ = entityliving.locZ; -+ this.h = 4 + this.b.aD().nextInt( 7 ); /* EntityCreature random instance */ -+ -+ if ( goalDistanceSq > 256.0D ) -+ { -+ if ( goalDistanceSq > 1024.0D ) -+ { -+ this.h += 8; -+ } else -+ { -+ this.h += 16; -+ } -+ } else if ( !prevPathOK ) -+ { -+ this.h += 24; -+ } -+ -+ if ( !prevPathOK || goalDistanceSq <= 256.0D ) -+ { -+ if ( fullRangeSearchDelay <= 0 ) -+ { -+ fullRangeSearchDelay = 4 + this.b.aD().nextInt( 4 ); /* EntityCreature random instance */ -+ } -+ } -+ } - } -+ // Spigot end - - this.c = Math.max(this.c - 1, 0); - double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F + entityliving.width); - -- if (this.b.e(entityliving.locX, entityliving.boundingBox.b, entityliving.locZ) <= d0) { -+ if (goalDistanceSq <= d0) { // Spigot - if (this.c <= 0) { - this.c = 20; - if (this.b.aZ() != null) { --- -1.8.1.2 - diff --git a/CraftBukkit-Patches/0072-Fix-clearing-potion-effects-on-respawn-missed-rename.patch b/CraftBukkit-Patches/0072-Fix-clearing-potion-effects-on-respawn-missed-rename.patch deleted file mode 100644 index 499bc9593..000000000 --- a/CraftBukkit-Patches/0072-Fix-clearing-potion-effects-on-respawn-missed-rename.patch +++ /dev/null @@ -1,22 +0,0 @@ -From f5c73385759005fc5622de0d33926a931e883125 Mon Sep 17 00:00:00 2001 -From: mrapple -Date: Tue, 1 Oct 2013 21:10:50 -0500 -Subject: [PATCH] Fix clearing potion effects on respawn -- missed rename - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 6c55250..d84c1be 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -958,7 +958,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.expTotal = this.newTotalExp; - this.exp = 0; - this.deathTicks = 0; -- this.aJ(); // Should be removeAllEffects. -+ this.aK(); // Should be removeAllEffects. - this.updateEffects = true; - this.activeContainer = this.defaultContainer; - this.killer = null; --- -1.8.1.2 -