diff --git a/.gitignore b/.gitignore index c101ffb154..952f896233 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ Spigot-API Spigot-Server PaperSpigot-Server PaperSpigot-API +Bukkit +CraftBukkit diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 975323705c..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "Bukkit"] - path = Bukkit - url = https://github.com/Bukkit/Bukkit.git -[submodule "CraftBukkit"] - path = CraftBukkit - url = https://github.com/Zbob750/CraftBukkit.git diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4d8c2a7bf7..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: java -jdk: - - openjdk7 - - oraclejdk7 - - oraclejdk8 -notifications: - email: false -before_install: - - git config --global user.email "admin@ecocitycraft.com" - - git config --global user.name "EcoCityCraft" - - ./applyPatches.sh diff --git a/Bukkit b/Bukkit deleted file mode 160000 index f210234e59..0000000000 --- a/Bukkit +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f210234e59275330f83b994e199c76f6abd41ee7 diff --git a/Bukkit-Patches/0001-POM-Changes.patch b/Bukkit-Patches/0001-POM-Changes.patch index 0098374138..6edc147bf7 100644 --- a/Bukkit-Patches/0001-POM-Changes.patch +++ b/Bukkit-Patches/0001-POM-Changes.patch @@ -1,21 +1,21 @@ -From 08428965ebbf972796dbd554ecca48eea639e852 Mon Sep 17 00:00:00 2001 +From 20956e8769aa775aeac3d6d21dc3860575066443 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 10:36:24 +1000 Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index 4c5937a..2e5420b 100644 +index ed69653..87c0c58 100644 --- a/pom.xml +++ b/pom.xml -@@ -1,42 +1,21 @@ +@@ -1,15 +1,29 @@ 4.0.0 - org.bukkit - bukkit + org.spigotmc + spigot-api - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - Bukkit - http://www.bukkit.org + Spigot-API @@ -25,42 +25,23 @@ index 4c5937a..2e5420b 100644 UTF-8 -- -- scm:git:git@github.com:Bukkit/Bukkit.git -- scm:git:git://github.com/Bukkit/Bukkit.git -- https://github.com/Bukkit/Bukkit/tree/master/ -- -- -- -- jenkins -- http://ci.bukkit.org -- -- -- -- -- jd.bukkit.org -- file:///home/javadocs/public_html/ -- -- -- repobo-rel -- repo.bukkit.org Releases -- http://repo.bukkit.org/content/repositories/releases/ -- -- -- repobo-snap -- repo.bukkit.org Snapshots -- http://repo.bukkit.org/content/repositories/snapshots/ -- -- + + org.spigotmc + spigot-parent + dev-SNAPSHOT + ../pom.xml + - ++ ++ ++ ++ sonatype-snapshots ++ https://oss.sonatype.org/content/repositories/public ++ ++ ++ + -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0002-Spigot-Timings.patch b/Bukkit-Patches/0002-Spigot-Timings.patch index 74a7d07ddb..7f34bea832 100644 --- a/Bukkit-Patches/0002-Spigot-Timings.patch +++ b/Bukkit-Patches/0002-Spigot-Timings.patch @@ -1,4 +1,4 @@ -From 96a0f82578677644e39e778482c983a41930140f Mon Sep 17 00:00:00 2001 +From 441af32c70779242830099187105998737549c45 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 2 Jun 2013 10:42:57 +1000 Subject: [PATCH] Spigot Timings @@ -276,7 +276,7 @@ index d2fe422..1d51908 100644 } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index b178c0d..fe723c9 100644 +index fb0bfba..3e60a7b 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -39,6 +39,7 @@ import org.bukkit.plugin.PluginLoader; @@ -295,7 +295,7 @@ index b178c0d..fe723c9 100644 /** * This class was not meant to be constructed explicitly -@@ -283,13 +285,19 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -284,13 +286,19 @@ public final class JavaPluginLoader implements PluginLoader { } } @@ -315,7 +315,7 @@ index b178c0d..fe723c9 100644 } catch (InvocationTargetException ex) { throw new EventException(ex.getCause()); } catch (Throwable t) { -@@ -297,7 +305,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -298,7 +306,7 @@ public final class JavaPluginLoader implements PluginLoader { } } }; @@ -496,5 +496,5 @@ index 0000000..8d98297 + } +} -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0003-Add-PlayerItemDamageEvent.patch b/Bukkit-Patches/0003-Add-PlayerItemDamageEvent.patch index 22c01bd5cb..97c4c7e9a0 100644 --- a/Bukkit-Patches/0003-Add-PlayerItemDamageEvent.patch +++ b/Bukkit-Patches/0003-Add-PlayerItemDamageEvent.patch @@ -1,4 +1,4 @@ -From 4b9d141d1691760cbc77af472798d0100a9fb9ba Mon Sep 17 00:00:00 2001 +From 0a83eb0476ad914249b85f2b55e76c6bdc41e253 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 4 Mar 2013 18:31:20 +1100 Subject: [PATCH] Add PlayerItemDamageEvent @@ -65,5 +65,5 @@ index 0000000..38a72ab + } +} -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0004-BungeeCord-Support.patch b/Bukkit-Patches/0004-BungeeCord-Support.patch index 2adabc7e1d..fa4e58e1d8 100644 --- a/Bukkit-Patches/0004-BungeeCord-Support.patch +++ b/Bukkit-Patches/0004-BungeeCord-Support.patch @@ -1,4 +1,4 @@ -From 279155a45dcff6fe128cf4762d5cbe88022d4a3d Mon Sep 17 00:00:00 2001 +From ef1350a00ce855de556998df6f44cc1510aae924 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 15:20:49 +1000 Subject: [PATCH] BungeeCord Support @@ -99,5 +99,5 @@ index b74b7b8..081e994 100644 * Gets the current result of the login, as an enum * -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0005-Add-Arrow-API.patch b/Bukkit-Patches/0005-Add-Arrow-API.patch index b12db3b904..e1dae53237 100644 --- a/Bukkit-Patches/0005-Add-Arrow-API.patch +++ b/Bukkit-Patches/0005-Add-Arrow-API.patch @@ -1,4 +1,4 @@ -From 19a3b2ec5ce16627a28abd11a49605b84b1e24c8 Mon Sep 17 00:00:00 2001 +From 434fe0ecc9bed38528fa1985f0e7f69f463db736 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 15:08:24 +1000 Subject: [PATCH] Add Arrow API @@ -30,5 +30,5 @@ index e49eef0..e7a32f7 100644 + Spigot spigot(); } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0006-Add-Particle-API.patch b/Bukkit-Patches/0006-Add-Particle-API.patch index fdca063367..5ba1a7d959 100644 --- a/Bukkit-Patches/0006-Add-Particle-API.patch +++ b/Bukkit-Patches/0006-Add-Particle-API.patch @@ -1,4 +1,4 @@ -From 29f3f315387ef5c5b14f55f05819030fba87062e Mon Sep 17 00:00:00 2001 +From 9df89a6e4e1111b34f0aa250d4ef06f7453c145a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 15:57:09 +1000 Subject: [PATCH] Add Particle API @@ -365,5 +365,5 @@ index 08aa71d..5217aec 100644 } } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch b/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch index e053f11dc8..2fb69601a8 100644 --- a/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch +++ b/Bukkit-Patches/0007-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch @@ -1,4 +1,4 @@ -From 7af1ecdc02b2556a955289553118dfbabde4907c Mon Sep 17 00:00:00 2001 +From eccd4ba94b9d646d2f59e678882ef616d7c07867 Mon Sep 17 00:00:00 2001 From: Andy Shulman Date: Mon, 15 Apr 2013 20:06:01 -0500 Subject: [PATCH] Define EntitySpawnEvent and SpawnerSpawnEvent @@ -216,5 +216,5 @@ index 0000000..1acb3c4 + } +} -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0008-Entity-Mount-and-Dismount-Events.patch b/Bukkit-Patches/0008-Entity-Mount-and-Dismount-Events.patch index 5b1fb492e2..8888a4fd04 100644 --- a/Bukkit-Patches/0008-Entity-Mount-and-Dismount-Events.patch +++ b/Bukkit-Patches/0008-Entity-Mount-and-Dismount-Events.patch @@ -1,4 +1,4 @@ -From f04bd1caddf61581ced67d7fec409e25b6dec9b5 Mon Sep 17 00:00:00 2001 +From 8a59d111c2a1e4028474c264c94d35fd42c9b0a7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 2 Jul 2013 20:32:53 +1000 Subject: [PATCH] Entity Mount and Dismount Events @@ -108,5 +108,5 @@ index 0000000..16aa2a7 + } +} -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0009-Update-Depends.patch b/Bukkit-Patches/0009-Update-Depends.patch index f8271061fc..3e71310b6b 100644 --- a/Bukkit-Patches/0009-Update-Depends.patch +++ b/Bukkit-Patches/0009-Update-Depends.patch @@ -1,4 +1,4 @@ -From dbf7e0b50e03150df774881195002269552f4236 Mon Sep 17 00:00:00 2001 +From 6fb58d4e83fcb4fc453990d6367c61ae6f4222e8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 4 Jul 2013 20:05:19 +1000 Subject: [PATCH] Update Depends @@ -6,10 +6,10 @@ Subject: [PATCH] Update Depends - All of these changes have been reviewed to be binary compatible and in general contract compatible with previous versions of the libraries. diff --git a/pom.xml b/pom.xml -index 2e5420b..0c9f243 100644 +index c5ce4b2..b5ad32f 100644 --- a/pom.xml +++ b/pom.xml -@@ -76,21 +76,21 @@ +@@ -83,21 +83,21 @@ org.yaml snakeyaml @@ -34,7 +34,7 @@ index 2e5420b..0c9f243 100644 jar compile -@@ -104,7 +104,7 @@ +@@ -112,7 +112,7 @@ commons-lang commons-lang @@ -44,5 +44,5 @@ index 2e5420b..0c9f243 100644 -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch b/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch index 042dcd6893..795963ab2a 100644 --- a/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch +++ b/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch @@ -1,4 +1,4 @@ -From 5cf09dcfd541d0434f843de98f040ee8fa68a3e2 Mon Sep 17 00:00:00 2001 +From 24bc955987cc5738a8df959a894418e70e42d964 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 7 Jul 2013 10:32:05 -0400 Subject: [PATCH] InventoryClickEvent getClickedInventory @@ -50,5 +50,5 @@ index 28198b8..3313d91 100644 * * @return the slot type -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch b/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch index 9172d36572..ff1d1b0494 100644 --- a/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch +++ b/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch @@ -1,4 +1,4 @@ -From 7a2bd98d4764d254ecd97211e12a2d3e5ca8162f Mon Sep 17 00:00:00 2001 +From e871dc1552f172369cd309b6ac9ed0af08f25280 Mon Sep 17 00:00:00 2001 From: Alex Bennett Date: Thu, 11 Jul 2013 15:31:32 -0500 Subject: [PATCH] Added getAllSessionData() to the Conversation API. @@ -24,5 +24,5 @@ index 4f33ff4..7390a77 100644 * this as a way to pass data through each Prompt as the conversation * develops. -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0012-Catch-Conversation-API-Errors.patch b/Bukkit-Patches/0012-Catch-Conversation-API-Errors.patch index 3ead0ad2be..e036c6d30d 100644 --- a/Bukkit-Patches/0012-Catch-Conversation-API-Errors.patch +++ b/Bukkit-Patches/0012-Catch-Conversation-API-Errors.patch @@ -1,4 +1,4 @@ -From 3f83f75a73d1b8bb56a888fedcc12c26706481b8 Mon Sep 17 00:00:00 2001 +From ed8a52ebe4d123ca8a03e1b34b463369d44a67d1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 22 Jul 2013 19:09:43 +1000 Subject: [PATCH] Catch Conversation API Errors @@ -30,5 +30,5 @@ index d4c1f6d..46912c8 100644 /** -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0013-Player-Collision-API.patch b/Bukkit-Patches/0013-Player-Collision-API.patch index cbe3cf61aa..2f739277d9 100644 --- a/Bukkit-Patches/0013-Player-Collision-API.patch +++ b/Bukkit-Patches/0013-Player-Collision-API.patch @@ -1,4 +1,4 @@ -From 79529c856d312e3ccceedf58c339fe99bff3046b Mon Sep 17 00:00:00 2001 +From 3eb055ccbeea11a57734515378a8c838e6ac764c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Aug 2013 19:20:50 +1000 Subject: [PATCH] Player Collision API @@ -37,5 +37,5 @@ index c6bb787..b879ecb 100644 Spigot spigot(); -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0014-Expand-Boolean-Prompt-Values.patch b/Bukkit-Patches/0014-Expand-Boolean-Prompt-Values.patch index b7ea82b6ca..8bd277f790 100644 --- a/Bukkit-Patches/0014-Expand-Boolean-Prompt-Values.patch +++ b/Bukkit-Patches/0014-Expand-Boolean-Prompt-Values.patch @@ -1,4 +1,4 @@ -From c473d3e1e26599df1e47fb9a6ac1517cafa50f66 Mon Sep 17 00:00:00 2001 +From 453c8160b0223029c3c10d03999501bed6a031ba Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Aug 2013 19:42:16 +1000 Subject: [PATCH] Expand Boolean Prompt Values @@ -24,5 +24,5 @@ index 3f2c97f..81ef78c 100644 } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch b/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch index 7b0c533bbd..1105f61845 100644 --- a/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch +++ b/Bukkit-Patches/0015-Add-Getter-for-Entity-Invulnerability.patch @@ -1,17 +1,17 @@ -From 8cee5c5d553dc19fe218d3432a0c353989ce885b Mon Sep 17 00:00:00 2001 +From dd4b8a4e0eaade34eea01efb407fa13d1cf4af4c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Aug 2013 19:49:36 +1000 Subject: [PATCH] Add Getter for Entity Invulnerability diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index a60172d..5a1e895 100644 +index 39c35c0..d1189ef 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -295,4 +295,22 @@ public interface Entity extends Metadatable { - * @return The current vehicle. +@@ -340,4 +340,22 @@ public interface Entity extends Metadatable { + * @return if the custom name is displayed */ - public Entity getVehicle(); + public boolean isCustomNameVisible(); + + // Spigot Start + public class Spigot @@ -32,5 +32,5 @@ index a60172d..5a1e895 100644 + // Spigot End } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0016-Add-respawn-API.patch b/Bukkit-Patches/0016-Add-respawn-API.patch index 175354d088..281f6f5ef4 100644 --- a/Bukkit-Patches/0016-Add-respawn-API.patch +++ b/Bukkit-Patches/0016-Add-respawn-API.patch @@ -1,4 +1,4 @@ -From 9e4a8d127f11485d052096dbd75d5fdd08c94c23 Mon Sep 17 00:00:00 2001 +From d352e90012958d648c73e7dddce37ddf203b4e98 Mon Sep 17 00:00:00 2001 From: ninja- Date: Tue, 8 Oct 2013 14:35:58 +0200 Subject: [PATCH] Add respawn API. @@ -24,5 +24,5 @@ index b879ecb..6559243 100644 Spigot spigot(); -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0017-Fix-Plugin-Message-API-Disconnects.patch b/Bukkit-Patches/0017-Fix-Plugin-Message-API-Disconnects.patch index 5238c32337..cedd73d9fa 100644 --- a/Bukkit-Patches/0017-Fix-Plugin-Message-API-Disconnects.patch +++ b/Bukkit-Patches/0017-Fix-Plugin-Message-API-Disconnects.patch @@ -1,4 +1,4 @@ -From acace924776c03b988c7fb27de01021d03d88c5e Mon Sep 17 00:00:00 2001 +From e2827f8e0e31219b75692ad0c866d5f4bc8bb0f3 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 19 Oct 2013 12:59:42 +1100 Subject: [PATCH] Fix Plugin Message API Disconnects @@ -26,5 +26,5 @@ index a906f8d..4c171e8 100644 } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0018-Fix-Tab-Completion-for-Some-Commands.patch b/Bukkit-Patches/0018-Fix-Tab-Completion-for-Some-Commands.patch index 072a284406..1a5f27317d 100644 --- a/Bukkit-Patches/0018-Fix-Tab-Completion-for-Some-Commands.patch +++ b/Bukkit-Patches/0018-Fix-Tab-Completion-for-Some-Commands.patch @@ -1,4 +1,4 @@ -From 7c38108c86881c6904493f24d41a0434e10368c4 Mon Sep 17 00:00:00 2001 +From 85cbff874a815bdd616d06c1131e94a3c6e404a1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 24 Dec 2013 10:14:25 +1100 Subject: [PATCH] Fix Tab Completion for Some Commands @@ -81,5 +81,5 @@ index c9ac1ce..a687fef 100644 + // Spigot End } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0019-Add-Spigot-Links.patch b/Bukkit-Patches/0019-Add-Spigot-Links.patch index 480fdcdc21..875b540518 100644 --- a/Bukkit-Patches/0019-Add-Spigot-Links.patch +++ b/Bukkit-Patches/0019-Add-Spigot-Links.patch @@ -1,4 +1,4 @@ -From 537de94f93b6632771dd62f249f28c3ff34cddc7 Mon Sep 17 00:00:00 2001 +From 7f9ceb022a4ff2257c94be5515fb4fdb5b887af4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 23 Jan 2014 13:17:38 +1100 Subject: [PATCH] Add Spigot Links @@ -25,5 +25,5 @@ index a51766e..1905b8d 100644 Compilation ----------- -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0020-Implement-Locale-Getter-for-Players.patch b/Bukkit-Patches/0020-Implement-Locale-Getter-for-Players.patch index 9e82678788..4099c291bd 100644 --- a/Bukkit-Patches/0020-Implement-Locale-Getter-for-Players.patch +++ b/Bukkit-Patches/0020-Implement-Locale-Getter-for-Players.patch @@ -1,4 +1,4 @@ -From 45c36f5748ba92a780e63663875835706017753e Mon Sep 17 00:00:00 2001 +From 285e74b3c673699d5ccf9241dc89e6cd010a3c68 Mon Sep 17 00:00:00 2001 From: Smove Date: Sat, 1 Feb 2014 18:10:49 +1100 Subject: [PATCH] Implement Locale Getter for Players @@ -26,5 +26,5 @@ index 6559243..2cc19a7 100644 Spigot spigot(); -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0021-Add-support-for-fetching-hidden-players.patch b/Bukkit-Patches/0021-Add-support-for-fetching-hidden-players.patch index 676281ff21..1eac39b701 100644 --- a/Bukkit-Patches/0021-Add-support-for-fetching-hidden-players.patch +++ b/Bukkit-Patches/0021-Add-support-for-fetching-hidden-players.patch @@ -1,4 +1,4 @@ -From f39dd83d89e165110316b184856f6f08752e3e71 Mon Sep 17 00:00:00 2001 +From a3cdd140f2359b7a19b3adbf10c770207a337070 Mon Sep 17 00:00:00 2001 From: Tux Date: Sun, 9 Feb 2014 14:02:11 -0500 Subject: [PATCH] Add support for fetching hidden players @@ -26,5 +26,5 @@ index 2cc19a7..37c8a58 100644 Spigot spigot(); -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0022-Silenceable-Lightning-API.patch b/Bukkit-Patches/0022-Silenceable-Lightning-API.patch index 7fa0c85b47..4372676640 100644 --- a/Bukkit-Patches/0022-Silenceable-Lightning-API.patch +++ b/Bukkit-Patches/0022-Silenceable-Lightning-API.patch @@ -1,4 +1,4 @@ -From 08bae09498e4734f7e5e18a2f0c6099f221cfd87 Mon Sep 17 00:00:00 2001 +From 3950fb168ff04d6e29577c9c4a08d7c2b7656b78 Mon Sep 17 00:00:00 2001 From: drXor Date: Sun, 23 Feb 2014 16:16:29 -0400 Subject: [PATCH] Silenceable Lightning API @@ -66,5 +66,5 @@ index c8b5154..1ed4ac9 100644 + Spigot spigot(); } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0023-Remove-deprecation-on-some-player-lookup-methods.patch b/Bukkit-Patches/0023-Remove-deprecation-on-some-player-lookup-methods.patch index d65758dba3..1bf102df15 100644 --- a/Bukkit-Patches/0023-Remove-deprecation-on-some-player-lookup-methods.patch +++ b/Bukkit-Patches/0023-Remove-deprecation-on-some-player-lookup-methods.patch @@ -1,4 +1,4 @@ -From 350a5f4e14e622512b2a91e3f08f52ed4ef6802b Mon Sep 17 00:00:00 2001 +From e3225adc7599d9748290a68334ec8635b803d6c1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 30 Mar 2014 15:58:22 +1100 Subject: [PATCH] Remove deprecation on some player lookup methods @@ -6,7 +6,7 @@ Subject: [PATCH] Remove deprecation on some player lookup methods Most of these methods still have plenty of use given that only one player with each name can exist at a time. Deprecating these methods renders even basic functionality such as /msg impossible without causing compiler warnings. We will maintain this API and it should be considered safe and appropriate for most use cases. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 7b25817..34f44af 100644 +index cc071c6..b85a699 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -197,7 +197,6 @@ public final class Bukkit { @@ -34,7 +34,7 @@ index 7b25817..34f44af 100644 return server.getPlayerExact(name); } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index e14e9f1..14c8a8a 100644 +index 573b33b..f861214 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -308,23 +308,17 @@ public interface Server extends PluginMessageRecipient { @@ -75,5 +75,5 @@ index e14e9f1..14c8a8a 100644 /** -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0024-Expand-team-API-to-allow-arbitrary-strings.patch b/Bukkit-Patches/0024-Expand-team-API-to-allow-arbitrary-strings.patch index c7c8174774..e4dedbe2c4 100644 --- a/Bukkit-Patches/0024-Expand-team-API-to-allow-arbitrary-strings.patch +++ b/Bukkit-Patches/0024-Expand-team-API-to-allow-arbitrary-strings.patch @@ -1,4 +1,4 @@ -From 498e18aa6f38ee56b8d883e43d3734eb20669df8 Mon Sep 17 00:00:00 2001 +From 96c041a8ac1d923260b223185fa51e9a9fdcf0d8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 17 Apr 2014 19:22:26 +1000 Subject: [PATCH] Expand team API to allow arbitrary strings. @@ -71,5 +71,5 @@ index 50c6f76..b90b9c3 100644 + // Spigot end } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0025-Add-Score.isScoreSet-Z-API.patch b/Bukkit-Patches/0025-Add-Score.isScoreSet-Z-API.patch index a2cd30d82c..c8f04e32f1 100644 --- a/Bukkit-Patches/0025-Add-Score.isScoreSet-Z-API.patch +++ b/Bukkit-Patches/0025-Add-Score.isScoreSet-Z-API.patch @@ -1,4 +1,4 @@ -From c83b72d7be864c3f36b98cea8eea17b647682116 Mon Sep 17 00:00:00 2001 +From 61249f066edcdf474dd11f93aedfa621241d4a3e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 17 Apr 2014 19:35:13 +1000 Subject: [PATCH] Add Score.isScoreSet()Z API. @@ -27,5 +27,5 @@ index 4c10346..2410cbd 100644 * Gets the scoreboard for the associated objective. * -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0026-Add-PlayerSpawnLocationEvent.patch b/Bukkit-Patches/0026-Add-PlayerSpawnLocationEvent.patch index 8ea6fdee84..20d4389dc0 100644 --- a/Bukkit-Patches/0026-Add-PlayerSpawnLocationEvent.patch +++ b/Bukkit-Patches/0026-Add-PlayerSpawnLocationEvent.patch @@ -1,4 +1,4 @@ -From 18efac72ae78fa2b9ae87f7b31d2d9d3a2348e93 Mon Sep 17 00:00:00 2001 +From 5c06d1fef805814a36289acf6f6bacdbdc29187d Mon Sep 17 00:00:00 2001 From: ninja Date: Tue, 8 Apr 2014 14:01:32 +0200 Subject: [PATCH] Add PlayerSpawnLocationEvent. @@ -61,5 +61,5 @@ index 0000000..dd3f58c + } +} -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0027-Ease-ClassLoader-Deadlocks-Where-Possible.patch b/Bukkit-Patches/0027-Ease-ClassLoader-Deadlocks-Where-Possible.patch index 6e5a971005..3a2fc47f6b 100644 --- a/Bukkit-Patches/0027-Ease-ClassLoader-Deadlocks-Where-Possible.patch +++ b/Bukkit-Patches/0027-Ease-ClassLoader-Deadlocks-Where-Possible.patch @@ -1,4 +1,4 @@ -From eefb473aac1d8fa827fa6fb06ae9831ed260b88b Mon Sep 17 00:00:00 2001 +From 1248aadefde8e330cf79289c4a87cdc47b16ebb4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 16 Jul 2014 17:24:21 +1000 Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible @@ -6,7 +6,7 @@ Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible When on Java 7 we can register the classloader as parallel capable to prevent deadlocks caused by certain scenarios. Due to the nature of PluginClassLoader this isn't completely safe, but we can make it safer by switching to concurrency focused collections. Either way this is far better than crashing the server. diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 6611342..a845e81 100644 +index fe723c9..f8ef65b 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -48,7 +48,7 @@ import org.yaml.snakeyaml.error.YAMLException; @@ -63,5 +63,5 @@ index 13f8633..4cffa13 100644 super(new URL[] {file.toURI().toURL()}, parent); Validate.notNull(loader, "Loader cannot be null"); -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0028-Fix-slow-tab-complete-for-some-commands.patch b/Bukkit-Patches/0028-Fix-slow-tab-complete-for-some-commands.patch index 4a097bcb31..f495c4b610 100644 --- a/Bukkit-Patches/0028-Fix-slow-tab-complete-for-some-commands.patch +++ b/Bukkit-Patches/0028-Fix-slow-tab-complete-for-some-commands.patch @@ -1,4 +1,4 @@ -From e76f23f838d7d7287d4b9000273d819c8bf70c95 Mon Sep 17 00:00:00 2001 +From c789d5147f42f303e3a504827abbadb3c4a72b87 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 22 Jul 2014 21:01:32 +1000 Subject: [PATCH] Fix slow tab complete for some commands. @@ -19,5 +19,5 @@ index b3fa4f8..6559b33 100644 if (StringUtil.startsWithIgnoreCase(name, args[1]) && !player.isWhitelisted()) { completions.add(name); -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch b/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch index a4383a29b7..8a91bd1c9c 100644 --- a/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch +++ b/Bukkit-Patches/0029-Undeprecate-Player-updateInventory-V.patch @@ -1,4 +1,4 @@ -From 7ed4a5c6dde8f4a5cb4d1bf9f6b1d14c40aaf100 Mon Sep 17 00:00:00 2001 +From 77013c32824c02e4395a7488b96be98859296a7a Mon Sep 17 00:00:00 2001 From: drXor Date: Wed, 23 Jul 2014 15:50:36 -0400 Subject: [PATCH] Undeprecate Player#updateInventory()V @@ -21,5 +21,5 @@ index 37c8a58..b2ad5b7 100644 /** -- -1.8.4.2 +2.1.0 diff --git a/Bukkit-Patches/0030-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/Bukkit-Patches/0030-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch index dcb58e5a03..8f29012680 100644 --- a/Bukkit-Patches/0030-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch +++ b/Bukkit-Patches/0030-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch @@ -1,4 +1,4 @@ -From a302400ed6abb7b3f54f0add03d8c6fb271962de Mon Sep 17 00:00:00 2001 +From 5ba93a51ec3f858ec324be5cbeeda7d677c91526 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 22 Aug 2014 05:31:04 -0400 Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta @@ -44,5 +44,5 @@ index 397ba11..9ae3e4c 100644 ItemMeta clone(); } -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch b/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch index d863258ee2..7a0b04ec61 100644 --- a/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch +++ b/Bukkit-Patches/0031-Skip-loading-of-plugins-which-are-not-1.8-compatible.patch @@ -1,4 +1,4 @@ -From 51cd0958df56ffd971da90b18d7010df99d02fa4 Mon Sep 17 00:00:00 2001 +From 7b6992e7d0858c798faf863a56d8e376eb4a1e81 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 1 Sep 2014 19:36:20 +1000 Subject: [PATCH] Skip loading of plugins which are not 1.8 compatible. @@ -6,10 +6,10 @@ Subject: [PATCH] Skip loading of plugins which are not 1.8 compatible. As they do not work with Spigot 1.8 builds! diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 1d51908..0b53084 100644 +index 1d51908..b3002e8 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -132,6 +132,18 @@ public final class SimplePluginManager implements PluginManager { +@@ -132,6 +132,13 @@ public final class SimplePluginManager implements PluginManager { try { description = loader.getPluginDescription(file); String name = description.getName(); @@ -19,15 +19,10 @@ index 1d51908..0b53084 100644 + server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" ); + continue; + } -+ if ( name.equalsIgnoreCase( "EchoPet" ) ) -+ { -+ server.getLogger().log( Level.WARNING, "Skipping loading of EchoPet as it does not work with Spigot 1.8 builds!" ); -+ continue; -+ } + // Spigot End if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) { server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name"); continue; -- -1.9.1 +2.1.0 diff --git a/Bukkit-Patches/0032-Spigot-Update-20140909a.patch b/Bukkit-Patches/0032-Spigot-Update-20140909a.patch deleted file mode 100644 index fb1419e959..0000000000 --- a/Bukkit-Patches/0032-Spigot-Update-20140909a.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 303ad6c8effffcf49b5c3e47f6e67de52288598e Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 11 Sep 2014 01:06:54 -0700 -Subject: [PATCH] Spigot Update - 20140909a - - -diff --git a/pom.xml b/pom.xml -index 0c9f243..ec56492 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -17,6 +17,13 @@ - ../pom.xml - - -+ -+ -+ sonatype-snapshots -+ https://oss.sonatype.org/content/repositories/public -+ -+ -+ - - - -@@ -74,6 +81,13 @@ - - - -+ net.md-5 -+ bungeecord-chat -+ 1.8-SNAPSHOT -+ jar -+ compile -+ -+ - org.yaml - snakeyaml - 1.12 -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index f861214..c560493 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -12,6 +12,7 @@ import java.util.Set; - import java.util.UUID; - import java.util.logging.Logger; - -+import net.md_5.bungee.api.chat.BaseComponent; - import org.bukkit.Warning.WarningState; - import org.bukkit.command.CommandException; - import org.bukkit.command.CommandSender; -@@ -915,6 +916,16 @@ public interface Server extends PluginMessageRecipient { - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ public void broadcast(BaseComponent component) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ public void broadcast(BaseComponent... components) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b2ad5b7..2940b21 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2,6 +2,7 @@ package org.bukkit.entity; - - import java.net.InetSocketAddress; - -+import net.md_5.bungee.api.chat.BaseComponent; - import org.bukkit.Achievement; - import org.bukkit.ChatColor; - import org.bukkit.Effect; -@@ -1102,6 +1103,16 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ public void sendMessage(BaseComponent component) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ public void sendMessage(BaseComponent... components) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); --- -1.9.4.msysgit.0 - diff --git a/Bukkit-Patches/0033-Spigot-Update-20140909b.patch b/Bukkit-Patches/0033-Spigot-Update-20140909b.patch deleted file mode 100644 index 13a7951788..0000000000 --- a/Bukkit-Patches/0033-Spigot-Update-20140909b.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ef1b2e6c084a19cbb01701d87b4ef6468ea48c01 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 12 Sep 2014 17:16:11 -0700 -Subject: [PATCH] Spigot Update - 20140909b - - -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 0b53084..b3002e8 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -138,11 +138,6 @@ public final class SimplePluginManager implements PluginManager { - server.getLogger().log( Level.WARNING, "Skipping loading of Orebfuscator as it does not work with Spigot 1.8 builds!" ); - continue; - } -- if ( name.equalsIgnoreCase( "EchoPet" ) ) -- { -- server.getLogger().log( Level.WARNING, "Skipping loading of EchoPet as it does not work with Spigot 1.8 builds!" ); -- continue; -- } - // Spigot End - if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) { - server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name"); --- -1.9.4.msysgit.0 - diff --git a/Bukkit-Patches/0034-Spigot-Update-20140911a.patch b/Bukkit-Patches/0034-Spigot-Update-20140911a.patch deleted file mode 100644 index 3d44224070..0000000000 --- a/Bukkit-Patches/0034-Spigot-Update-20140911a.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 2697b81bd9a9a950ee06d717150e9dbe3d3339fb Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 12 Sep 2014 18:20:53 -0700 -Subject: [PATCH] Spigot Update - 20140911a - - -diff --git a/pom.xml b/pom.xml -index ec56492..4bfca82 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -86,6 +86,16 @@ - 1.8-SNAPSHOT - jar - compile -+ -+ -+ com.google.code.gson -+ gson -+ -+ -+ net.sf.trove4j -+ trove4j -+ -+ - - - org.yaml --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit b/CraftBukkit deleted file mode 160000 index 07d4558b48..0000000000 --- a/CraftBukkit +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 07d4558b48d0717cb7f9e07015c76599b9fe9697 diff --git a/CraftBukkit-Patches/0001-POM-Changes.patch b/CraftBukkit-Patches/0001-POM-Changes.patch index e094ff4423..d7edc86860 100644 --- a/CraftBukkit-Patches/0001-POM-Changes.patch +++ b/CraftBukkit-Patches/0001-POM-Changes.patch @@ -1,4 +1,4 @@ -From 191d925c165b18ef460bb2956e4084602f676bf6 Mon Sep 17 00:00:00 2001 +From 02a078677cd7891bda112d4df03b4ae357c5e58c Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 2 Jul 2013 13:07:39 +1000 Subject: [PATCH] POM Changes @@ -6,7 +6,7 @@ Subject: [PATCH] POM Changes Basic changes to the build system which mark the artifact as Spigot, and the necessary code changes to ensure proper functionality. Also disables the auto updater provided by CraftBukkit as it is useless to us. diff --git a/pom.xml b/pom.xml -index 8dc82eb..6aeffa8 100644 +index e2d4c7d..64600fb 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,12 @@ @@ -18,7 +18,7 @@ index 8dc82eb..6aeffa8 100644 + org.spigotmc + spigot jar - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - CraftBukkit - http://www.bukkit.org + Spigot @@ -26,38 +26,21 @@ index 8dc82eb..6aeffa8 100644 UTF-8 -@@ -18,24 +18,12 @@ +@@ -18,6 +18,13 @@ -- -- scm:git:git://github.com/Bukkit/CraftBukkit.git -- scm:git:ssh://git@github.com/Bukkit/CraftBukkit.git -- https://github.com/Bukkit/CraftBukkit -- -- -- -- -- repobo-rel -- repo.bukkit.org Releases -- http://repo.bukkit.org/content/repositories/releases/ -- -- -- repobo-snap -- repo.bukkit.org Snapshots -- http://repo.bukkit.org/content/repositories/snapshots/ -- -- + + org.spigotmc + spigot-parent + dev-SNAPSHOT + ../pom.xml + - ++ -@@ -53,16 +41,16 @@ + repobo-snap +@@ -34,8 +41,8 @@ @@ -68,51 +51,7 @@ index 8dc82eb..6aeffa8 100644 ${project.version} jar compile - - -- org.bukkit -+ org.spigotmc - minecraft-server -- ${minecraft.version} -+ ${minecraft.version}-SNAPSHOT - jar - compile - -@@ -107,33 +95,6 @@ - gson - 2.1 - -- -- org.avaje -- ebean -- 2.7.3 -- jar -- provided -- -- -- org.yaml -- snakeyaml -- 1.9 -- jar -- provided -- -- -- com.google.guava -- guava -- 10.0 -- jar -- provided -- -- -- commons-lang -- commons-lang -- 2.3 -- provided -- - - - junit -@@ -151,15 +112,15 @@ +@@ -132,15 +139,15 @@ @@ -131,7 +70,7 @@ index 8dc82eb..6aeffa8 100644 -@@ -212,7 +173,7 @@ +@@ -193,7 +200,7 @@ org.apache.maven.plugins maven-shade-plugin @@ -140,19 +79,6 @@ index 8dc82eb..6aeffa8 100644 package -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a666131..eb0b342 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -317,7 +317,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")); -+ updater.setEnabled(false); // Spigot - updater.setSuggestChannels(configuration.getBoolean("auto-updater.suggest-channels")); - updater.getOnBroken().addAll(configuration.getStringList("auto-updater.on-broken")); - updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update")); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index f905d17..9304637 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java @@ -167,5 +93,5 @@ index f905d17..9304637 100644 if (stream != null) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0002-mc-dev-imports.patch b/CraftBukkit-Patches/0002-mc-dev-imports.patch index 29942268a4..1f15a31e05 100644 --- a/CraftBukkit-Patches/0002-mc-dev-imports.patch +++ b/CraftBukkit-Patches/0002-mc-dev-imports.patch @@ -1,4 +1,4 @@ -From 4fb010dd6b5507a47f48993899029b58f863845e Mon Sep 17 00:00:00 2001 +From 81f756d36cafb87ed4f63e55253162111eac24c7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 1 Dec 2013 15:10:48 +1100 Subject: [PATCH] mc-dev imports @@ -7,10 +7,10 @@ Imported files which are only modified by Spigot, not upstream. Files here shoul diff --git a/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java new file mode 100644 -index 0000000..d424f04 +index 0000000..13602f0 --- /dev/null +++ b/src/main/java/net/minecraft/server/AttributeRanged.java -@@ -0,0 +1,42 @@ +@@ -0,0 +1,35 @@ +package net.minecraft.server; + +public class AttributeRanged extends AttributeBase { @@ -19,8 +19,8 @@ index 0000000..d424f04 + private final double b; + private String c; + -+ public AttributeRanged(String s, double d0, double d1, double d2) { -+ super(s, d0); ++ public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) { ++ super(iattribute, s, d0); + this.a = d1; + this.b = d2; + if (d1 > d2) { @@ -37,43 +37,35 @@ index 0000000..d424f04 + return this; + } + -+ public String f() { ++ public String g() { + return this.c; + } + + public double a(double d0) { -+ if (d0 < this.a) { -+ d0 = this.a; -+ } -+ -+ if (d0 > this.b) { -+ d0 = this.b; -+ } -+ ++ d0 = MathHelper.a(d0, this.a, this.b); + return d0; + } +} diff --git a/src/main/java/net/minecraft/server/BanEntrySerializer.java b/src/main/java/net/minecraft/server/BanEntrySerializer.java new file mode 100644 -index 0000000..3b4b596 +index 0000000..b1c6ad3 --- /dev/null +++ b/src/main/java/net/minecraft/server/BanEntrySerializer.java -@@ -0,0 +1,89 @@ +@@ -0,0 +1,88 @@ +package net.minecraft.server; + ++import com.google.gson.JsonDeserializationContext; ++import com.google.gson.JsonDeserializer; ++import com.google.gson.JsonElement; ++import com.google.gson.JsonObject; ++import com.google.gson.JsonSerializationContext; ++import com.google.gson.JsonSerializer; ++import com.mojang.authlib.GameProfile; +import java.lang.reflect.Type; +import java.text.ParseException; +import java.util.Date; +import java.util.UUID; + -+import net.minecraft.util.com.google.gson.JsonDeserializationContext; -+import net.minecraft.util.com.google.gson.JsonDeserializer; -+import net.minecraft.util.com.google.gson.JsonElement; -+import net.minecraft.util.com.google.gson.JsonObject; -+import net.minecraft.util.com.google.gson.JsonSerializationContext; -+import net.minecraft.util.com.google.gson.JsonSerializer; -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +class BanEntrySerializer implements JsonDeserializer, JsonSerializer { + + final UserCache a; @@ -150,10 +142,10 @@ index 0000000..3b4b596 +} diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java new file mode 100644 -index 0000000..c5701f6 +index 0000000..3705410 --- /dev/null +++ b/src/main/java/net/minecraft/server/BiomeDecorator.java -@@ -0,0 +1,279 @@ +@@ -0,0 +1,322 @@ +package net.minecraft.server; + +import java.util.Random; @@ -162,8 +154,8 @@ index 0000000..c5701f6 + + protected World a; + protected Random b; -+ protected int c; -+ protected int d; ++ protected BlockPosition c; ++ protected CustomWorldSettingsFinal d; + protected WorldGenerator e = new WorldGenClay(4); + protected WorldGenerator f; + protected WorldGenerator g; @@ -175,16 +167,16 @@ index 0000000..c5701f6 + protected WorldGenerator m; + protected WorldGenerator n; + protected WorldGenerator o; -+ protected WorldGenFlowers p; ++ protected WorldGenerator p; + protected WorldGenerator q; + protected WorldGenerator r; -+ protected WorldGenerator s; ++ protected WorldGenFlowers s; + protected WorldGenerator t; + protected WorldGenerator u; + protected WorldGenerator v; -+ protected int w; -+ protected int x; -+ protected int y; ++ protected WorldGenerator w; ++ protected WorldGenerator x; ++ protected WorldGenerator y; + protected int z; + protected int A; + protected int B; @@ -194,42 +186,55 @@ index 0000000..c5701f6 + protected int F; + protected int G; + protected int H; -+ public boolean I; ++ protected int I; ++ protected int J; ++ protected int K; ++ public boolean L; + + public BiomeDecorator() { + this.f = new WorldGenSand(Blocks.SAND, 7); + this.g = new WorldGenSand(Blocks.GRAVEL, 6); -+ this.h = new WorldGenMinable(Blocks.DIRT, 32); -+ this.i = new WorldGenMinable(Blocks.GRAVEL, 32); -+ this.j = new WorldGenMinable(Blocks.COAL_ORE, 16); -+ this.k = new WorldGenMinable(Blocks.IRON_ORE, 8); -+ this.l = new WorldGenMinable(Blocks.GOLD_ORE, 8); -+ this.m = new WorldGenMinable(Blocks.REDSTONE_ORE, 7); -+ this.n = new WorldGenMinable(Blocks.DIAMOND_ORE, 7); -+ this.o = new WorldGenMinable(Blocks.LAPIS_ORE, 6); -+ this.p = new WorldGenFlowers(Blocks.YELLOW_FLOWER); -+ this.q = new WorldGenFlowers(Blocks.BROWN_MUSHROOM); -+ this.r = new WorldGenFlowers(Blocks.RED_MUSHROOM); -+ this.s = new WorldGenHugeMushroom(); -+ this.t = new WorldGenReed(); -+ this.u = new WorldGenCactus(); -+ this.v = new WorldGenWaterLily(); -+ this.y = 2; -+ this.z = 1; -+ this.E = 1; -+ this.F = 3; -+ this.G = 1; -+ this.I = true; ++ this.s = new WorldGenFlowers(Blocks.YELLOW_FLOWER, EnumFlowerVarient.DANDELION); ++ this.t = new WorldGenMushrooms(Blocks.BROWN_MUSHROOM); ++ this.u = new WorldGenMushrooms(Blocks.RED_MUSHROOM); ++ this.v = new WorldGenHugeMushroom(); ++ this.w = new WorldGenReed(); ++ this.x = new WorldGenCactus(); ++ this.y = new WorldGenWaterLily(); ++ this.B = 2; ++ this.C = 1; ++ this.H = 1; ++ this.I = 3; ++ this.J = 1; ++ this.L = true; + } + -+ public void a(World world, Random random, BiomeBase biomebase, int i, int j) { ++ public void a(World world, Random random, BiomeBase biomebase, BlockPosition blockposition) { + if (this.a != null) { -+ throw new RuntimeException("Already decorating!!"); ++ throw new RuntimeException("Already decorating"); + } else { + this.a = world; ++ String s = world.getWorldData().getGeneratorOptions(); ++ ++ if (s != null) { ++ this.d = CustomWorldSettings.a(s).b(); ++ } else { ++ this.d = CustomWorldSettings.a("").b(); ++ } ++ + this.b = random; -+ this.c = i; -+ this.d = j; ++ this.c = blockposition; ++ this.h = new WorldGenMinable(Blocks.DIRT.getBlockData(), this.d.I); ++ this.i = new WorldGenMinable(Blocks.GRAVEL.getBlockData(), this.d.M); ++ this.j = new WorldGenMinable(Blocks.STONE.getBlockData().set(BlockStone.VARIANT, EnumStoneVariant.GRANITE), this.d.Q); ++ this.k = new WorldGenMinable(Blocks.STONE.getBlockData().set(BlockStone.VARIANT, EnumStoneVariant.DIORITE), this.d.U); ++ this.l = new WorldGenMinable(Blocks.STONE.getBlockData().set(BlockStone.VARIANT, EnumStoneVariant.ANDESITE), this.d.Y); ++ this.m = new WorldGenMinable(Blocks.COAL_ORE.getBlockData(), this.d.ac); ++ this.n = new WorldGenMinable(Blocks.IRON_ORE.getBlockData(), this.d.ag); ++ this.o = new WorldGenMinable(Blocks.GOLD_ORE.getBlockData(), this.d.ak); ++ this.p = new WorldGenMinable(Blocks.REDSTONE_ORE.getBlockData(), this.d.ao); ++ this.q = new WorldGenMinable(Blocks.DIAMOND_ORE.getBlockData(), this.d.as); ++ this.r = new WorldGenMinable(Blocks.LAPIS_ORE.getBlockData(), this.d.aw); + this.a(biomebase); + this.a = null; + this.b = null; @@ -243,212 +248,245 @@ index 0000000..c5701f6 + int j; + int k; + -+ for (i = 0; i < this.F; ++i) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ this.f.generate(this.a, this.b, j, this.a.i(j, k), k); ++ for (i = 0; i < this.I; ++i) { ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ this.f.generate(this.a, this.b, this.a.r(this.c.a(j, 0, k))); + } + -+ for (i = 0; i < this.G; ++i) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ this.e.generate(this.a, this.b, j, this.a.i(j, k), k); ++ for (i = 0; i < this.J; ++i) { ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ this.e.generate(this.a, this.b, this.a.r(this.c.a(j, 0, k))); + } + -+ for (i = 0; i < this.E; ++i) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ this.g.generate(this.a, this.b, j, this.a.i(j, k), k); ++ for (i = 0; i < this.H; ++i) { ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ this.g.generate(this.a, this.b, this.a.r(this.c.a(j, 0, k))); + } + -+ i = this.x; ++ i = this.A; + if (this.b.nextInt(10) == 0) { + ++i; + } + + int l; -+ int i1; ++ BlockPosition blockposition; + + for (j = 0; j < i; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.a.getHighestBlockYAt(k, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; + WorldGenTreeAbstract worldgentreeabstract = biomebase.a(this.b); + -+ worldgentreeabstract.a(1.0D, 1.0D, 1.0D); -+ if (worldgentreeabstract.generate(this.a, this.b, k, i1, l)) { -+ worldgentreeabstract.b(this.a, this.b, k, i1, l); ++ worldgentreeabstract.e(); ++ blockposition = this.a.getHighestBlockYAt(this.c.a(k, 0, l)); ++ if (worldgentreeabstract.generate(this.a, this.b, blockposition)) { ++ worldgentreeabstract.a(this.a, this.b, blockposition); + } + } + -+ for (j = 0; j < this.H; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ this.s.generate(this.a, this.b, k, this.a.getHighestBlockYAt(k, l), l); ++ for (j = 0; j < this.K; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ this.v.generate(this.a, this.b, this.a.getHighestBlockYAt(this.c.a(k, 0, l))); + } + -+ for (j = 0; j < this.y; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) + 32); -+ String s = biomebase.a(this.b, k, i1, l); -+ BlockFlowers blockflowers = BlockFlowers.e(s); -+ -+ if (blockflowers.getMaterial() != Material.AIR) { -+ this.p.a(blockflowers, BlockFlowers.f(s)); -+ this.p.generate(this.a, this.b, k, i1, l); -+ } -+ } -+ -+ for (j = 0; j < this.z; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ WorldGenerator worldgenerator = biomebase.b(this.b); -+ -+ worldgenerator.generate(this.a, this.b, k, i1, l); -+ } -+ -+ for (j = 0; j < this.A; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ (new WorldGenDeadBush(Blocks.DEAD_BUSH)).generate(this.a, this.b, k, i1, l); -+ } -+ -+ for (j = 0; j < this.w; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ -+ for (i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { -+ ; -+ } -+ -+ this.v.generate(this.a, this.b, k, i1, l); -+ } ++ int i1; + + for (j = 0; j < this.B; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32); ++ blockposition = this.c.a(k, i1, l); ++ EnumFlowerVarient enumflowervarient = biomebase.a(this.b, blockposition); ++ BlockFlowers blockflowers = enumflowervarient.a().a(); ++ ++ if (blockflowers.getMaterial() != Material.AIR) { ++ this.s.a(blockflowers, enumflowervarient); ++ this.s.generate(this.a, this.b, blockposition); ++ } ++ } ++ ++ for (j = 0; j < this.C; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ biomebase.b(this.b).generate(this.a, this.b, this.c.a(k, i1, l)); ++ } ++ ++ for (j = 0; j < this.D; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ (new WorldGenDeadBush()).generate(this.a, this.b, this.c.a(k, i1, l)); ++ } ++ ++ j = 0; ++ ++ while (j < this.z) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ blockposition = this.c.a(k, i1, l); ++ ++ while (true) { ++ if (blockposition.getY() > 0) { ++ BlockPosition blockposition1 = blockposition.down(); ++ ++ if (this.a.isEmpty(blockposition1)) { ++ blockposition = blockposition1; ++ continue; ++ } ++ } ++ ++ this.y.generate(this.a, this.b, blockposition); ++ ++j; ++ break; ++ } ++ } ++ ++ for (j = 0; j < this.E; ++j) { + if (this.b.nextInt(4) == 0) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.a.getHighestBlockYAt(k, l); -+ this.q.generate(this.a, this.b, k, i1, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ BlockPosition blockposition2 = this.a.getHighestBlockYAt(this.c.a(k, 0, l)); ++ ++ this.t.generate(this.a, this.b, blockposition2); + } + + if (this.b.nextInt(8) == 0) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.r.generate(this.a, this.b, k, i1, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ blockposition = this.c.a(k, i1, l); ++ this.u.generate(this.a, this.b, blockposition); + } + } + + if (this.b.nextInt(4) == 0) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ this.q.generate(this.a, this.b, j, l, k); ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); ++ this.t.generate(this.a, this.b, this.c.a(j, l, k)); + } + + if (this.b.nextInt(8) == 0) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ this.r.generate(this.a, this.b, j, l, k); ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); ++ this.u.generate(this.a, this.b, this.c.a(j, l, k)); + } + -+ for (j = 0; j < this.C; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.t.generate(this.a, this.b, k, i1, l); ++ for (j = 0; j < this.F; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ this.w.generate(this.a, this.b, this.c.a(k, i1, l)); + } + + for (j = 0; j < 10; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.t.generate(this.a, this.b, k, i1, l); ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ this.w.generate(this.a, this.b, this.c.a(k, i1, l)); + } + + if (this.b.nextInt(32) == 0) { -+ j = this.c + this.b.nextInt(16) + 8; -+ k = this.d + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ (new WorldGenPumpkin()).generate(this.a, this.b, j, l, k); ++ j = this.b.nextInt(16) + 8; ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); ++ (new WorldGenPumpkin()).generate(this.a, this.b, this.c.a(j, l, k)); + } + -+ for (j = 0; j < this.D; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.d + this.b.nextInt(16) + 8; -+ i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ this.u.generate(this.a, this.b, k, i1, l); ++ for (j = 0; j < this.G; ++j) { ++ k = this.b.nextInt(16) + 8; ++ l = this.b.nextInt(16) + 8; ++ i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); ++ this.x.generate(this.a, this.b, this.c.a(k, i1, l)); + } + -+ if (this.I) { ++ if (this.L) { ++ BlockPosition blockposition3; ++ + for (j = 0; j < 50; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.b.nextInt(248) + 8); -+ i1 = this.d + this.b.nextInt(16) + 8; -+ (new WorldGenLiquids(Blocks.WATER)).generate(this.a, this.b, k, l, i1); ++ blockposition3 = this.c.a(this.b.nextInt(16) + 8, this.b.nextInt(this.b.nextInt(248) + 8), this.b.nextInt(16) + 8); ++ (new WorldGenLiquids(Blocks.FLOWING_WATER)).generate(this.a, this.b, blockposition3); + } + + for (j = 0; j < 20; ++j) { -+ k = this.c + this.b.nextInt(16) + 8; -+ l = this.b.nextInt(this.b.nextInt(this.b.nextInt(240) + 8) + 8); -+ i1 = this.d + this.b.nextInt(16) + 8; -+ (new WorldGenLiquids(Blocks.LAVA)).generate(this.a, this.b, k, l, i1); ++ blockposition3 = this.c.a(this.b.nextInt(16) + 8, this.b.nextInt(this.b.nextInt(this.b.nextInt(240) + 8) + 8), this.b.nextInt(16) + 8); ++ (new WorldGenLiquids(Blocks.FLOWING_LAVA)).generate(this.a, this.b, blockposition3); + } + } ++ + } + + protected void a(int i, WorldGenerator worldgenerator, int j, int k) { -+ for (int l = 0; l < i; ++l) { -+ int i1 = this.c + this.b.nextInt(16); -+ int j1 = this.b.nextInt(k - j) + j; -+ int k1 = this.d + this.b.nextInt(16); ++ int l; + -+ worldgenerator.generate(this.a, this.b, i1, j1, k1); ++ if (k < j) { ++ l = j; ++ j = k; ++ k = l; ++ } else if (k == j) { ++ if (j < 255) { ++ ++k; ++ } else { ++ --j; ++ } + } ++ ++ for (l = 0; l < i; ++l) { ++ BlockPosition blockposition = this.c.a(this.b.nextInt(16), this.b.nextInt(k - j) + j, this.b.nextInt(16)); ++ ++ worldgenerator.generate(this.a, this.b, blockposition); ++ } ++ + } + + protected void b(int i, WorldGenerator worldgenerator, int j, int k) { + for (int l = 0; l < i; ++l) { -+ int i1 = this.c + this.b.nextInt(16); -+ int j1 = this.b.nextInt(k) + this.b.nextInt(k) + (j - k); -+ int k1 = this.d + this.b.nextInt(16); ++ BlockPosition blockposition = this.c.a(this.b.nextInt(16), this.b.nextInt(k) + this.b.nextInt(k) + j - k, this.b.nextInt(16)); + -+ worldgenerator.generate(this.a, this.b, i1, j1, k1); ++ worldgenerator.generate(this.a, this.b, blockposition); + } ++ + } + + protected void a() { -+ this.a(20, this.h, 0, 256); -+ this.a(10, this.i, 0, 256); -+ this.a(20, this.j, 0, 128); -+ this.a(20, this.k, 0, 64); -+ this.a(2, this.l, 0, 32); -+ this.a(8, this.m, 0, 16); -+ this.a(1, this.n, 0, 16); -+ this.b(1, this.o, 16, 16); ++ this.a(this.d.J, this.h, this.d.K, this.d.L); ++ this.a(this.d.N, this.i, this.d.O, this.d.P); ++ this.a(this.d.V, this.k, this.d.W, this.d.X); ++ this.a(this.d.R, this.j, this.d.S, this.d.T); ++ this.a(this.d.Z, this.l, this.d.aa, this.d.ab); ++ this.a(this.d.ad, this.m, this.d.ae, this.d.af); ++ this.a(this.d.ah, this.n, this.d.ai, this.d.aj); ++ this.a(this.d.al, this.o, this.d.am, this.d.an); ++ this.a(this.d.ap, this.p, this.d.aq, this.d.ar); ++ this.a(this.d.at, this.q, this.d.au, this.d.av); ++ this.b(this.d.ax, this.r, this.d.ay, this.d.az); + } +} diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java new file mode 100644 -index 0000000..9e1ce2f +index 0000000..8c9ed4c --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockAnvil.java -@@ -0,0 +1,79 @@ +@@ -0,0 +1,78 @@ +package net.minecraft.server; + ++import com.google.common.base.Predicate; ++ +public class BlockAnvil extends BlockFalling { + -+ public static final String[] a = new String[] { "intact", "slightlyDamaged", "veryDamaged"}; -+ private static final String[] N = new String[] { "anvil_top_damaged_0", "anvil_top_damaged_1", "anvil_top_damaged_2"}; ++ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL); ++ public static final BlockStateInteger DAMAGE = BlockStateInteger.of("damage", 0, 2); + + protected BlockAnvil() { + super(Material.HEAVY); -+ this.g(0); ++ this.j(this.blockStateList.getBlockData().set(BlockAnvil.FACING, EnumDirection.NORTH).set(BlockAnvil.DAMAGE, Integer.valueOf(0))); ++ this.e(0); + this.a(CreativeModeTab.c); + } + @@ -460,70 +498,66 @@ index 0000000..9e1ce2f + return false; + } + -+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) { -+ int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3; -+ int i1 = world.getData(i, j, k) >> 2; ++ public IBlockData getPlacedState(World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { ++ EnumDirection enumdirection1 = entityliving.getDirection().e(); + -+ ++l; -+ l %= 4; -+ if (l == 0) { -+ world.setData(i, j, k, 2 | i1 << 2, 2); -+ } -+ -+ if (l == 1) { -+ world.setData(i, j, k, 3 | i1 << 2, 2); -+ } -+ -+ if (l == 2) { -+ world.setData(i, j, k, 0 | i1 << 2, 2); -+ } -+ -+ if (l == 3) { -+ world.setData(i, j, k, 1 | i1 << 2, 2); -+ } ++ return super.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityliving).set(BlockAnvil.FACING, enumdirection1).set(BlockAnvil.DAMAGE, Integer.valueOf(i >> 2)); + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { -+ if (world.isStatic) { -+ return true; -+ } else { -+ entityhuman.openAnvil(i, j, k); -+ return true; ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (!world.isStatic) { ++ entityhuman.openTileEntity(new TileEntityContainerAnvil(world, blockposition)); + } ++ ++ return true; + } + -+ public int b() { -+ return 35; ++ public int getDropData(IBlockData iblockdata) { ++ return ((Integer) iblockdata.get(BlockAnvil.DAMAGE)).intValue(); + } + -+ public int getDropData(int i) { -+ return i >> 2; -+ } ++ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ EnumDirection enumdirection = (EnumDirection) iblockaccess.getType(blockposition).get(BlockAnvil.FACING); + -+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { -+ int l = iblockaccess.getData(i, j, k) & 3; -+ -+ if (l != 3 && l != 1) { -+ this.a(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); -+ } else { ++ if (enumdirection.k() == EnumAxis.X) { + this.a(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F); ++ } else { ++ this.a(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); + } ++ + } + + protected void a(EntityFallingBlock entityfallingblock) { + entityfallingblock.a(true); + } + -+ public void a(World world, int i, int j, int k, int l) { -+ world.triggerEffect(1022, i, j, k, 0); ++ public void a_(World world, BlockPosition blockposition) { ++ world.triggerEffect(1022, blockposition, 0); + } ++ ++ public IBlockData fromLegacyData(int i) { ++ return this.getBlockData().set(BlockAnvil.FACING, EnumDirection.fromType2(i & 3)).set(BlockAnvil.DAMAGE, Integer.valueOf((i & 15) >> 2)); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ byte b0 = 0; ++ int i = b0 | ((EnumDirection) iblockdata.get(BlockAnvil.FACING)).b(); ++ ++ i |= ((Integer) iblockdata.get(BlockAnvil.DAMAGE)).intValue() << 2; ++ return i; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockAnvil.FACING, BlockAnvil.DAMAGE}); ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java new file mode 100644 -index 0000000..6ce80db +index 0000000..b30276a --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockBrewingStand.java -@@ -0,0 +1,109 @@ +@@ -0,0 +1,116 @@ +package net.minecraft.server; + +import java.util.List; @@ -531,10 +565,12 @@ index 0000000..6ce80db + +public class BlockBrewingStand extends BlockContainer { + -+ private Random a = new Random(); ++ public static final BlockStateBoolean[] HAS_BOTTLE = new BlockStateBoolean[] { BlockStateBoolean.of("has_bottle_0"), BlockStateBoolean.of("has_bottle_1"), BlockStateBoolean.of("has_bottle_2")}; ++ private final Random b = new Random(); + + public BlockBrewingStand() { + super(Material.ORE); ++ this.j(this.blockStateList.getBlockData().set(BlockBrewingStand.HAS_BOTTLE[0], Boolean.valueOf(false)).set(BlockBrewingStand.HAS_BOTTLE[1], Boolean.valueOf(false)).set(BlockBrewingStand.HAS_BOTTLE[2], Boolean.valueOf(false))); + } + + public boolean c() { @@ -542,7 +578,7 @@ index 0000000..6ce80db + } + + public int b() { -+ return 25; ++ return 3; + } + + public TileEntity a(World world, int i) { @@ -553,75 +589,53 @@ index 0000000..6ce80db + return false; + } + -+ public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { + this.a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); -+ super.a(world, i, j, k, axisalignedbb, list, entity); -+ this.g(); -+ super.a(world, i, j, k, axisalignedbb, list, entity); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.h(); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); + } + -+ public void g() { ++ public void h() { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { + if (world.isStatic) { + return true; + } else { -+ TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) world.getTileEntity(i, j, k); ++ TileEntity tileentity = world.getTileEntity(blockposition); + -+ if (tileentitybrewingstand != null) { -+ entityhuman.openBrewingStand(tileentitybrewingstand); ++ if (tileentity instanceof TileEntityBrewingStand) { ++ entityhuman.openContainer((TileEntityBrewingStand) tileentity); + } + + return true; + } + } + -+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) { ++ public void postPlace(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving, ItemStack itemstack) { + if (itemstack.hasName()) { -+ ((TileEntityBrewingStand) world.getTileEntity(i, j, k)).a(itemstack.getName()); -+ } -+ } ++ TileEntity tileentity = world.getTileEntity(blockposition); + -+ public void remove(World world, int i, int j, int k, Block block, int l) { -+ TileEntity tileentity = world.getTileEntity(i, j, k); -+ -+ if (tileentity instanceof TileEntityBrewingStand) { -+ TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) tileentity; -+ -+ for (int i1 = 0; i1 < tileentitybrewingstand.getSize(); ++i1) { -+ ItemStack itemstack = tileentitybrewingstand.getItem(i1); -+ -+ if (itemstack != null) { -+ float f = this.a.nextFloat() * 0.8F + 0.1F; -+ float f1 = this.a.nextFloat() * 0.8F + 0.1F; -+ float f2 = this.a.nextFloat() * 0.8F + 0.1F; -+ -+ while (itemstack.count > 0) { -+ int j1 = this.a.nextInt(21) + 10; -+ -+ if (j1 > itemstack.count) { -+ j1 = itemstack.count; -+ } -+ -+ itemstack.count -= j1; -+ EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getData())); -+ float f3 = 0.05F; -+ -+ entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); -+ entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F); -+ entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3); -+ world.addEntity(entityitem); -+ } -+ } ++ if (tileentity instanceof TileEntityBrewingStand) { ++ ((TileEntityBrewingStand) tileentity).a(itemstack.getName()); + } + } + -+ super.remove(world, i, j, k, block, l); + } + -+ public Item getDropType(int i, Random random, int j) { ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityBrewingStand) { ++ InventoryUtils.dropInventory(world, blockposition, (TileEntityBrewingStand) tileentity); ++ } ++ ++ super.remove(world, blockposition, iblockdata); ++ } ++ ++ public Item getDropType(IBlockData iblockdata, Random random, int i) { + return Items.BREWING_STAND; + } + @@ -629,28 +643,59 @@ index 0000000..6ce80db + return true; + } + -+ public int g(World world, int i, int j, int k, int l) { -+ return Container.b((IInventory) world.getTileEntity(i, j, k)); ++ public int l(World world, BlockPosition blockposition) { ++ return Container.a(world.getTileEntity(blockposition)); + } ++ ++ public IBlockData fromLegacyData(int i) { ++ IBlockData iblockdata = this.getBlockData(); ++ ++ for (int j = 0; j < 3; ++j) { ++ iblockdata = iblockdata.set(BlockBrewingStand.HAS_BOTTLE[j], Boolean.valueOf((i & 1 << j) > 0)); ++ } ++ ++ return iblockdata; ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ int i = 0; ++ ++ for (int j = 0; j < 3; ++j) { ++ if (((Boolean) iblockdata.get(BlockBrewingStand.HAS_BOTTLE[j])).booleanValue()) { ++ i |= 1 << j; ++ } ++ } ++ ++ return i; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockBrewingStand.HAS_BOTTLE[0], BlockBrewingStand.HAS_BOTTLE[1], BlockBrewingStand.HAS_BOTTLE[2]}); ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java new file mode 100644 -index 0000000..aa82a50 +index 0000000..d1275a3 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java -@@ -0,0 +1,186 @@ +@@ -0,0 +1,308 @@ +package net.minecraft.server; + +import java.util.Random; + +public class BlockFlowerPot extends BlockContainer { + ++ public static final BlockStateInteger LEGACY_DATA = BlockStateInteger.of("legacy_data", 0, 15); ++ public static final BlockStateEnum CONTENTS = BlockStateEnum.of("contents", EnumFlowerPotContents.class); ++ + public BlockFlowerPot() { + super(Material.ORIENTABLE); -+ this.g(); ++ this.j(this.blockStateList.getBlockData().set(BlockFlowerPot.CONTENTS, EnumFlowerPotContents.EMPTY).set(BlockFlowerPot.LEGACY_DATA, Integer.valueOf(0))); ++ this.h(); + } + -+ public void g() { ++ public void h() { + float f = 0.375F; + float f1 = f / 2.0F; + @@ -662,43 +707,38 @@ index 0000000..aa82a50 + } + + public int b() { -+ return 33; ++ return 3; + } + + public boolean d() { + return false; + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { + ItemStack itemstack = entityhuman.inventory.getItemInHand(); + + if (itemstack != null && itemstack.getItem() instanceof ItemBlock) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); + -+ if (tileentityflowerpot != null) { -+ if (tileentityflowerpot.a() != null) { ++ if (tileentityflowerpot == null) { ++ return false; ++ } else if (tileentityflowerpot.b() != null) { ++ return false; ++ } else { ++ Block block = Block.asBlock(itemstack.getItem()); ++ ++ if (!this.a(block, itemstack.getData())) { + return false; + } else { -+ Block block = Block.a(itemstack.getItem()); -+ -+ if (!this.a(block, itemstack.getData())) { -+ return false; -+ } else { -+ tileentityflowerpot.a(itemstack.getItem(), itemstack.getData()); -+ tileentityflowerpot.update(); -+ if (!world.setData(i, j, k, itemstack.getData(), 2)) { -+ world.notify(i, j, k); -+ } -+ -+ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) { -+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); -+ } -+ -+ return true; ++ tileentityflowerpot.a(itemstack.getItem(), itemstack.getData()); ++ tileentityflowerpot.update(); ++ world.notify(blockposition); ++ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) { ++ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); + } ++ ++ return true; + } -+ } else { -+ return false; + } + } else { + return false; @@ -706,65 +746,67 @@ index 0000000..aa82a50 + } + + private boolean a(Block block, int i) { -+ return block != Blocks.YELLOW_FLOWER && block != Blocks.RED_ROSE && block != Blocks.CACTUS && block != Blocks.BROWN_MUSHROOM && block != Blocks.RED_MUSHROOM && block != Blocks.SAPLING && block != Blocks.DEAD_BUSH ? block == Blocks.LONG_GRASS && i == 2 : true; ++ return block != Blocks.YELLOW_FLOWER && block != Blocks.RED_FLOWER && block != Blocks.CACTUS && block != Blocks.BROWN_MUSHROOM && block != Blocks.RED_MUSHROOM && block != Blocks.SAPLING && block != Blocks.DEADBUSH ? block == Blocks.TALLGRASS && i == EnumTallGrassType.FERN.a() : true; + } + -+ public int getDropData(World world, int i, int j, int k) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); ++ public int getDropData(World world, BlockPosition blockposition) { ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); + -+ return tileentityflowerpot != null && tileentityflowerpot.a() != null ? tileentityflowerpot.b() : 0; ++ return tileentityflowerpot != null && tileentityflowerpot.b() != null ? tileentityflowerpot.c() : 0; + } + -+ public boolean canPlace(World world, int i, int j, int k) { -+ return super.canPlace(world, i, j, k) && World.a((IBlockAccess) world, i, j - 1, k); ++ public boolean canPlace(World world, BlockPosition blockposition) { ++ return super.canPlace(world, blockposition) && World.a((IBlockAccess) world, blockposition.down()); + } + -+ public void doPhysics(World world, int i, int j, int k, Block block) { -+ if (!World.a((IBlockAccess) world, i, j - 1, k)) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); -+ } -+ } -+ -+ public void remove(World world, int i, int j, int k, Block block, int l) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); -+ -+ if (tileentityflowerpot != null && tileentityflowerpot.a() != null) { -+ this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b())); ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { ++ if (!World.a((IBlockAccess) world, blockposition.down())) { ++ this.b(world, blockposition, iblockdata, 0); ++ world.setAir(blockposition); + } + -+ super.remove(world, i, j, k, block, l); + } + -+ public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) { -+ super.a(world, i, j, k, l, entityhuman); ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); ++ ++ if (tileentityflowerpot != null && tileentityflowerpot.b() != null) { ++ a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c())); ++ } ++ ++ super.remove(world, blockposition, iblockdata); ++ } ++ ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { ++ super.a(world, blockposition, iblockdata, entityhuman); + if (entityhuman.abilities.canInstantlyBuild) { -+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k); ++ TileEntityFlowerPot tileentityflowerpot = this.d(world, blockposition); + + if (tileentityflowerpot != null) { -+ tileentityflowerpot.a(Item.getById(0), 0); ++ tileentityflowerpot.a((Item) null, 0); + } + } ++ + } + -+ public Item getDropType(int i, Random random, int j) { ++ public Item getDropType(IBlockData iblockdata, Random random, int i) { + return Items.FLOWER_POT; + } + -+ private TileEntityFlowerPot e(World world, int i, int j, int k) { -+ TileEntity tileentity = world.getTileEntity(i, j, k); ++ private TileEntityFlowerPot d(World world, BlockPosition blockposition) { ++ TileEntity tileentity = world.getTileEntity(blockposition); + -+ return tileentity != null && tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) tileentity : null; ++ return tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) tileentity : null; + } + + public TileEntity a(World world, int i) { + Object object = null; -+ byte b0 = 0; ++ int j = 0; + + switch (i) { + case 1: -+ object = Blocks.RED_ROSE; -+ b0 = 0; ++ object = Blocks.RED_FLOWER; ++ j = EnumFlowerVarient.POPPY.b(); + break; + + case 2: @@ -773,22 +815,22 @@ index 0000000..aa82a50 + + case 3: + object = Blocks.SAPLING; -+ b0 = 0; ++ j = EnumLogVariant.OAK.a(); + break; + + case 4: + object = Blocks.SAPLING; -+ b0 = 1; ++ j = EnumLogVariant.SPRUCE.a(); + break; + + case 5: + object = Blocks.SAPLING; -+ b0 = 2; ++ j = EnumLogVariant.BIRCH.a(); + break; + + case 6: + object = Blocks.SAPLING; -+ b0 = 3; ++ j = EnumLogVariant.JUNGLE.a(); + break; + + case 7: @@ -804,119 +846,421 @@ index 0000000..aa82a50 + break; + + case 10: -+ object = Blocks.DEAD_BUSH; ++ object = Blocks.DEADBUSH; + break; + + case 11: -+ object = Blocks.LONG_GRASS; -+ b0 = 2; ++ object = Blocks.TALLGRASS; ++ j = EnumTallGrassType.FERN.a(); + break; + + case 12: + object = Blocks.SAPLING; -+ b0 = 4; ++ j = EnumLogVariant.ACACIA.a(); + break; + + case 13: + object = Blocks.SAPLING; -+ b0 = 5; ++ j = EnumLogVariant.DARK_OAK.a(); + } + -+ return new TileEntityFlowerPot(Item.getItemOf((Block) object), b0); ++ return new TileEntityFlowerPot(Item.getItemOf((Block) object), j); ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockFlowerPot.CONTENTS, BlockFlowerPot.LEGACY_DATA}); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ return ((Integer) iblockdata.get(BlockFlowerPot.LEGACY_DATA)).intValue(); ++ } ++ ++ public IBlockData updateState(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { ++ EnumFlowerPotContents enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ TileEntity tileentity = iblockaccess.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityFlowerPot) { ++ TileEntityFlowerPot tileentityflowerpot = (TileEntityFlowerPot) tileentity; ++ Item item = tileentityflowerpot.b(); ++ ++ if (item instanceof ItemBlock) { ++ int i = tileentityflowerpot.c(); ++ Block block = Block.asBlock(item); ++ ++ if (block == Blocks.SAPLING) { ++ switch (SwitchHelperBlockFlowerPot.a[EnumLogVariant.a(i).ordinal()]) { ++ case 1: ++ enumflowerpotcontents = EnumFlowerPotContents.OAK_SAPLING; ++ break; ++ ++ case 2: ++ enumflowerpotcontents = EnumFlowerPotContents.SPRUCE_SAPLING; ++ break; ++ ++ case 3: ++ enumflowerpotcontents = EnumFlowerPotContents.BIRCH_SAPLING; ++ break; ++ ++ case 4: ++ enumflowerpotcontents = EnumFlowerPotContents.JUNGLE_SAPLING; ++ break; ++ ++ case 5: ++ enumflowerpotcontents = EnumFlowerPotContents.ACACIA_SAPLING; ++ break; ++ ++ case 6: ++ enumflowerpotcontents = EnumFlowerPotContents.DARK_OAK_SAPLING; ++ break; ++ ++ default: ++ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ } ++ } else if (block == Blocks.TALLGRASS) { ++ switch (i) { ++ case 0: ++ enumflowerpotcontents = EnumFlowerPotContents.DEAD_BUSH; ++ break; ++ ++ case 2: ++ enumflowerpotcontents = EnumFlowerPotContents.FERN; ++ break; ++ ++ default: ++ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ } ++ } else if (block == Blocks.YELLOW_FLOWER) { ++ enumflowerpotcontents = EnumFlowerPotContents.DANDELION; ++ } else if (block == Blocks.RED_FLOWER) { ++ switch (SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.a(EnumFlowerType.RED, i).ordinal()]) { ++ case 1: ++ enumflowerpotcontents = EnumFlowerPotContents.POPPY; ++ break; ++ ++ case 2: ++ enumflowerpotcontents = EnumFlowerPotContents.BLUE_ORCHID; ++ break; ++ ++ case 3: ++ enumflowerpotcontents = EnumFlowerPotContents.ALLIUM; ++ break; ++ ++ case 4: ++ enumflowerpotcontents = EnumFlowerPotContents.HOUSTONIA; ++ break; ++ ++ case 5: ++ enumflowerpotcontents = EnumFlowerPotContents.RED_TULIP; ++ break; ++ ++ case 6: ++ enumflowerpotcontents = EnumFlowerPotContents.ORANGE_TULIP; ++ break; ++ ++ case 7: ++ enumflowerpotcontents = EnumFlowerPotContents.WHITE_TULIP; ++ break; ++ ++ case 8: ++ enumflowerpotcontents = EnumFlowerPotContents.PINK_TULIP; ++ break; ++ ++ case 9: ++ enumflowerpotcontents = EnumFlowerPotContents.OXEYE_DAISY; ++ break; ++ ++ default: ++ enumflowerpotcontents = EnumFlowerPotContents.EMPTY; ++ } ++ } else if (block == Blocks.RED_MUSHROOM) { ++ enumflowerpotcontents = EnumFlowerPotContents.MUSHROOM_RED; ++ } else if (block == Blocks.BROWN_MUSHROOM) { ++ enumflowerpotcontents = EnumFlowerPotContents.MUSHROOM_BROWN; ++ } else if (block == Blocks.DEADBUSH) { ++ enumflowerpotcontents = EnumFlowerPotContents.DEAD_BUSH; ++ } else if (block == Blocks.CACTUS) { ++ enumflowerpotcontents = EnumFlowerPotContents.CACTUS; ++ } ++ } ++ } ++ ++ return iblockdata.set(BlockFlowerPot.CONTENTS, enumflowerpotcontents); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java +new file mode 100644 +index 0000000..cc3e340 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/BlockHopper.java +@@ -0,0 +1,152 @@ ++package net.minecraft.server; ++ ++import com.google.common.base.Predicate; ++import java.util.List; ++ ++public class BlockHopper extends BlockContainer { ++ ++ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) (new BlockHopperInnerClass1())); ++ public static final BlockStateBoolean ENABLED = BlockStateBoolean.of("enabled"); ++ ++ public BlockHopper() { ++ super(Material.ORE); ++ this.j(this.blockStateList.getBlockData().set(BlockHopper.FACING, EnumDirection.DOWN).set(BlockHopper.ENABLED, Boolean.valueOf(true))); ++ this.a(CreativeModeTab.d); ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ } ++ ++ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ } ++ ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, AxisAlignedBB axisalignedbb, List list, Entity entity) { ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ float f = 0.125F; ++ ++ this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); ++ super.a(world, blockposition, iblockdata, axisalignedbb, list, entity); ++ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ } ++ ++ public IBlockData getPlacedState(World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { ++ EnumDirection enumdirection1 = enumdirection.opposite(); ++ ++ if (enumdirection1 == EnumDirection.UP) { ++ enumdirection1 = EnumDirection.DOWN; ++ } ++ ++ return this.getBlockData().set(BlockHopper.FACING, enumdirection1).set(BlockHopper.ENABLED, Boolean.valueOf(true)); ++ } ++ ++ public TileEntity a(World world, int i) { ++ return new TileEntityHopper(); ++ } ++ ++ public void postPlace(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving, ItemStack itemstack) { ++ super.postPlace(world, blockposition, iblockdata, entityliving, itemstack); ++ if (itemstack.hasName()) { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityHopper) { ++ ((TileEntityHopper) tileentity).a(itemstack.getName()); ++ } ++ } ++ ++ } ++ ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ this.e(world, blockposition, iblockdata); ++ } ++ ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (world.isStatic) { ++ return true; ++ } else { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityHopper) { ++ entityhuman.openContainer((TileEntityHopper) tileentity); ++ } ++ ++ return true; ++ } ++ } ++ ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { ++ this.e(world, blockposition, iblockdata); ++ } ++ ++ private void e(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ boolean flag = !world.isBlockIndirectlyPowered(blockposition); ++ ++ if (flag != ((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) { ++ world.setTypeAndData(blockposition, iblockdata.set(BlockHopper.ENABLED, Boolean.valueOf(flag)), 4); ++ } ++ ++ } ++ ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntityHopper) { ++ InventoryUtils.dropInventory(world, blockposition, (TileEntityHopper) tileentity); ++ world.updateAdjacentComparators(blockposition, this); ++ } ++ ++ super.remove(world, blockposition, iblockdata); ++ } ++ ++ public int b() { ++ return 3; ++ } ++ ++ public boolean d() { ++ return false; ++ } ++ ++ public boolean c() { ++ return false; ++ } ++ ++ public static EnumDirection b(int i) { ++ return EnumDirection.fromType1(i & 7); ++ } ++ ++ public static boolean f(int i) { ++ return (i & 8) != 8; ++ } ++ ++ public boolean isComplexRedstone() { ++ return true; ++ } ++ ++ public int l(World world, BlockPosition blockposition) { ++ return Container.a(world.getTileEntity(blockposition)); ++ } ++ ++ public IBlockData fromLegacyData(int i) { ++ return this.getBlockData().set(BlockHopper.FACING, b(i)).set(BlockHopper.ENABLED, Boolean.valueOf(f(i))); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ byte b0 = 0; ++ int i = b0 | ((EnumDirection) iblockdata.get(BlockHopper.FACING)).a(); ++ ++ if (!((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) { ++ i |= 8; ++ } ++ ++ return i; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockHopper.FACING, BlockHopper.ENABLED}); + } +} diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java new file mode 100644 -index 0000000..8cc7d5e +index 0000000..cc61759 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -0,0 +1,80 @@ +@@ -0,0 +1,103 @@ +package net.minecraft.server; + -+import java.util.Random; -+ +public class BlockTNT extends Block { + ++ public static final BlockStateBoolean EXPLODE = BlockStateBoolean.of("explode"); ++ + public BlockTNT() { + super(Material.TNT); ++ this.j(this.blockStateList.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(false))); + this.a(CreativeModeTab.d); + } + -+ public void onPlace(World world, int i, int j, int k) { -+ super.onPlace(world, i, j, k); -+ if (world.isBlockIndirectlyPowered(i, j, k)) { -+ this.postBreak(world, i, j, k, 1); -+ world.setAir(i, j, k); ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ super.onPlace(world, blockposition, iblockdata); ++ if (world.isBlockIndirectlyPowered(blockposition)) { ++ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true))); ++ world.setAir(blockposition); + } ++ + } + -+ public void doPhysics(World world, int i, int j, int k, Block block) { -+ if (world.isBlockIndirectlyPowered(i, j, k)) { -+ this.postBreak(world, i, j, k, 1); -+ world.setAir(i, j, k); ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { ++ if (world.isBlockIndirectlyPowered(blockposition)) { ++ this.postBreak(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true))); ++ world.setAir(blockposition); + } ++ + } + -+ public int a(Random random) { -+ return 1; -+ } -+ -+ public void wasExploded(World world, int i, int j, int k, Explosion explosion) { ++ public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { + if (!world.isStatic) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), explosion.c()); ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), explosion.c()); + + entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8; + world.addEntity(entitytntprimed); + } + } + -+ public void postBreak(World world, int i, int j, int k, int l) { -+ this.a(world, i, j, k, l, (EntityLiving) null); ++ public void postBreak(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ this.a(world, blockposition, iblockdata, (EntityLiving) null); + } + -+ public void a(World world, int i, int j, int k, int l, EntityLiving entityliving) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) { + if (!world.isStatic) { -+ if ((l & 1) == 1) { -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), entityliving); ++ if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), entityliving); + + world.addEntity(entitytntprimed); + world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); + } ++ + } + } + -+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { -+ if (entityhuman.bF() != null && entityhuman.bF().getItem() == Items.FLINT_AND_STEEL) { -+ this.a(world, i, j, k, 1, entityhuman); -+ world.setAir(i, j, k); -+ entityhuman.bF().damage(1, entityhuman); -+ return true; -+ } else { -+ return super.interact(world, i, j, k, entityhuman, l, f, f1, f2); ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (entityhuman.bY() != null) { ++ Item item = entityhuman.bY().getItem(); ++ ++ if (item == Items.FLINT_AND_STEEL || item == Items.FIRE_CHARGE) { ++ this.a(world, blockposition, iblockdata.set(BlockTNT.EXPLODE, Boolean.valueOf(true)), (EntityLiving) entityhuman); ++ world.setAir(blockposition); ++ if (item == Items.FLINT_AND_STEEL) { ++ entityhuman.bY().damage(1, entityhuman); ++ } else if (!entityhuman.abilities.canInstantlyBuild) { ++ --entityhuman.bY().count; ++ } ++ ++ return true; ++ } + } ++ ++ return super.interact(world, blockposition, iblockdata, entityhuman, enumdirection, f, f1, f2); + } + -+ public void a(World world, int i, int j, int k, Entity entity) { -+ if (entity instanceof EntityArrow && !world.isStatic) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { ++ if (!world.isStatic && entity instanceof EntityArrow) { + EntityArrow entityarrow = (EntityArrow) entity; + + if (entityarrow.isBurning()) { -+ this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); -+ world.setAir(i, j, k); ++ this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); ++ world.setAir(blockposition); + } + } ++ + } + + public boolean a(Explosion explosion) { + return false; + } ++ ++ public IBlockData fromLegacyData(int i) { ++ return this.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf((i & 1) > 0)); ++ } ++ ++ public int toLegacyData(IBlockData iblockdata) { ++ return ((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue() ? 1 : 0; ++ } ++ ++ protected BlockStateList getStateList() { ++ return new BlockStateList(this, new IBlockState[] { BlockTNT.EXPLODE}); ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java new file mode 100644 -index 0000000..0644276 +index 0000000..c6032b2 --- /dev/null +++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -0,0 +1,94 @@ +@@ -0,0 +1,113 @@ +package net.minecraft.server; + +import java.util.Iterator; @@ -924,56 +1268,67 @@ index 0000000..0644276 +public class CommandDispatcher extends CommandHandler implements ICommandDispatcher { + + public CommandDispatcher() { -+ this.a(new CommandTime()); -+ this.a(new CommandGamemode()); -+ this.a(new CommandDifficulty()); -+ this.a(new CommandGamemodeDefault()); -+ this.a(new CommandKill()); -+ this.a(new CommandToggleDownfall()); -+ this.a(new CommandWeather()); -+ this.a(new CommandXp()); -+ this.a(new CommandTp()); -+ this.a(new CommandGive()); -+ this.a(new CommandEffect()); -+ this.a(new CommandEnchant()); -+ this.a(new CommandMe()); -+ this.a(new CommandSeed()); -+ this.a(new CommandHelp()); -+ this.a(new CommandDebug()); -+ this.a(new CommandTell()); -+ this.a(new CommandSay()); -+ this.a(new CommandSpawnpoint()); -+ this.a(new CommandSetWorldSpawn()); -+ this.a(new CommandGamerule()); -+ this.a(new CommandClear()); -+ this.a(new CommandTestFor()); -+ this.a(new CommandSpreadPlayers()); -+ this.a(new CommandPlaySound()); -+ this.a(new CommandScoreboard()); -+ this.a(new CommandAchievement()); -+ this.a(new CommandSummon()); -+ this.a(new CommandSetBlock()); -+ this.a(new CommandTestForBlock()); -+ this.a(new CommandTellRaw()); -+ if (MinecraftServer.getServer().X()) { -+ this.a(new CommandOp()); -+ this.a(new CommandDeop()); -+ this.a(new CommandStop()); -+ this.a(new CommandSaveAll()); -+ this.a(new CommandSaveOff()); -+ this.a(new CommandSaveOn()); -+ this.a(new CommandBanIp()); -+ this.a(new CommandPardonIP()); -+ this.a(new CommandBan()); -+ this.a(new CommandBanList()); -+ this.a(new CommandPardon()); -+ this.a(new CommandKick()); -+ this.a(new CommandList()); -+ this.a(new CommandWhitelist()); -+ this.a(new CommandIdleTimeout()); -+ this.a(new CommandNetstat()); ++ this.a((ICommand) (new CommandTime())); ++ this.a((ICommand) (new CommandGamemode())); ++ this.a((ICommand) (new CommandDifficulty())); ++ this.a((ICommand) (new CommandGamemodeDefault())); ++ this.a((ICommand) (new CommandKill())); ++ this.a((ICommand) (new CommandToggleDownfall())); ++ this.a((ICommand) (new CommandWeather())); ++ this.a((ICommand) (new CommandXp())); ++ this.a((ICommand) (new CommandTp())); ++ this.a((ICommand) (new CommandGive())); ++ this.a((ICommand) (new CommandReplaceItem())); ++ this.a((ICommand) (new CommandStats())); ++ this.a((ICommand) (new CommandEffect())); ++ this.a((ICommand) (new CommandEnchant())); ++ this.a((ICommand) (new CommandParticle())); ++ this.a((ICommand) (new CommandMe())); ++ this.a((ICommand) (new CommandSeed())); ++ this.a((ICommand) (new CommandHelp())); ++ this.a((ICommand) (new CommandDebug())); ++ this.a((ICommand) (new CommandTell())); ++ this.a((ICommand) (new CommandSay())); ++ this.a((ICommand) (new CommandSpawnpoint())); ++ this.a((ICommand) (new CommandSetWorldSpawn())); ++ this.a((ICommand) (new CommandGamerule())); ++ this.a((ICommand) (new CommandClear())); ++ this.a((ICommand) (new CommandTestFor())); ++ this.a((ICommand) (new CommandSpreadPlayers())); ++ this.a((ICommand) (new CommandPlaySound())); ++ this.a((ICommand) (new CommandScoreboard())); ++ this.a((ICommand) (new CommandExecute())); ++ this.a((ICommand) (new CommandTrigger())); ++ this.a((ICommand) (new CommandAchievement())); ++ this.a((ICommand) (new CommandSummon())); ++ this.a((ICommand) (new CommandSetBlock())); ++ this.a((ICommand) (new CommandFill())); ++ this.a((ICommand) (new CommandClone())); ++ this.a((ICommand) (new CommandTestForBlocks())); ++ this.a((ICommand) (new CommandBlockData())); ++ this.a((ICommand) (new CommandTestForBlock())); ++ this.a((ICommand) (new CommandTellRaw())); ++ this.a((ICommand) (new CommandWorldBorder())); ++ this.a((ICommand) (new CommandTitle())); ++ this.a((ICommand) (new CommandEntityData())); ++ if (MinecraftServer.getServer().ad()) { ++ this.a((ICommand) (new CommandOp())); ++ this.a((ICommand) (new CommandDeop())); ++ this.a((ICommand) (new CommandStop())); ++ this.a((ICommand) (new CommandSaveAll())); ++ this.a((ICommand) (new CommandSaveOff())); ++ this.a((ICommand) (new CommandSaveOn())); ++ this.a((ICommand) (new CommandBanIp())); ++ this.a((ICommand) (new CommandPardonIP())); ++ this.a((ICommand) (new CommandBan())); ++ this.a((ICommand) (new CommandBanList())); ++ this.a((ICommand) (new CommandPardon())); ++ this.a((ICommand) (new CommandKick())); ++ this.a((ICommand) (new CommandList())); ++ this.a((ICommand) (new CommandWhitelist())); ++ this.a((ICommand) (new CommandIdleTimeout())); + } else { -+ this.a(new CommandPublish()); ++ this.a((ICommand) (new CommandPublish())); + } + + CommandAbstract.a((ICommandDispatcher) this); @@ -981,8 +1336,9 @@ index 0000000..0644276 + + public void a(ICommandListener icommandlistener, ICommand icommand, int i, String s, Object... aobject) { + boolean flag = true; ++ MinecraftServer minecraftserver = MinecraftServer.getServer(); + -+ if (icommandlistener instanceof CommandBlockListenerAbstract && !MinecraftServer.getServer().worldServer[0].getGameRules().getBoolean("commandBlockOutput")) { ++ if (!icommandlistener.getSendCommandFeedback()) { + flag = false; + } + @@ -991,50 +1347,57 @@ index 0000000..0644276 + chatmessage.getChatModifier().setColor(EnumChatFormat.GRAY); + chatmessage.getChatModifier().setItalic(Boolean.valueOf(true)); + if (flag) { -+ Iterator iterator = MinecraftServer.getServer().getPlayerList().players.iterator(); ++ Iterator iterator = minecraftserver.getPlayerList().players.iterator(); + + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + -+ if (entityhuman != icommandlistener && MinecraftServer.getServer().getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(entityhuman) && (!(icommandlistener instanceof RemoteControlCommandListener) || MinecraftServer.getServer().m())) { ++ if (entityhuman != icommandlistener && minecraftserver.getPlayerList().isOp(entityhuman.getProfile()) && icommand.canUse(icommandlistener)) { + entityhuman.sendMessage(chatmessage); + } + } + } + -+ if (icommandlistener != MinecraftServer.getServer()) { -+ MinecraftServer.getServer().sendMessage(chatmessage); ++ if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands")) { ++ minecraftserver.sendMessage(chatmessage); + } + -+ if ((i & 1) != 1) { ++ boolean flag1 = minecraftserver.worldServer[0].getGameRules().getBoolean("sendCommandFeedback"); ++ ++ if (icommandlistener instanceof CommandBlockListenerAbstract) { ++ flag1 = ((CommandBlockListenerAbstract) icommandlistener).m(); ++ } ++ ++ if ((i & 1) != 1 && flag1) { + icommandlistener.sendMessage(new ChatMessage(s, aobject)); + } ++ + } +} diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java new file mode 100644 -index 0000000..2d1da33 +index 0000000..e21e68d --- /dev/null +++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -0,0 +1,306 @@ +@@ -0,0 +1,321 @@ +package net.minecraft.server; + ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; +import java.util.ArrayList; -+import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; -+ -+import net.minecraft.util.org.apache.commons.lang3.ObjectUtils; ++import org.apache.commons.lang3.ObjectUtils; + +public class DataWatcher { + + private final Entity a; + private boolean b = true; -+ private static final HashMap c = new HashMap(); -+ private final Map d = new HashMap(); ++ private static final Map c = Maps.newHashMap(); ++ private final Map d = Maps.newHashMap(); + private boolean e; + private ReadWriteLock f = new ReentrantReadWriteLock(); + @@ -1043,7 +1406,7 @@ index 0000000..2d1da33 + } + + public void a(int i, Object object) { -+ Integer integer = (Integer) c.get(object.getClass()); ++ Integer integer = (Integer) DataWatcher.c.get(object.getClass()); + + if (integer == null) { + throw new IllegalArgumentException("Unknown data type: " + object.getClass()); @@ -1062,7 +1425,7 @@ index 0000000..2d1da33 + } + + public void add(int i, int j) { -+ WatchableObject watchableobject = new WatchableObject(j, i, null); ++ WatchableObject watchableobject = new WatchableObject(j, i, (Object) null); + + this.f.writeLock().lock(); + this.d.put(Integer.valueOf(i), watchableobject); @@ -1071,30 +1434,30 @@ index 0000000..2d1da33 + } + + public byte getByte(int i) { -+ return ((Byte) this.i(i).b()).byteValue(); ++ return ((Byte) this.j(i).b()).byteValue(); + } + + public short getShort(int i) { -+ return ((Short) this.i(i).b()).shortValue(); ++ return ((Short) this.j(i).b()).shortValue(); + } + + public int getInt(int i) { -+ return ((Integer) this.i(i).b()).intValue(); ++ return ((Integer) this.j(i).b()).intValue(); + } + + public float getFloat(int i) { -+ return ((Float) this.i(i).b()).floatValue(); ++ return ((Float) this.j(i).b()).floatValue(); + } + + public String getString(int i) { -+ return (String) this.i(i).b(); ++ return (String) this.j(i).b(); + } + + public ItemStack getItemStack(int i) { -+ return (ItemStack) this.i(i).b(); ++ return (ItemStack) this.j(i).b(); + } + -+ private WatchableObject i(int i) { ++ private WatchableObject j(int i) { + this.f.readLock().lock(); + + WatchableObject watchableobject; @@ -1105,7 +1468,7 @@ index 0000000..2d1da33 + CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data"); + -+ crashreportsystemdetails.a("Data ID", Integer.valueOf(i)); ++ crashreportsystemdetails.a("Data ID", (Object) Integer.valueOf(i)); + throw new ReportedException(crashreport); + } + @@ -1113,8 +1476,12 @@ index 0000000..2d1da33 + return watchableobject; + } + ++ public Vector3f h(int i) { ++ return (Vector3f) this.j(i).b(); ++ } ++ + public void watch(int i, Object object) { -+ WatchableObject watchableobject = this.i(i); ++ WatchableObject watchableobject = this.j(i); + + if (ObjectUtils.notEqual(object, watchableobject.b())) { + watchableobject.a(object); @@ -1122,10 +1489,11 @@ index 0000000..2d1da33 + watchableobject.a(true); + this.e = true; + } ++ + } + + public void update(int i) { -+ WatchableObject.a(this.i(i), true); ++ WatchableObject.a(this.j(i), true); + this.e = true; + } + @@ -1160,7 +1528,7 @@ index 0000000..2d1da33 + if (watchableobject.d()) { + watchableobject.a(false); + if (arraylist == null) { -+ arraylist = new ArrayList(); ++ arraylist = Lists.newArrayList(); + } + + arraylist.add(watchableobject); @@ -1198,7 +1566,7 @@ index 0000000..2d1da33 + for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) { + watchableobject = (WatchableObject) iterator.next(); + if (arraylist == null) { -+ arraylist = new ArrayList(); ++ arraylist = Lists.newArrayList(); + } + } + @@ -1228,11 +1596,7 @@ index 0000000..2d1da33 + break; + + case 4: -+ try { -+ packetdataserializer.a((String) watchableobject.b()); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } ++ packetdataserializer.a((String) watchableobject.b()); + break; + + case 5: @@ -1242,12 +1606,21 @@ index 0000000..2d1da33 + break; + + case 6: -+ ChunkCoordinates chunkcoordinates = (ChunkCoordinates) watchableobject.b(); ++ BlockPosition blockposition = (BlockPosition) watchableobject.b(); + -+ packetdataserializer.writeInt(chunkcoordinates.x); -+ packetdataserializer.writeInt(chunkcoordinates.y); -+ packetdataserializer.writeInt(chunkcoordinates.z); ++ packetdataserializer.writeInt(blockposition.getX()); ++ packetdataserializer.writeInt(blockposition.getY()); ++ packetdataserializer.writeInt(blockposition.getZ()); ++ break; ++ ++ case 7: ++ Vector3f vector3f = (Vector3f) watchableobject.b(); ++ ++ packetdataserializer.writeFloat(vector3f.getX()); ++ packetdataserializer.writeFloat(vector3f.getY()); ++ packetdataserializer.writeFloat(vector3f.getZ()); + } ++ + } + + public static List b(PacketDataSerializer packetdataserializer) { @@ -1255,7 +1628,7 @@ index 0000000..2d1da33 + + for (byte b0 = packetdataserializer.readByte(); b0 != 127; b0 = packetdataserializer.readByte()) { + if (arraylist == null) { -+ arraylist = new ArrayList(); ++ arraylist = Lists.newArrayList(); + } + + int i = (b0 & 224) >> 5; @@ -1280,15 +1653,11 @@ index 0000000..2d1da33 + break; + + case 4: -+ try { -+ watchableobject = new WatchableObject(i, j, packetdataserializer.c(32767)); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } ++ watchableobject = new WatchableObject(i, j, packetdataserializer.c(32767)); + break; + + case 5: -+ watchableobject = new WatchableObject(i, j, packetdataserializer.c()); ++ watchableobject = new WatchableObject(i, j, packetdataserializer.i()); + break; + + case 6: @@ -1296,7 +1665,15 @@ index 0000000..2d1da33 + int l = packetdataserializer.readInt(); + int i1 = packetdataserializer.readInt(); + -+ watchableobject = new WatchableObject(i, j, new ChunkCoordinates(k, l, i1)); ++ watchableobject = new WatchableObject(i, j, new BlockPosition(k, l, i1)); ++ break; ++ ++ case 7: ++ float f = packetdataserializer.readFloat(); ++ float f1 = packetdataserializer.readFloat(); ++ float f2 = packetdataserializer.readFloat(); ++ ++ watchableobject = new WatchableObject(i, j, new Vector3f(f, f1, f2)); + } + + arraylist.add(watchableobject); @@ -1314,29 +1691,877 @@ index 0000000..2d1da33 + } + + static { -+ c.put(Byte.class, Integer.valueOf(0)); -+ c.put(Short.class, Integer.valueOf(1)); -+ c.put(Integer.class, Integer.valueOf(2)); -+ c.put(Float.class, Integer.valueOf(3)); -+ c.put(String.class, Integer.valueOf(4)); -+ c.put(ItemStack.class, Integer.valueOf(5)); -+ c.put(ChunkCoordinates.class, Integer.valueOf(6)); ++ DataWatcher.c.put(Byte.class, Integer.valueOf(0)); ++ DataWatcher.c.put(Short.class, Integer.valueOf(1)); ++ DataWatcher.c.put(Integer.class, Integer.valueOf(2)); ++ DataWatcher.c.put(Float.class, Integer.valueOf(3)); ++ DataWatcher.c.put(String.class, Integer.valueOf(4)); ++ DataWatcher.c.put(ItemStack.class, Integer.valueOf(5)); ++ DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6)); ++ DataWatcher.c.put(Vector3f.class, Integer.valueOf(7)); + } +} +diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java +new file mode 100644 +index 0000000..c624190 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentManager.java +@@ -0,0 +1,378 @@ ++package net.minecraft.server; ++ ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; ++import java.util.ArrayList; ++import java.util.HashMap; ++import java.util.Iterator; ++import java.util.LinkedHashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.Random; ++ ++public class EnchantmentManager { ++ ++ private static final Random a = new Random(); ++ private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass) null); ++ private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass) null); ++ private static final EnchantmentModifierThorns d = new EnchantmentModifierThorns((EmptyClass) null); ++ private static final EnchantmentModifierArthropods e = new EnchantmentModifierArthropods((EmptyClass) null); ++ ++ public static int getEnchantmentLevel(int i, ItemStack itemstack) { ++ if (itemstack == null) { ++ return 0; ++ } else { ++ NBTTagList nbttaglist = itemstack.getEnchantments(); ++ ++ if (nbttaglist == null) { ++ return 0; ++ } else { ++ for (int j = 0; j < nbttaglist.size(); ++j) { ++ short short0 = nbttaglist.get(j).getShort("id"); ++ short short1 = nbttaglist.get(j).getShort("lvl"); ++ ++ if (short0 == i) { ++ return short1; ++ } ++ } ++ ++ return 0; ++ } ++ } ++ } ++ ++ public static Map a(ItemStack itemstack) { ++ LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(); ++ NBTTagList nbttaglist = itemstack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK.h(itemstack) : itemstack.getEnchantments(); ++ ++ if (nbttaglist != null) { ++ for (int i = 0; i < nbttaglist.size(); ++i) { ++ short short0 = nbttaglist.get(i).getShort("id"); ++ short short1 = nbttaglist.get(i).getShort("lvl"); ++ ++ linkedhashmap.put(Integer.valueOf(short0), Integer.valueOf(short1)); ++ } ++ } ++ ++ return linkedhashmap; ++ } ++ ++ public static void a(Map map, ItemStack itemstack) { ++ NBTTagList nbttaglist = new NBTTagList(); ++ Iterator iterator = map.keySet().iterator(); ++ ++ while (iterator.hasNext()) { ++ int i = ((Integer) iterator.next()).intValue(); ++ Enchantment enchantment = Enchantment.getById(i); ++ ++ if (enchantment != null) { ++ NBTTagCompound nbttagcompound = new NBTTagCompound(); ++ ++ nbttagcompound.setShort("id", (short) i); ++ nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue()); ++ nbttaglist.add(nbttagcompound); ++ if (itemstack.getItem() == Items.ENCHANTED_BOOK) { ++ Items.ENCHANTED_BOOK.a(itemstack, new WeightedRandomEnchant(enchantment, ((Integer) map.get(Integer.valueOf(i))).intValue())); ++ } ++ } ++ } ++ ++ if (nbttaglist.size() > 0) { ++ if (itemstack.getItem() != Items.ENCHANTED_BOOK) { ++ itemstack.a("ench", (NBTBase) nbttaglist); ++ } ++ } else if (itemstack.hasTag()) { ++ itemstack.getTag().remove("ench"); ++ } ++ ++ } ++ ++ public static int a(int i, ItemStack[] aitemstack) { ++ if (aitemstack == null) { ++ return 0; ++ } else { ++ int j = 0; ++ ItemStack[] aitemstack1 = aitemstack; ++ int k = aitemstack.length; ++ ++ for (int l = 0; l < k; ++l) { ++ ItemStack itemstack = aitemstack1[l]; ++ int i1 = getEnchantmentLevel(i, itemstack); ++ ++ if (i1 > j) { ++ j = i1; ++ } ++ } ++ ++ return j; ++ } ++ } ++ ++ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { ++ if (itemstack != null) { ++ NBTTagList nbttaglist = itemstack.getEnchantments(); ++ ++ if (nbttaglist != null) { ++ for (int i = 0; i < nbttaglist.size(); ++i) { ++ short short0 = nbttaglist.get(i).getShort("id"); ++ short short1 = nbttaglist.get(i).getShort("lvl"); ++ ++ if (Enchantment.getById(short0) != null) { ++ enchantmentmodifier.a(Enchantment.getById(short0), short1); ++ } ++ } ++ ++ } ++ } ++ } ++ ++ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack[] aitemstack) { ++ ItemStack[] aitemstack1 = aitemstack; ++ int i = aitemstack.length; ++ ++ for (int j = 0; j < i; ++j) { ++ ItemStack itemstack = aitemstack1[j]; ++ ++ a(enchantmentmodifier, itemstack); ++ } ++ ++ } ++ ++ public static int a(ItemStack[] aitemstack, DamageSource damagesource) { ++ EnchantmentManager.b.a = 0; ++ EnchantmentManager.b.b = damagesource; ++ a((EnchantmentModifier) EnchantmentManager.b, aitemstack); ++ if (EnchantmentManager.b.a > 25) { ++ EnchantmentManager.b.a = 25; ++ } ++ ++ return (EnchantmentManager.b.a + 1 >> 1) + EnchantmentManager.a.nextInt((EnchantmentManager.b.a >> 1) + 1); ++ } ++ ++ public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) { ++ EnchantmentManager.c.a = 0.0F; ++ EnchantmentManager.c.b = enummonstertype; ++ a((EnchantmentModifier) EnchantmentManager.c, itemstack); ++ return EnchantmentManager.c.a; ++ } ++ ++ public static void a(EntityLiving entityliving, Entity entity) { ++ EnchantmentManager.d.b = entity; ++ EnchantmentManager.d.a = entityliving; ++ if (entityliving != null) { ++ a((EnchantmentModifier) EnchantmentManager.d, entityliving.getEquipment()); ++ } ++ ++ if (entity instanceof EntityHuman) { ++ a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz()); ++ } ++ ++ } ++ ++ public static void b(EntityLiving entityliving, Entity entity) { ++ EnchantmentManager.e.a = entityliving; ++ EnchantmentManager.e.b = entity; ++ if (entityliving != null) { ++ a((EnchantmentModifier) EnchantmentManager.e, entityliving.getEquipment()); ++ } ++ ++ if (entityliving instanceof EntityHuman) { ++ a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz()); ++ } ++ ++ } ++ ++ public static int a(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.bz()); ++ } ++ ++ public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.bz()); ++ } ++ ++ public static int getOxygenEnchantmentLevel(Entity entity) { ++ return a(Enchantment.OXYGEN.id, entity.getEquipment()); ++ } ++ ++ public static int b(Entity entity) { ++ return a(Enchantment.DEPTH_STRIDER.id, entity.getEquipment()); ++ } ++ ++ public static int getDigSpeedEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.bz()); ++ } ++ ++ public static boolean hasSilkTouchEnchantment(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.bz()) > 0; ++ } ++ ++ public static int getBonusBlockLootEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.bz()); ++ } ++ ++ public static int g(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.bz()); ++ } ++ ++ public static int h(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.bz()); ++ } ++ ++ public static int getBonusMonsterLootEnchantmentLevel(EntityLiving entityliving) { ++ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.bz()); ++ } ++ ++ public static boolean j(EntityLiving entityliving) { ++ return a(Enchantment.WATER_WORKER.id, entityliving.getEquipment()) > 0; ++ } ++ ++ public static ItemStack a(Enchantment enchantment, EntityLiving entityliving) { ++ ItemStack[] aitemstack = entityliving.getEquipment(); ++ int i = aitemstack.length; ++ ++ for (int j = 0; j < i; ++j) { ++ ItemStack itemstack = aitemstack[j]; ++ ++ if (itemstack != null && getEnchantmentLevel(enchantment.id, itemstack) > 0) { ++ return itemstack; ++ } ++ } ++ ++ return null; ++ } ++ ++ public static int a(Random random, int i, int j, ItemStack itemstack) { ++ Item item = itemstack.getItem(); ++ int k = item.b(); ++ ++ if (k <= 0) { ++ return 0; ++ } else { ++ if (j > 15) { ++ j = 15; ++ } ++ ++ int l = random.nextInt(8) + 1 + (j >> 1) + random.nextInt(j + 1); ++ ++ return i == 0 ? Math.max(l / 3, 1) : (i == 1 ? l * 2 / 3 + 1 : Math.max(l, j * 2)); ++ } ++ } ++ ++ public static ItemStack a(Random random, ItemStack itemstack, int i) { ++ List list = b(random, itemstack, i); ++ boolean flag = itemstack.getItem() == Items.BOOK; ++ ++ if (flag) { ++ itemstack.setItem(Items.ENCHANTED_BOOK); ++ } ++ ++ if (list != null) { ++ Iterator iterator = list.iterator(); ++ ++ while (iterator.hasNext()) { ++ WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) iterator.next(); ++ ++ if (flag) { ++ Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant); ++ } else { ++ itemstack.addEnchantment(weightedrandomenchant.enchantment, weightedrandomenchant.level); ++ } ++ } ++ } ++ ++ return itemstack; ++ } ++ ++ public static List b(Random random, ItemStack itemstack, int i) { ++ Item item = itemstack.getItem(); ++ int j = item.b(); ++ ++ if (j <= 0) { ++ return null; ++ } else { ++ j /= 2; ++ j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt((j >> 1) + 1); ++ int k = j + i; ++ float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F; ++ int l = (int) ((float) k * (1.0F + f) + 0.5F); ++ ++ if (l < 1) { ++ l = 1; ++ } ++ ++ ArrayList arraylist = null; ++ Map map = b(l, itemstack); ++ ++ if (map != null && !map.isEmpty()) { ++ WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) WeightedRandom.a(random, map.values()); ++ ++ if (weightedrandomenchant != null) { ++ arraylist = Lists.newArrayList(); ++ arraylist.add(weightedrandomenchant); ++ ++ for (int i1 = l; random.nextInt(50) <= i1; i1 >>= 1) { ++ Iterator iterator = map.keySet().iterator(); ++ ++ while (iterator.hasNext()) { ++ Integer integer = (Integer) iterator.next(); ++ boolean flag = true; ++ Iterator iterator1 = arraylist.iterator(); ++ ++ while (true) { ++ if (iterator1.hasNext()) { ++ WeightedRandomEnchant weightedrandomenchant1 = (WeightedRandomEnchant) iterator1.next(); ++ ++ if (weightedrandomenchant1.enchantment.a(Enchantment.getById(integer.intValue()))) { ++ continue; ++ } ++ ++ flag = false; ++ } ++ ++ if (!flag) { ++ iterator.remove(); ++ } ++ break; ++ } ++ } ++ ++ if (!map.isEmpty()) { ++ WeightedRandomEnchant weightedrandomenchant2 = (WeightedRandomEnchant) WeightedRandom.a(random, map.values()); ++ ++ arraylist.add(weightedrandomenchant2); ++ } ++ } ++ } ++ } ++ ++ return arraylist; ++ } ++ } ++ ++ public static Map b(int i, ItemStack itemstack) { ++ Item item = itemstack.getItem(); ++ HashMap hashmap = null; ++ boolean flag = itemstack.getItem() == Items.BOOK; ++ Enchantment[] aenchantment = Enchantment.b; ++ int j = aenchantment.length; ++ ++ for (int k = 0; k < j; ++k) { ++ Enchantment enchantment = aenchantment[k]; ++ ++ if (enchantment != null && (enchantment.slot.canEnchant(item) || flag)) { ++ for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) { ++ if (i >= enchantment.a(l) && i <= enchantment.b(l)) { ++ if (hashmap == null) { ++ hashmap = Maps.newHashMap(); ++ } ++ ++ hashmap.put(Integer.valueOf(enchantment.id), new WeightedRandomEnchant(enchantment, l)); ++ } ++ } ++ } ++ } ++ ++ return hashmap; ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java +new file mode 100644 +index 0000000..c8e11db +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java +@@ -0,0 +1,17 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierArthropods implements EnchantmentModifier { ++ ++ public EntityLiving a; ++ public Entity b; ++ ++ private EnchantmentModifierArthropods() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ enchantment.a(this.a, this.b, i); ++ } ++ ++ EnchantmentModifierArthropods(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java +new file mode 100644 +index 0000000..8610c7a +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java +@@ -0,0 +1,17 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierDamage implements EnchantmentModifier { ++ ++ public float a; ++ public EnumMonsterType b; ++ ++ private EnchantmentModifierDamage() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ this.a += enchantment.a(i, this.b); ++ } ++ ++ EnchantmentModifierDamage(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java +new file mode 100644 +index 0000000..8c03320 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java +@@ -0,0 +1,17 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierProtection implements EnchantmentModifier { ++ ++ public int a; ++ public DamageSource b; ++ ++ private EnchantmentModifierProtection() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ this.a += enchantment.a(i, this.b); ++ } ++ ++ EnchantmentModifierProtection(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java +new file mode 100644 +index 0000000..41993e0 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java +@@ -0,0 +1,17 @@ ++package net.minecraft.server; ++ ++final class EnchantmentModifierThorns implements EnchantmentModifier { ++ ++ public EntityLiving a; ++ public Entity b; ++ ++ private EnchantmentModifierThorns() {} ++ ++ public void a(Enchantment enchantment, int i) { ++ enchantment.b(this.a, this.b, i); ++ } ++ ++ EnchantmentModifierThorns(EmptyClass emptyclass) { ++ this(); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java +new file mode 100644 +index 0000000..8357157 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityFireworks.java +@@ -0,0 +1,123 @@ ++package net.minecraft.server; ++ ++public class EntityFireworks extends Entity { ++ ++ private int ticksFlown; ++ public int expectedLifespan; ++ ++ public EntityFireworks(World world) { ++ super(world); ++ this.a(0.25F, 0.25F); ++ } ++ ++ protected void h() { ++ this.datawatcher.add(8, 5); ++ } ++ ++ public EntityFireworks(World world, double d0, double d1, double d2, ItemStack itemstack) { ++ super(world); ++ this.ticksFlown = 0; ++ this.a(0.25F, 0.25F); ++ this.setPosition(d0, d1, d2); ++ int i = 1; ++ ++ if (itemstack != null && itemstack.hasTag()) { ++ this.datawatcher.watch(8, itemstack); ++ NBTTagCompound nbttagcompound = itemstack.getTag(); ++ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Fireworks"); ++ ++ if (nbttagcompound1 != null) { ++ i += nbttagcompound1.getByte("Flight"); ++ } ++ } ++ ++ this.motX = this.random.nextGaussian() * 0.001D; ++ this.motZ = this.random.nextGaussian() * 0.001D; ++ this.motY = 0.05D; ++ this.expectedLifespan = 10 * i + this.random.nextInt(6) + this.random.nextInt(7); ++ } ++ ++ public void s_() { ++ this.P = this.locX; ++ this.Q = this.locY; ++ this.R = this.locZ; ++ super.s_(); ++ this.motX *= 1.15D; ++ this.motZ *= 1.15D; ++ this.motY += 0.04D; ++ this.move(this.motX, this.motY, this.motZ); ++ float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); ++ ++ this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D); ++ ++ for (this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) { ++ ; ++ } ++ ++ while (this.pitch - this.lastPitch >= 180.0F) { ++ this.lastPitch += 360.0F; ++ } ++ ++ while (this.yaw - this.lastYaw < -180.0F) { ++ this.lastYaw -= 360.0F; ++ } ++ ++ while (this.yaw - this.lastYaw >= 180.0F) { ++ this.lastYaw += 360.0F; ++ } ++ ++ this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F; ++ this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; ++ if (this.ticksFlown == 0 && !this.R()) { ++ this.world.makeSound(this, "fireworks.launch", 3.0F, 1.0F); ++ } ++ ++ ++this.ticksFlown; ++ if (this.world.isStatic && this.ticksFlown % 2 < 2) { ++ this.world.addParticle(EnumParticle.FIREWORKS_SPARK, this.locX, this.locY - 0.3D, this.locZ, this.random.nextGaussian() * 0.05D, -this.motY * 0.5D, this.random.nextGaussian() * 0.05D, new int[0]); ++ } ++ ++ if (!this.world.isStatic && this.ticksFlown > this.expectedLifespan) { ++ this.world.broadcastEntityEffect(this, (byte) 17); ++ this.die(); ++ } ++ ++ } ++ ++ public void b(NBTTagCompound nbttagcompound) { ++ nbttagcompound.setInt("Life", this.ticksFlown); ++ nbttagcompound.setInt("LifeTime", this.expectedLifespan); ++ ItemStack itemstack = this.datawatcher.getItemStack(8); ++ ++ if (itemstack != null) { ++ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); ++ ++ itemstack.save(nbttagcompound1); ++ nbttagcompound.set("FireworksItem", nbttagcompound1); ++ } ++ ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) { ++ this.ticksFlown = nbttagcompound.getInt("Life"); ++ this.expectedLifespan = nbttagcompound.getInt("LifeTime"); ++ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("FireworksItem"); ++ ++ if (nbttagcompound1 != null) { ++ ItemStack itemstack = ItemStack.createStack(nbttagcompound1); ++ ++ if (itemstack != null) { ++ this.datawatcher.watch(8, itemstack); ++ } ++ } ++ ++ } ++ ++ public float c(float f) { ++ return super.c(f); ++ } ++ ++ public boolean aE() { ++ return false; ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java +new file mode 100644 +index 0000000..c9058db +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityTracker.java +@@ -0,0 +1,237 @@ ++package net.minecraft.server; ++ ++import com.google.common.collect.Lists; ++import com.google.common.collect.Sets; ++import java.util.ArrayList; ++import java.util.Iterator; ++import java.util.Set; ++import java.util.concurrent.Callable; ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; ++ ++public class EntityTracker { ++ ++ private static final Logger a = LogManager.getLogger(); ++ private final WorldServer world; ++ private Set c = Sets.newHashSet(); ++ public IntHashMap trackedEntities = new IntHashMap(); ++ private int e; ++ ++ public EntityTracker(WorldServer worldserver) { ++ this.world = worldserver; ++ this.e = worldserver.getMinecraftServer().getPlayerList().d(); ++ } ++ ++ public void track(Entity entity) { ++ if (entity instanceof EntityPlayer) { ++ this.addEntity(entity, 512, 2); ++ EntityPlayer entityplayer = (EntityPlayer) entity; ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ if (entitytrackerentry.tracker != entityplayer) { ++ entitytrackerentry.updatePlayer(entityplayer); ++ } ++ } ++ } else if (entity instanceof EntityFishingHook) { ++ this.addEntity(entity, 64, 5, true); ++ } else if (entity instanceof EntityArrow) { ++ this.addEntity(entity, 64, 20, false); ++ } else if (entity instanceof EntitySmallFireball) { ++ this.addEntity(entity, 64, 10, false); ++ } else if (entity instanceof EntityFireball) { ++ this.addEntity(entity, 64, 10, false); ++ } else if (entity instanceof EntitySnowball) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityEnderPearl) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityEnderSignal) { ++ this.addEntity(entity, 64, 4, true); ++ } else if (entity instanceof EntityEgg) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityPotion) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityThrownExpBottle) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityFireworks) { ++ this.addEntity(entity, 64, 10, true); ++ } else if (entity instanceof EntityItem) { ++ this.addEntity(entity, 64, 20, true); ++ } else if (entity instanceof EntityMinecartAbstract) { ++ this.addEntity(entity, 80, 3, true); ++ } else if (entity instanceof EntityBoat) { ++ this.addEntity(entity, 80, 3, true); ++ } else if (entity instanceof EntitySquid) { ++ this.addEntity(entity, 64, 3, true); ++ } else if (entity instanceof EntityWither) { ++ this.addEntity(entity, 80, 3, false); ++ } else if (entity instanceof EntityBat) { ++ this.addEntity(entity, 80, 3, false); ++ } else if (entity instanceof EntityEnderDragon) { ++ this.addEntity(entity, 160, 3, true); ++ } else if (entity instanceof IAnimal) { ++ this.addEntity(entity, 80, 3, true); ++ } else if (entity instanceof EntityTNTPrimed) { ++ this.addEntity(entity, 160, 10, true); ++ } else if (entity instanceof EntityFallingBlock) { ++ this.addEntity(entity, 160, 20, true); ++ } else if (entity instanceof EntityHanging) { ++ this.addEntity(entity, 160, Integer.MAX_VALUE, false); ++ } else if (entity instanceof EntityArmorStand) { ++ this.addEntity(entity, 160, 3, true); ++ } else if (entity instanceof EntityExperienceOrb) { ++ this.addEntity(entity, 160, 20, true); ++ } else if (entity instanceof EntityEnderCrystal) { ++ this.addEntity(entity, 256, Integer.MAX_VALUE, false); ++ } ++ ++ } ++ ++ public void addEntity(Entity entity, int i, int j) { ++ this.addEntity(entity, i, j, false); ++ } ++ ++ public void addEntity(Entity entity, int i, int j, boolean flag) { ++ if (i > this.e) { ++ i = this.e; ++ } ++ ++ try { ++ if (this.trackedEntities.b(entity.getId())) { ++ throw new IllegalStateException("Entity is already tracked!"); ++ } ++ ++ EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag); ++ ++ this.c.add(entitytrackerentry); ++ this.trackedEntities.a(entity.getId(), entitytrackerentry); ++ entitytrackerentry.scanPlayers(this.world.players); ++ } catch (Throwable throwable) { ++ CrashReport crashreport = CrashReport.a(throwable, "Adding entity to track"); ++ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity To Track"); ++ ++ crashreportsystemdetails.a("Tracking range", (Object) (i + " blocks")); ++ crashreportsystemdetails.a("Update interval", (Callable) (new CrashReportEntityTrackerUpdateInterval(this, j))); ++ entity.appendEntityCrashDetails(crashreportsystemdetails); ++ CrashReportSystemDetails crashreportsystemdetails1 = crashreport.a("Entity That Is Already Tracked"); ++ ++ ((EntityTrackerEntry) this.trackedEntities.get(entity.getId())).tracker.appendEntityCrashDetails(crashreportsystemdetails1); ++ ++ try { ++ throw new ReportedException(crashreport); ++ } catch (ReportedException reportedexception) { ++ EntityTracker.a.error("\"Silently\" catching entity tracking error.", reportedexception); ++ } ++ } ++ ++ } ++ ++ public void untrackEntity(Entity entity) { ++ if (entity instanceof EntityPlayer) { ++ EntityPlayer entityplayer = (EntityPlayer) entity; ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ entitytrackerentry.a(entityplayer); ++ } ++ } ++ ++ EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.trackedEntities.d(entity.getId()); ++ ++ if (entitytrackerentry1 != null) { ++ this.c.remove(entitytrackerentry1); ++ entitytrackerentry1.a(); ++ } ++ ++ } ++ ++ public void updatePlayers() { ++ ArrayList arraylist = Lists.newArrayList(); ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ entitytrackerentry.track(this.world.players); ++ if (entitytrackerentry.n && entitytrackerentry.tracker instanceof EntityPlayer) { ++ arraylist.add((EntityPlayer) entitytrackerentry.tracker); ++ } ++ } ++ ++ for (int i = 0; i < arraylist.size(); ++i) { ++ EntityPlayer entityplayer = (EntityPlayer) arraylist.get(i); ++ Iterator iterator1 = this.c.iterator(); ++ ++ while (iterator1.hasNext()) { ++ EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next(); ++ ++ if (entitytrackerentry1.tracker != entityplayer) { ++ entitytrackerentry1.updatePlayer(entityplayer); ++ } ++ } ++ } ++ ++ } ++ ++ public void a(EntityPlayer entityplayer) { ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ if (entitytrackerentry.tracker == entityplayer) { ++ entitytrackerentry.scanPlayers(this.world.players); ++ } else { ++ entitytrackerentry.updatePlayer(entityplayer); ++ } ++ } ++ ++ } ++ ++ public void a(Entity entity, Packet packet) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId()); ++ ++ if (entitytrackerentry != null) { ++ entitytrackerentry.broadcast(packet); ++ } ++ ++ } ++ ++ public void sendPacketToEntity(Entity entity, Packet packet) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId()); ++ ++ if (entitytrackerentry != null) { ++ entitytrackerentry.broadcastIncludingSelf(packet); ++ } ++ ++ } ++ ++ public void untrackPlayer(EntityPlayer entityplayer) { ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ entitytrackerentry.clear(entityplayer); ++ } ++ ++ } ++ ++ public void a(EntityPlayer entityplayer, Chunk chunk) { ++ Iterator iterator = this.c.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); ++ ++ if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.ae == chunk.locX && entitytrackerentry.tracker.ag == chunk.locZ) { ++ entitytrackerentry.updatePlayer(entityplayer); ++ } ++ } ++ ++ } ++ ++} diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java new file mode 100644 -index 0000000..2943244 +index 0000000..1cd7f9c --- /dev/null +++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -0,0 +1,48 @@ +@@ -0,0 +1,47 @@ +package net.minecraft.server; + ++import com.google.gson.JsonObject; ++import com.mojang.authlib.GameProfile; +import java.util.Date; +import java.util.UUID; + -+import net.minecraft.util.com.google.gson.JsonObject; -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +public class GameProfileBanEntry extends ExpirableListEntry { + + public GameProfileBanEntry(GameProfile gameprofile) { @@ -1379,27 +2604,26 @@ index 0000000..2943244 +} diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java new file mode 100644 -index 0000000..6202bba +index 0000000..64acbde --- /dev/null +++ b/src/main/java/net/minecraft/server/GenericAttributes.java -@@ -0,0 +1,105 @@ +@@ -0,0 +1,115 @@ +package net.minecraft.server; + +import java.util.Collection; +import java.util.Iterator; +import java.util.UUID; -+ +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GenericAttributes { + + private static final Logger f = LogManager.getLogger(); -+ public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); -+ public static final IAttribute b = (new AttributeRanged("generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); -+ public static final IAttribute c = (new AttributeRanged("generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); -+ public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); -+ public static final IAttribute e = new AttributeRanged("generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); ++ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); ++ public static final IAttribute b = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); ++ public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); ++ public static final IAttribute d = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); ++ public static final IAttribute e = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); + + public static NBTTagList a(AttributeMapBase attributemapbase) { + NBTTagList nbttaglist = new NBTTagList(); @@ -1459,9 +2683,10 @@ index 0000000..6202bba + if (attributeinstance != null) { + a(attributeinstance, nbttagcompound); + } else { -+ f.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); ++ GenericAttributes.f.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); + } + } ++ + } + + private static void a(AttributeInstance attributeinstance, NBTTagCompound nbttagcompound) { @@ -1471,108 +2696,179 @@ index 0000000..6202bba + + for (int i = 0; i < nbttaglist.size(); ++i) { + AttributeModifier attributemodifier = a(nbttaglist.get(i)); -+ AttributeModifier attributemodifier1 = attributeinstance.a(attributemodifier.a()); + -+ if (attributemodifier1 != null) { -+ attributeinstance.b(attributemodifier1); ++ if (attributemodifier != null) { ++ AttributeModifier attributemodifier1 = attributeinstance.a(attributemodifier.a()); ++ ++ if (attributemodifier1 != null) { ++ attributeinstance.c(attributemodifier1); ++ } ++ ++ attributeinstance.b(attributemodifier); + } -+ -+ attributeinstance.a(attributemodifier); + } + } ++ + } + + public static AttributeModifier a(NBTTagCompound nbttagcompound) { + UUID uuid = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast")); + -+ return new AttributeModifier(uuid, nbttagcompound.getString("Name"), nbttagcompound.getDouble("Amount"), nbttagcompound.getInt("Operation")); ++ try { ++ return new AttributeModifier(uuid, nbttagcompound.getString("Name"), nbttagcompound.getDouble("Amount"), nbttagcompound.getInt("Operation")); ++ } catch (Exception exception) { ++ GenericAttributes.f.warn("Unable to create attribute: " + exception.getMessage()); ++ return null; ++ } + } ++ +} diff --git a/src/main/java/net/minecraft/server/IntCache.java b/src/main/java/net/minecraft/server/IntCache.java new file mode 100644 -index 0000000..9858720 +index 0000000..4b4f005 --- /dev/null +++ b/src/main/java/net/minecraft/server/IntCache.java -@@ -0,0 +1,63 @@ +@@ -0,0 +1,64 @@ +package net.minecraft.server; + -+import java.util.ArrayList; ++import com.google.common.collect.Lists; +import java.util.List; + +public class IntCache { + + private static int a = 256; -+ private static List b = new ArrayList(); -+ private static List c = new ArrayList(); -+ private static List d = new ArrayList(); -+ private static List e = new ArrayList(); ++ private static List b = Lists.newArrayList(); ++ private static List c = Lists.newArrayList(); ++ private static List d = Lists.newArrayList(); ++ private static List e = Lists.newArrayList(); + + public static synchronized int[] a(int i) { + int[] aint; + + if (i <= 256) { -+ if (b.isEmpty()) { ++ if (IntCache.b.isEmpty()) { + aint = new int[256]; -+ c.add(aint); ++ IntCache.c.add(aint); + return aint; + } else { -+ aint = (int[]) b.remove(b.size() - 1); -+ c.add(aint); ++ aint = (int[]) IntCache.b.remove(IntCache.b.size() - 1); ++ IntCache.c.add(aint); + return aint; + } -+ } else if (i > a) { -+ a = i; -+ d.clear(); -+ e.clear(); -+ aint = new int[a]; -+ e.add(aint); ++ } else if (i > IntCache.a) { ++ IntCache.a = i; ++ IntCache.d.clear(); ++ IntCache.e.clear(); ++ aint = new int[IntCache.a]; ++ IntCache.e.add(aint); + return aint; -+ } else if (d.isEmpty()) { -+ aint = new int[a]; -+ e.add(aint); ++ } else if (IntCache.d.isEmpty()) { ++ aint = new int[IntCache.a]; ++ IntCache.e.add(aint); + return aint; + } else { -+ aint = (int[]) d.remove(d.size() - 1); -+ e.add(aint); ++ aint = (int[]) IntCache.d.remove(IntCache.d.size() - 1); ++ IntCache.e.add(aint); + return aint; + } + } + + public static synchronized void a() { -+ if (!d.isEmpty()) { -+ d.remove(d.size() - 1); ++ if (!IntCache.d.isEmpty()) { ++ IntCache.d.remove(IntCache.d.size() - 1); + } + -+ if (!b.isEmpty()) { -+ b.remove(b.size() - 1); ++ if (!IntCache.b.isEmpty()) { ++ IntCache.b.remove(IntCache.b.size() - 1); + } + -+ d.addAll(e); -+ b.addAll(c); -+ e.clear(); -+ c.clear(); ++ IntCache.d.addAll(IntCache.e); ++ IntCache.b.addAll(IntCache.c); ++ IntCache.e.clear(); ++ IntCache.c.clear(); + } + + public static synchronized String b() { -+ return "cache: " + d.size() + ", tcache: " + b.size() + ", allocated: " + e.size() + ", tallocated: " + c.size(); ++ return "cache: " + IntCache.d.size() + ", tcache: " + IntCache.b.size() + ", allocated: " + IntCache.e.size() + ", tallocated: " + IntCache.c.size(); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java +new file mode 100644 +index 0000000..6f0a065 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/ItemDoor.java +@@ -0,0 +1,56 @@ ++package net.minecraft.server; ++ ++public class ItemDoor extends Item { ++ ++ private Block a; ++ ++ public ItemDoor(Block block) { ++ this.a = block; ++ this.a(CreativeModeTab.d); ++ } ++ ++ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (enumdirection != EnumDirection.UP) { ++ return false; ++ } else { ++ IBlockData iblockdata = world.getType(blockposition); ++ Block block = iblockdata.getBlock(); ++ ++ if (!block.f(world, blockposition)) { ++ blockposition = blockposition.shift(enumdirection); ++ } ++ ++ if (!entityhuman.a(blockposition, enumdirection, itemstack)) { ++ return false; ++ } else if (!this.a.canPlace(world, blockposition)) { ++ return false; ++ } else { ++ a(world, blockposition, EnumDirection.fromAngle((double) entityhuman.yaw), this.a); ++ --itemstack.count; ++ return true; ++ } ++ } ++ } ++ ++ public static void a(World world, BlockPosition blockposition, EnumDirection enumdirection, Block block) { ++ BlockPosition blockposition1 = blockposition.shift(enumdirection.e()); ++ BlockPosition blockposition2 = blockposition.shift(enumdirection.f()); ++ int i = (world.getType(blockposition2).getBlock().isOccluding() ? 1 : 0) + (world.getType(blockposition2.up()).getBlock().isOccluding() ? 1 : 0); ++ int j = (world.getType(blockposition1).getBlock().isOccluding() ? 1 : 0) + (world.getType(blockposition1.up()).getBlock().isOccluding() ? 1 : 0); ++ boolean flag = world.getType(blockposition2).getBlock() == block || world.getType(blockposition2.up()).getBlock() == block; ++ boolean flag1 = world.getType(blockposition1).getBlock() == block || world.getType(blockposition1.up()).getBlock() == block; ++ boolean flag2 = false; ++ ++ if (flag && !flag1 || j > i) { ++ flag2 = true; ++ } ++ ++ BlockPosition blockposition3 = blockposition.up(); ++ IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? EnumDoorHinge.RIGHT : EnumDoorHinge.LEFT); ++ ++ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 2); ++ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 2); ++ world.applyPhysics(blockposition, block); ++ world.applyPhysics(blockposition3, block); + } +} diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java new file mode 100644 -index 0000000..4a40068 +index 0000000..17e88b8 --- /dev/null +++ b/src/main/java/net/minecraft/server/ItemSkull.java -@@ -0,0 +1,111 @@ +@@ -0,0 +1,125 @@ +package net.minecraft.server; + ++import com.mojang.authlib.GameProfile; +import java.util.UUID; + -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +public class ItemSkull extends Item { + -+ private static final String[] b = new String[] { "skeleton", "wither", "zombie", "char", "creeper"}; -+ public static final String[] a = new String[] { "skeleton", "wither", "zombie", "steve", "creeper"}; ++ private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper"}; + + public ItemSkull() { + this.a(CreativeModeTab.c); @@ -1580,69 +2876,67 @@ index 0000000..4a40068 + this.a(true); + } + -+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) { -+ if (l == 0) { -+ return false; -+ } else if (!world.getType(i, j, k).getMaterial().isBuildable()) { ++ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { ++ if (enumdirection == EnumDirection.DOWN) { + return false; + } else { -+ if (l == 1) { -+ ++j; -+ } ++ IBlockData iblockdata = world.getType(blockposition); ++ Block block = iblockdata.getBlock(); ++ boolean flag = block.f(world, blockposition); + -+ if (l == 2) { -+ --k; -+ } -+ -+ if (l == 3) { -+ ++k; -+ } -+ -+ if (l == 4) { -+ --i; -+ } -+ -+ if (l == 5) { -+ ++i; -+ } -+ -+ if (!world.isStatic) { -+ world.setTypeAndData(i, j, k, Blocks.SKULL, l, 2); -+ int i1 = 0; -+ -+ if (l == 1) { -+ i1 = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15; ++ if (!flag) { ++ if (!world.getType(blockposition).getBlock().getMaterial().isBuildable()) { ++ return false; + } + -+ TileEntity tileentity = world.getTileEntity(i, j, k); ++ blockposition = blockposition.shift(enumdirection); ++ } + -+ if (tileentity != null && tileentity instanceof TileEntitySkull) { -+ if (itemstack.getData() == 3) { -+ GameProfile gameprofile = null; ++ if (!entityhuman.a(blockposition, enumdirection, itemstack)) { ++ return false; ++ } else if (!Blocks.SKULL.canPlace(world, blockposition)) { ++ return false; ++ } else { ++ if (!world.isStatic) { ++ world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 3); ++ int i = 0; + -+ if (itemstack.hasTag()) { -+ NBTTagCompound nbttagcompound = itemstack.getTag(); -+ -+ if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { -+ gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner")); -+ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { -+ gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); -+ } -+ } -+ -+ ((TileEntitySkull) tileentity).setGameProfile(gameprofile); -+ } else { -+ ((TileEntitySkull) tileentity).setSkullType(itemstack.getData()); ++ if (enumdirection == EnumDirection.UP) { ++ i = MathHelper.floor((double) (entityhuman.yaw * 16.0F / 360.0F) + 0.5D) & 15; + } + -+ ((TileEntitySkull) tileentity).setRotation(i1); -+ ((BlockSkull) Blocks.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity); ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ ++ if (tileentity instanceof TileEntitySkull) { ++ TileEntitySkull tileentityskull = (TileEntitySkull) tileentity; ++ ++ if (itemstack.getData() == 3) { ++ GameProfile gameprofile = null; ++ ++ if (itemstack.hasTag()) { ++ NBTTagCompound nbttagcompound = itemstack.getTag(); ++ ++ if (nbttagcompound.hasKeyOfType("SkullOwner", 10)) { ++ gameprofile = GameProfileSerializer.deserialize(nbttagcompound.getCompound("SkullOwner")); ++ } else if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { ++ gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); ++ } ++ } ++ ++ tileentityskull.setGameProfile(gameprofile); ++ } else { ++ tileentityskull.setSkullType(itemstack.getData()); ++ } ++ ++ tileentityskull.setRotation(i); ++ Blocks.SKULL.a(world, blockposition, tileentityskull); ++ } ++ ++ --itemstack.count; + } + -+ --itemstack.count; ++ return true; + } -+ -+ return true; + } + } + @@ -1650,49 +2944,66 @@ index 0000000..4a40068 + return i; + } + -+ public String a(ItemStack itemstack) { ++ public String e_(ItemStack itemstack) { + int i = itemstack.getData(); + -+ if (i < 0 || i >= b.length) { ++ if (i < 0 || i >= ItemSkull.a.length) { + i = 0; + } + -+ return super.getName() + "." + b[i]; ++ return super.getName() + "." + ItemSkull.a[i]; + } + -+ public String n(ItemStack itemstack) { ++ public String a(ItemStack itemstack) { + if (itemstack.getData() == 3 && itemstack.hasTag()) { -+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) { -+ return LocaleI18n.get("item.skull.player.name", new Object[] { GameProfileSerializer.deserialize(itemstack.getTag().getCompound("SkullOwner")).getName()}); ++ if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { ++ return LocaleI18n.a("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}); + } + -+ if (itemstack.getTag().hasKeyOfType("SkullOwner", 8)) { -+ return LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}); ++ if (itemstack.getTag().hasKeyOfType("SkullOwner", 10)) { ++ NBTTagCompound nbttagcompound = itemstack.getTag().getCompound("SkullOwner"); ++ ++ if (nbttagcompound.hasKeyOfType("Name", 8)) { ++ return LocaleI18n.a("item.skull.player.name", new Object[] { nbttagcompound.getString("Name")}); ++ } + } + } + -+ return super.n(itemstack); ++ return super.a(itemstack); + } ++ ++ public boolean a(NBTTagCompound nbttagcompound) { ++ super.a(nbttagcompound); ++ if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { ++ GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); ++ ++ gameprofile = TileEntitySkull.b(gameprofile); ++ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); ++ return true; ++ } else { ++ return false; ++ } ++ } ++ +} diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java new file mode 100644 -index 0000000..af13af5 +index 0000000..ec7cd61 --- /dev/null +++ b/src/main/java/net/minecraft/server/NBTBase.java -@@ -0,0 +1,83 @@ +@@ -0,0 +1,87 @@ +package net.minecraft.server; + +import java.io.DataInput; +import java.io.DataOutput; -+import java.io.IOException; + +public abstract class NBTBase { + + public static final String[] a = new String[] { "END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE", "BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]"}; + -+ abstract void write(DataOutput dataoutput) throws IOException; ++ abstract void write(DataOutput dataoutput) throws java.io.IOException; + -+ abstract void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException; ++ abstract void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException; + + public abstract String toString(); + @@ -1745,6 +3056,10 @@ index 0000000..af13af5 + + public abstract NBTBase clone(); + ++ public boolean isEmpty() { ++ return false; ++ } ++ + public boolean equals(Object object) { + if (!(object instanceof NBTBase)) { + return false; @@ -1762,19 +3077,18 @@ index 0000000..af13af5 + protected String a_() { + return this.toString(); + } ++ +} diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java new file mode 100644 -index 0000000..20fe0f1 +index 0000000..e9d8828 --- /dev/null +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -0,0 +1,132 @@ +@@ -0,0 +1,99 @@ +package net.minecraft.server; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; -+import java.io.ByteArrayInputStream; -+import java.io.ByteArrayOutputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.DataOutput; @@ -1812,38 +3126,7 @@ index 0000000..20fe0f1 + } finally { + dataoutputstream.close(); + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } -+ } -+ -+ public static NBTTagCompound a(byte[] abyte, NBTReadLimiter nbtreadlimiter) { -+ try { -+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte)))); -+ -+ NBTTagCompound nbttagcompound; -+ -+ try { -+ nbttagcompound = a((DataInput) datainputstream, nbtreadlimiter); -+ } finally { -+ datainputstream.close(); -+ } -+ -+ return nbttagcompound; -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null; -+ } -+ -+ public static byte[] a(NBTTagCompound nbttagcompound) { -+ try { -+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); -+ DataOutputStream dataoutputstream = new DataOutputStream(new GZIPOutputStream(bytearrayoutputstream)); -+ -+ try { -+ a(nbttagcompound, (DataOutput) dataoutputstream); -+ } finally { -+ dataoutputstream.close(); -+ } -+ -+ return bytearrayoutputstream.toByteArray(); -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } return null; ++ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } + } + + public static NBTTagCompound a(DataInputStream datainputstream) { @@ -1873,7 +3156,7 @@ index 0000000..20fe0f1 + dataoutput.writeUTF(""); + nbtbase.write(dataoutput); + } -+ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } ++ } catch (IOException ex) { org.spigotmc.SneakyThrow.sneaky( ex ); } + } + + private static NBTBase a(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) { @@ -1893,8 +3176,8 @@ index 0000000..20fe0f1 + CrashReport crashreport = CrashReport.a(ioexception, "Loading NBT data"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("NBT Tag"); + -+ crashreportsystemdetails.a("Tag name", "[UNNAMED TAG]"); -+ crashreportsystemdetails.a("Tag type", Byte.valueOf(b0)); ++ crashreportsystemdetails.a("Tag name", (Object) "[UNNAMED TAG]"); ++ crashreportsystemdetails.a("Tag type", (Object) Byte.valueOf(b0)); + throw new ReportedException(crashreport); + } + } @@ -1903,15 +3186,14 @@ index 0000000..20fe0f1 +} diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java new file mode 100644 -index 0000000..3eeed3e +index 0000000..7525469 --- /dev/null +++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java -@@ -0,0 +1,57 @@ +@@ -0,0 +1,56 @@ +package net.minecraft.server; + +import java.io.DataInput; +import java.io.DataOutput; -+import java.io.IOException; +import java.util.Arrays; + +public class NBTTagByteArray extends NBTBase { @@ -1924,12 +3206,12 @@ index 0000000..3eeed3e + this.data = abyte; + } + -+ void write(DataOutput dataoutput) throws IOException { ++ void write(DataOutput dataoutput) throws java.io.IOException { + dataoutput.writeInt(this.data.length); + dataoutput.write(this.data); + } + -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { ++ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { + int j = datainput.readInt(); + + nbtreadlimiter.a((long) (8 * j)); @@ -1966,15 +3248,14 @@ index 0000000..3eeed3e +} diff --git a/src/main/java/net/minecraft/server/NBTTagIntArray.java b/src/main/java/net/minecraft/server/NBTTagIntArray.java new file mode 100644 -index 0000000..c7cea7f +index 0000000..f331ef3 --- /dev/null +++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java -@@ -0,0 +1,73 @@ +@@ -0,0 +1,74 @@ +package net.minecraft.server; + +import java.io.DataInput; +import java.io.DataOutput; -+import java.io.IOException; +import java.util.Arrays; + +public class NBTTagIntArray extends NBTBase { @@ -1987,15 +3268,16 @@ index 0000000..c7cea7f + this.data = aint; + } + -+ void write(DataOutput dataoutput) throws IOException { ++ void write(DataOutput dataoutput) throws java.io.IOException { + dataoutput.writeInt(this.data.length); + + for (int i = 0; i < this.data.length; ++i) { + dataoutput.writeInt(this.data[i]); + } ++ + } + -+ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { ++ void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { + int j = datainput.readInt(); + + nbtreadlimiter.a((long) (32 * j)); @@ -2004,6 +3286,7 @@ index 0000000..c7cea7f + for (int k = 0; k < j; ++k) { + this.data[k] = datainput.readInt(); + } ++ + } + + public byte getTypeId() { @@ -2045,29 +3328,25 @@ index 0000000..c7cea7f +} diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java new file mode 100644 -index 0000000..cbb3576 +index 0000000..7227bfa --- /dev/null +++ b/src/main/java/net/minecraft/server/NextTickListEntry.java -@@ -0,0 +1,60 @@ +@@ -0,0 +1,56 @@ +package net.minecraft.server; + +public class NextTickListEntry implements Comparable { + -+ private static long f; -+ private final Block g; -+ public int a; -+ public int b; ++ private static long d; ++ private final Block e; ++ public final BlockPosition a; ++ public long b; + public int c; -+ public long d; -+ public int e; -+ private long h; ++ private long f; + -+ public NextTickListEntry(int i, int j, int k, Block block) { -+ this.h = (long) (f++); -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.g = block; ++ public NextTickListEntry(BlockPosition blockposition, Block block) { ++ this.f = (long) (NextTickListEntry.d++); ++ this.a = blockposition; ++ this.e = block; + } + + public boolean equals(Object object) { @@ -2076,91 +3355,109 @@ index 0000000..cbb3576 + } else { + NextTickListEntry nextticklistentry = (NextTickListEntry) object; + -+ return this.a == nextticklistentry.a && this.b == nextticklistentry.b && this.c == nextticklistentry.c && Block.a(this.g, nextticklistentry.g); ++ return this.a.equals(nextticklistentry.a) && Block.a(this.e, nextticklistentry.e); + } + } + + public int hashCode() { -+ return (this.a * 1024 * 1024 + this.c * 1024 + this.b) * 256; ++ return this.a.hashCode(); + } + + public NextTickListEntry a(long i) { -+ this.d = i; ++ this.b = i; + return this; + } + + public void a(int i) { -+ this.e = i; ++ this.c = i; + } + -+ public int compareTo(NextTickListEntry nextticklistentry) { -+ return this.d < nextticklistentry.d ? -1 : (this.d > nextticklistentry.d ? 1 : (this.e != nextticklistentry.e ? this.e - nextticklistentry.e : (this.h < nextticklistentry.h ? -1 : (this.h > nextticklistentry.h ? 1 : 0)))); ++ public int a(NextTickListEntry nextticklistentry) { ++ return this.b < nextticklistentry.b ? -1 : (this.b > nextticklistentry.b ? 1 : (this.c != nextticklistentry.c ? this.c - nextticklistentry.c : (this.f < nextticklistentry.f ? -1 : (this.f > nextticklistentry.f ? 1 : 0)))); + } + + public String toString() { -+ return Block.getId(this.g) + ": (" + this.a + ", " + this.b + ", " + this.c + "), " + this.d + ", " + this.e + ", " + this.h; ++ return Block.getId(this.e) + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f; + } + + public Block a() { -+ return this.g; ++ return this.e; + } + + public int compareTo(Object object) { -+ return this.compareTo((NextTickListEntry) object); ++ return this.a((NextTickListEntry) object); + } +} diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java new file mode 100644 -index 0000000..5d75a54 +index 0000000..9306f97 --- /dev/null +++ b/src/main/java/net/minecraft/server/NibbleArray.java -@@ -0,0 +1,40 @@ +@@ -0,0 +1,58 @@ +package net.minecraft.server; + +public class NibbleArray { + -+ public final byte[] a; -+ private final int b; -+ private final int c; ++ private final byte[] a; + -+ public NibbleArray(int i, int j) { -+ this.a = new byte[i >> 1]; -+ this.b = j; -+ this.c = j + 4; ++ public NibbleArray() { ++ this.a = new byte[2048]; + } + -+ public NibbleArray(byte[] abyte, int i) { ++ public NibbleArray(byte[] abyte) { + this.a = abyte; -+ this.b = i; -+ this.c = i + 4; ++ if (abyte.length != 2048) { ++ throw new IllegalArgumentException("ChunkNibbleArrays should be 2048 bytes not: " + abyte.length); ++ } + } + + public int a(int i, int j, int k) { -+ int l = j << this.c | k << this.b | i; -+ int i1 = l >> 1; -+ int j1 = l & 1; -+ -+ return j1 == 0 ? this.a[i1] & 15 : this.a[i1] >> 4 & 15; ++ return this.a(this.b(i, j, k)); + } + + public void a(int i, int j, int k, int l) { -+ int i1 = j << this.c | k << this.b | i; -+ int j1 = i1 >> 1; -+ int k1 = i1 & 1; ++ this.a(this.b(i, j, k), l); ++ } + -+ if (k1 == 0) { -+ this.a[j1] = (byte) (this.a[j1] & 240 | l & 15); ++ private int b(int i, int j, int k) { ++ return j << 8 | k << 4 | i; ++ } ++ ++ public int a(int i) { ++ int j = this.c(i); ++ ++ return this.b(i) ? this.a[j] & 15 : this.a[j] >> 4 & 15; ++ } ++ ++ public void a(int i, int j) { ++ int k = this.c(i); ++ ++ if (this.b(i)) { ++ this.a[k] = (byte) (this.a[k] & 240 | j & 15); + } else { -+ this.a[j1] = (byte) (this.a[j1] & 15 | (l & 15) << 4); ++ this.a[k] = (byte) (this.a[k] & 15 | (j & 15) << 4); + } ++ ++ } ++ ++ private boolean b(int i) { ++ return (i & 1) == 0; ++ } ++ ++ private int c(int i) { ++ return i >> 1; ++ } ++ ++ public byte[] a() { ++ return this.a; + } +} diff --git a/src/main/java/net/minecraft/server/OldChunkLoader.java b/src/main/java/net/minecraft/server/OldChunkLoader.java new file mode 100644 -index 0000000..fcb9912 +index 0000000..894bb7a --- /dev/null +++ b/src/main/java/net/minecraft/server/OldChunkLoader.java -@@ -0,0 +1,120 @@ +@@ -0,0 +1,121 @@ +package net.minecraft.server; + +public class OldChunkLoader { @@ -2235,9 +3532,9 @@ index 0000000..fcb9912 + + if (!flag) { + byte[] abyte = new byte[4096]; -+ NibbleArray nibblearray = new NibbleArray(abyte.length, 4); -+ NibbleArray nibblearray1 = new NibbleArray(abyte.length, 4); -+ NibbleArray nibblearray2 = new NibbleArray(abyte.length, 4); ++ NibbleArray nibblearray = new NibbleArray(); ++ NibbleArray nibblearray1 = new NibbleArray(); ++ NibbleArray nibblearray2 = new NibbleArray(); + + for (int k1 = 0; k1 < 16; ++k1) { + for (int l1 = 0; l1 < 16; ++l1) { @@ -2257,9 +3554,9 @@ index 0000000..fcb9912 + + nbttagcompound1.setByte("Y", (byte) (k & 255)); + nbttagcompound1.setByteArray("Blocks", abyte); -+ nbttagcompound1.setByteArray("Data", nibblearray.a); -+ nbttagcompound1.setByteArray("SkyLight", nibblearray1.a); -+ nbttagcompound1.setByteArray("BlockLight", nibblearray2.a); ++ nbttagcompound1.setByteArray("Data", nibblearray.a()); ++ nbttagcompound1.setByteArray("SkyLight", nibblearray1.a()); ++ nbttagcompound1.setByteArray("BlockLight", nibblearray2.a()); + nbttaglist.add(nbttagcompound1); + } + } @@ -2269,7 +3566,7 @@ index 0000000..fcb9912 + + for (int k2 = 0; k2 < 16; ++k2) { + for (j = 0; j < 16; ++j) { -+ abyte1[j << 4 | k2] = (byte) (worldchunkmanager.getBiome(oldchunk.k << 4 | k2, oldchunk.l << 4 | j).id & 255); ++ abyte1[j << 4 | k2] = (byte) (worldchunkmanager.getBiome(new BlockPosition(oldchunk.k << 4 | k2, 0, oldchunk.l << 4 | j), BiomeBase.ad).id & 255); + } + } + @@ -2279,275 +3576,425 @@ index 0000000..fcb9912 + if (oldchunk.j != null) { + nbttagcompound.set("TileTicks", oldchunk.j); + } ++ ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +new file mode 100644 +index 0000000..97920b0 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +@@ -0,0 +1,41 @@ ++package net.minecraft.server; ++ ++public class PacketHandshakingInSetProtocol implements Packet { ++ ++ private int a; ++ public String b; ++ public int c; ++ private EnumProtocol d; ++ ++ public PacketHandshakingInSetProtocol() {} ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.c(255); ++ this.c = packetdataserializer.readUnsignedShort(); ++ this.d = EnumProtocol.a(packetdataserializer.e()); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.a(this.b); ++ packetdataserializer.writeShort(this.c); ++ packetdataserializer.b(this.d.a()); ++ } ++ ++ public void a(PacketHandshakingInListener packethandshakinginlistener) { ++ packethandshakinginlistener.a(this); ++ } ++ ++ public EnumProtocol a() { ++ return this.d; ++ } ++ ++ public int b() { ++ return this.a; ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketHandshakingInListener) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java +new file mode 100644 +index 0000000..8e1740d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java +@@ -0,0 +1,36 @@ ++package net.minecraft.server; ++ ++public class PacketPlayInChat implements Packet { ++ ++ private String a; ++ ++ public PacketPlayInChat() {} ++ ++ public PacketPlayInChat(String s) { ++ if (s.length() > 100) { ++ s = s.substring(0, 100); ++ } ++ ++ this.a = s; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.c(100); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.a(this.a); ++ } ++ ++ public void a(PacketListenerPlayIn packetlistenerplayin) { ++ packetlistenerplayin.a(this); ++ } ++ ++ public String a() { ++ return this.a; ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayIn) packetlistener); + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java new file mode 100644 -index 0000000..734faef +index 0000000..e24d3ae --- /dev/null +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +1,189 @@ +@@ -0,0 +1,114 @@ +package net.minecraft.server; + -+import java.io.IOException; -+import java.util.zip.DataFormatException; -+import java.util.zip.Deflater; -+import java.util.zip.Inflater; ++import com.google.common.collect.Lists; ++import java.util.ArrayList; ++import java.util.Iterator; + -+public class PacketPlayOutMapChunk extends Packet { ++public class PacketPlayOutMapChunk implements Packet { + + private int a; + private int b; -+ private int c; -+ private int d; -+ private byte[] e; -+ private byte[] f; -+ private boolean g; -+ private int h; -+ private static byte[] i = new byte[196864]; ++ private ChunkMap c; ++ private boolean d; + + public PacketPlayOutMapChunk() {} + + public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) { + this.a = chunk.locX; + this.b = chunk.locZ; -+ this.g = flag; -+ ChunkMap chunkmap = a(chunk, flag, i); -+ Deflater deflater = new Deflater(-1); -+ -+ this.d = chunkmap.c; -+ this.c = chunkmap.b; -+ -+ try { -+ this.f = chunkmap.a; -+ deflater.setInput(chunkmap.a, 0, chunkmap.a.length); -+ deflater.finish(); -+ this.e = new byte[chunkmap.a.length]; -+ this.h = deflater.deflate(this.e); -+ } finally { -+ deflater.end(); -+ } ++ this.d = flag; ++ this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); + } + -+ public static int c() { -+ return 196864; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ public void a(PacketDataSerializer packetdataserializer) { + this.a = packetdataserializer.readInt(); + this.b = packetdataserializer.readInt(); -+ this.g = packetdataserializer.readBoolean(); -+ this.c = packetdataserializer.readShort(); -+ this.d = packetdataserializer.readShort(); -+ this.h = packetdataserializer.readInt(); -+ if (i.length < this.h) { -+ i = new byte[this.h]; -+ } -+ -+ packetdataserializer.readBytes(i, 0, this.h); -+ int i = 0; -+ -+ int j; -+ -+ for (j = 0; j < 16; ++j) { -+ i += this.c >> j & 1; -+ } -+ -+ j = 12288 * i; -+ if (this.g) { -+ j += 256; -+ } -+ -+ this.f = new byte[j]; -+ Inflater inflater = new Inflater(); -+ -+ inflater.setInput(PacketPlayOutMapChunk.i, 0, this.h); -+ -+ try { -+ inflater.inflate(this.f); -+ } catch (DataFormatException dataformatexception) { -+ throw new IOException("Bad compressed data format"); -+ } finally { -+ inflater.end(); -+ } ++ this.d = packetdataserializer.readBoolean(); ++ this.c = new ChunkMap(); ++ this.c.b = packetdataserializer.readShort(); ++ this.c.a = packetdataserializer.a(); + } + + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeInt(this.a); + packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeBoolean(this.g); -+ packetdataserializer.writeShort((short) (this.c & '\uffff')); -+ packetdataserializer.writeShort((short) (this.d & '\uffff')); -+ packetdataserializer.writeInt(this.h); -+ packetdataserializer.writeBytes(this.e, 0, this.h); ++ packetdataserializer.writeBoolean(this.d); ++ packetdataserializer.writeShort((short) (this.c.b & '\uffff')); ++ packetdataserializer.a(this.c.a); + } + -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); + } + -+ public String b() { -+ return String.format("x=%d, z=%d, full=%b, sects=%d, add=%d, size=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Boolean.valueOf(this.g), Integer.valueOf(this.c), Integer.valueOf(this.d), Integer.valueOf(this.h)}); ++ protected static int a(int i, boolean flag, boolean flag1) { ++ int j = i * 2 * 16 * 16 * 16; ++ int k = i * 16 * 16 * 16 / 2; ++ int l = flag ? i * 16 * 16 * 16 / 2 : 0; ++ int i1 = flag1 ? 256 : 0; ++ ++ return j + k + l + i1; + } + -+ public static ChunkMap a(Chunk chunk, boolean flag, int i) { -+ int j = 0; ++ public static ChunkMap a(Chunk chunk, boolean flag, boolean flag1, int i) { + ChunkSection[] achunksection = chunk.getSections(); -+ int k = 0; + ChunkMap chunkmap = new ChunkMap(); -+ byte[] abyte = PacketPlayOutMapChunk.i; ++ ArrayList arraylist = Lists.newArrayList(); + -+ if (flag) { -+ chunk.q = true; -+ } ++ int j; + -+ int l; ++ for (j = 0; j < achunksection.length; ++j) { ++ ChunkSection chunksection = achunksection[j]; + -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ chunkmap.b |= 1 << l; -+ if (achunksection[l].getExtendedIdArray() != null) { -+ chunkmap.c |= 1 << l; -+ ++k; -+ } ++ if (chunksection != null && (!flag || !chunksection.a()) && (i & 1 << j) != 0) { ++ chunkmap.b |= 1 << j; ++ arraylist.add(chunksection); + } + } + -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ byte[] abyte1 = achunksection[l].getIdArray(); ++ chunkmap.a = new byte[a(Integer.bitCount(chunkmap.b), flag1, flag)]; ++ j = 0; ++ Iterator iterator = arraylist.iterator(); + -+ System.arraycopy(abyte1, 0, abyte, j, abyte1.length); -+ j += abyte1.length; ++ ChunkSection chunksection1; ++ ++ while (iterator.hasNext()) { ++ chunksection1 = (ChunkSection) iterator.next(); ++ char[] achar = chunksection1.getIdArray(); ++ char[] achar1 = achar; ++ int k = achar.length; ++ ++ for (int l = 0; l < k; ++l) { ++ char c0 = achar1[l]; ++ ++ chunkmap.a[j++] = (byte) (c0 & 255); ++ chunkmap.a[j++] = (byte) (c0 >> 8 & 255); + } + } + -+ NibbleArray nibblearray; -+ -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ nibblearray = achunksection[l].getDataArray(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } ++ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getEmittedLightArray().a(), chunkmap.a, j)) { ++ chunksection1 = (ChunkSection) iterator.next(); + } + -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ nibblearray = achunksection[l].getEmittedLightArray(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } -+ } -+ -+ if (!chunk.world.worldProvider.g) { -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -+ nibblearray = achunksection[l].getSkyLightArray(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } -+ } -+ } -+ -+ if (k > 0) { -+ for (l = 0; l < achunksection.length; ++l) { -+ if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) { -+ nibblearray = achunksection[l].getExtendedIdArray(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } ++ if (flag1) { ++ for (iterator = arraylist.iterator(); iterator.hasNext(); j = a(chunksection1.getSkyLightArray().a(), chunkmap.a, j)) { ++ chunksection1 = (ChunkSection) iterator.next(); + } + } + + if (flag) { -+ byte[] abyte2 = chunk.m(); -+ -+ System.arraycopy(abyte2, 0, abyte, j, abyte2.length); -+ j += abyte2.length; ++ a(chunk.getBiomeIndex(), chunkmap.a, j); + } + -+ chunkmap.a = new byte[j]; -+ System.arraycopy(abyte, 0, chunkmap.a, 0, j); + return chunkmap; + } + -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); ++ private static int a(byte[] abyte, byte[] abyte1, int i) { ++ System.arraycopy(abyte, 0, abyte1, i, abyte.length); ++ return i + abyte.length; ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayOut) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +new file mode 100644 +index 0000000..8af5e1f +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +@@ -0,0 +1,82 @@ ++package net.minecraft.server; ++ ++import java.util.List; ++ ++public class PacketPlayOutMapChunkBulk implements Packet { ++ ++ private int[] a; ++ private int[] b; ++ private ChunkMap[] c; ++ private boolean d; ++ ++ public PacketPlayOutMapChunkBulk() {} ++ ++ public PacketPlayOutMapChunkBulk(List list) { ++ int i = list.size(); ++ ++ this.a = new int[i]; ++ this.b = new int[i]; ++ this.c = new ChunkMap[i]; ++ this.d = !((Chunk) list.get(0)).getWorld().worldProvider.o(); ++ ++ for (int j = 0; j < i; ++j) { ++ Chunk chunk = (Chunk) list.get(j); ++ ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff'); ++ ++ this.a[j] = chunk.locX; ++ this.b[j] = chunk.locZ; ++ this.c[j] = chunkmap; ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.d = packetdataserializer.readBoolean(); ++ int i = packetdataserializer.e(); ++ ++ this.a = new int[i]; ++ this.b = new int[i]; ++ this.c = new ChunkMap[i]; ++ ++ int j; ++ ++ for (j = 0; j < i; ++j) { ++ this.a[j] = packetdataserializer.readInt(); ++ this.b[j] = packetdataserializer.readInt(); ++ this.c[j] = new ChunkMap(); ++ this.c[j].b = packetdataserializer.readShort() & '\uffff'; ++ this.c[j].a = new byte[PacketPlayOutMapChunk.a(Integer.bitCount(this.c[j].b), this.d, true)]; ++ } ++ ++ for (j = 0; j < i; ++j) { ++ packetdataserializer.readBytes(this.c[j].a); ++ } ++ ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.writeBoolean(this.d); ++ packetdataserializer.b(this.c.length); ++ ++ int i; ++ ++ for (i = 0; i < this.a.length; ++i) { ++ packetdataserializer.writeInt(this.a[i]); ++ packetdataserializer.writeInt(this.b[i]); ++ packetdataserializer.writeShort((short) (this.c[i].b & '\uffff')); ++ } ++ ++ for (i = 0; i < this.a.length; ++i) { ++ packetdataserializer.writeBytes(this.c[i].a); ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayOut) packetlistener); + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java new file mode 100644 -index 0000000..f6d7b2b +index 0000000..6f2aac9 --- /dev/null +++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java @@ -0,0 +1,58 @@ +package net.minecraft.server; + -+import java.io.IOException; -+ -+public class PacketPlayOutOpenWindow extends Packet { ++public class PacketPlayOutOpenWindow implements Packet { + + private int a; -+ private int b; -+ private String c; ++ private String b; ++ private IChatBaseComponent c; + private int d; -+ private boolean e; -+ private int f; ++ private int e; + + public PacketPlayOutOpenWindow() {} + -+ public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag) { ++ public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent) { ++ this(i, s, ichatbasecomponent, 0); ++ } ++ ++ public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent, int j) { + this.a = i; -+ this.b = j; -+ this.c = s; -+ this.d = k; -+ this.e = flag; ++ this.b = s; ++ this.c = ichatbasecomponent; ++ this.d = j; + } + -+ public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag, int l) { -+ this(i, j, s, k, flag); -+ this.f = l; ++ public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent, int j, int k) { ++ this(i, s, ichatbasecomponent, j); ++ this.e = k; + } + -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); + } + -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ public void a(PacketDataSerializer packetdataserializer) { + this.a = packetdataserializer.readUnsignedByte(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.c(32); ++ this.b = packetdataserializer.c(32); ++ this.c = packetdataserializer.d(); + this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.readBoolean(); -+ if (this.b == 11) { -+ this.f = packetdataserializer.readInt(); ++ if (this.b.equals("EntityHorse")) { ++ this.e = packetdataserializer.readInt(); + } ++ + } + -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeByte(this.b); ++ packetdataserializer.a(this.b); + packetdataserializer.a(this.c); + packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeBoolean(this.e); -+ if (this.b == 11) { -+ packetdataserializer.writeInt(this.f); ++ if (this.b.equals("EntityHorse")) { ++ packetdataserializer.writeInt(this.e); + } ++ + } + -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); ++ public void a(PacketListener packetlistener) { ++ this.a((PacketListenerPlayOut) packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +new file mode 100644 +index 0000000..d1e77a8 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +@@ -0,0 +1,39 @@ ++package net.minecraft.server; ++ ++public class PathfinderGoalSwell extends PathfinderGoal { ++ ++ EntityCreeper a; ++ EntityLiving b; ++ ++ public PathfinderGoalSwell(EntityCreeper entitycreeper) { ++ this.a = entitycreeper; ++ this.a(1); ++ } ++ ++ public boolean a() { ++ EntityLiving entityliving = this.a.getGoalTarget(); ++ ++ return this.a.ck() > 0 || entityliving != null && this.a.h(entityliving) < 9.0D; ++ } ++ ++ public void c() { ++ this.a.getNavigation().n(); ++ this.b = this.a.getGoalTarget(); ++ } ++ ++ public void d() { ++ this.b = null; ++ } ++ ++ public void e() { ++ if (this.b == null) { ++ this.a.a(-1); ++ } else if (this.a.h(this.b) > 49.0D) { ++ this.a.a(-1); ++ } else if (!this.a.getEntitySenses().a(this.b)) { ++ this.a.a(-1); ++ } else { ++ this.a.a(1); ++ } + } +} diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java new file mode 100644 -index 0000000..4684e89 +index 0000000..6bae818 --- /dev/null +++ b/src/main/java/net/minecraft/server/PersistentCollection.java -@@ -0,0 +1,185 @@ +@@ -0,0 +1,184 @@ +package net.minecraft.server; + ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; @@ -2556,42 +4003,40 @@ index 0000000..4684e89 +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; -+import java.util.ArrayList; -+import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class PersistentCollection { + -+ private IDataManager a; -+ private Map b = new HashMap(); -+ private List c = new ArrayList(); -+ private Map d = new HashMap(); ++ private IDataManager b; ++ protected Map a = Maps.newHashMap(); ++ private List c = Lists.newArrayList(); ++ private Map d = Maps.newHashMap(); + + public PersistentCollection(IDataManager idatamanager) { -+ this.a = idatamanager; ++ this.b = idatamanager; + this.b(); + } + + public PersistentBase get(Class oclass, String s) { -+ PersistentBase persistentbase = (PersistentBase) this.b.get(s); ++ PersistentBase persistentbase = (PersistentBase) this.a.get(s); + + if (persistentbase != null) { + return persistentbase; + } else { -+ if (this.a != null) { ++ if (this.b != null) { + try { -+ File file1 = this.a.getDataFile(s); ++ File file = this.b.getDataFile(s); + -+ if (file1 != null && file1.exists()) { ++ if (file != null && file.exists()) { + try { + persistentbase = (PersistentBase) oclass.getConstructor(new Class[] { String.class}).newInstance(new Object[] { s}); + } catch (Exception exception) { + throw new RuntimeException("Failed to instantiate " + oclass.toString(), exception); + } + -+ FileInputStream fileinputstream = new FileInputStream(file1); ++ FileInputStream fileinputstream = new FileInputStream(file); + NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a((InputStream) fileinputstream); + + fileinputstream.close(); @@ -2603,7 +4048,7 @@ index 0000000..4684e89 + } + + if (persistentbase != null) { -+ this.b.put(s, persistentbase); ++ this.a.put(s, persistentbase); + this.c.add(persistentbase); + } + @@ -2612,16 +4057,12 @@ index 0000000..4684e89 + } + + public void a(String s, PersistentBase persistentbase) { -+ if (persistentbase == null) { -+ throw new RuntimeException("Can\'t set null data"); -+ } else { -+ if (this.b.containsKey(s)) { -+ this.c.remove(this.b.remove(s)); -+ } -+ -+ this.b.put(s, persistentbase); -+ this.c.add(persistentbase); ++ if (this.a.containsKey(s)) { ++ this.c.remove(this.a.remove(s)); + } ++ ++ this.a.put(s, persistentbase); ++ this.c.add(persistentbase); + } + + public void a() { @@ -2633,21 +4074,22 @@ index 0000000..4684e89 + persistentbase.a(false); + } + } ++ + } + + private void a(PersistentBase persistentbase) { -+ if (this.a != null) { ++ if (this.b != null) { + try { -+ File file1 = this.a.getDataFile(persistentbase.id); ++ File file = this.b.getDataFile(persistentbase.id); + -+ if (file1 != null) { ++ if (file != null) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + persistentbase.b(nbttagcompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + + nbttagcompound1.set("data", nbttagcompound); -+ FileOutputStream fileoutputstream = new FileOutputStream(file1); ++ FileOutputStream fileoutputstream = new FileOutputStream(file); + + NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) fileoutputstream); + fileoutputstream.close(); @@ -2655,20 +4097,21 @@ index 0000000..4684e89 + } catch (Exception exception) { + exception.printStackTrace(); + } ++ + } + } + + private void b() { + try { + this.d.clear(); -+ if (this.a == null) { ++ if (this.b == null) { + return; + } + -+ File file1 = this.a.getDataFile("idcounts"); ++ File file = this.b.getDataFile("idcounts"); + -+ if (file1 != null && file1.exists()) { -+ DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1)); ++ if (file != null && file.exists()) { ++ DataInputStream datainputstream = new DataInputStream(new FileInputStream(file)); + NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(datainputstream); + + datainputstream.close(); @@ -2680,15 +4123,16 @@ index 0000000..4684e89 + + if (nbtbase instanceof NBTTagShort) { + NBTTagShort nbttagshort = (NBTTagShort) nbtbase; -+ short short1 = nbttagshort.e(); ++ short short0 = nbttagshort.e(); + -+ this.d.put(s, Short.valueOf(short1)); ++ this.d.put(s, Short.valueOf(short0)); + } + } + } + } catch (Exception exception) { + exception.printStackTrace(); + } ++ + } + + public int a(String s) { @@ -2701,24 +4145,24 @@ index 0000000..4684e89 + } + + this.d.put(s, oshort); -+ if (this.a == null) { ++ if (this.b == null) { + return oshort.shortValue(); + } else { + try { -+ File file1 = this.a.getDataFile("idcounts"); ++ File file = this.b.getDataFile("idcounts"); + -+ if (file1 != null) { ++ if (file != null) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + Iterator iterator = this.d.keySet().iterator(); + + while (iterator.hasNext()) { + String s1 = (String) iterator.next(); -+ short short1 = ((Short) this.d.get(s1)).shortValue(); ++ short short0 = ((Short) this.d.get(s1)).shortValue(); + -+ nbttagcompound.setShort(s1, short1); ++ nbttagcompound.setShort(s1, short0); + } + -+ DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1)); ++ DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file)); + + NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); + dataoutputstream.close(); @@ -2733,49 +4177,49 @@ index 0000000..4684e89 +} diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java new file mode 100644 -index 0000000..900ed68 +index 0000000..f4f72ef --- /dev/null +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -0,0 +1,67 @@ +@@ -0,0 +1,68 @@ +package net.minecraft.server; + ++import com.google.common.collect.Maps; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; -+import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class RegionFileCache { + -+ private static final Map a = new HashMap(); ++ private static final Map a = Maps.newHashMap(); + -+ public static synchronized RegionFile a(File file1, int i, int j) { -+ File file2 = new File(file1, "region"); -+ File file3 = new File(file2, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); -+ RegionFile regionfile = (RegionFile) a.get(file3); ++ public static synchronized RegionFile a(File file, int i, int j) { ++ File file1 = new File(file, "region"); ++ File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); ++ RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2); + + if (regionfile != null) { + return regionfile; + } else { -+ if (!file2.exists()) { -+ file2.mkdirs(); ++ if (!file1.exists()) { ++ file1.mkdirs(); + } + -+ if (a.size() >= 256) { ++ if (RegionFileCache.a.size() >= 256) { + a(); + } + -+ RegionFile regionfile1 = new RegionFile(file3); ++ RegionFile regionfile1 = new RegionFile(file2); + -+ a.put(file3, regionfile1); ++ RegionFileCache.a.put(file2, regionfile1); + return regionfile1; + } + } + + public static synchronized void a() { -+ Iterator iterator = a.values().iterator(); ++ Iterator iterator = RegionFileCache.a.values().iterator(); + + while (iterator.hasNext()) { + RegionFile regionfile = (RegionFile) iterator.next(); @@ -2789,142 +4233,147 @@ index 0000000..900ed68 + } + } + -+ a.clear(); ++ RegionFileCache.a.clear(); + } + -+ public static DataInputStream c(File file1, int i, int j) { -+ RegionFile regionfile = a(file1, i, j); ++ public static DataInputStream c(File file, int i, int j) { ++ RegionFile regionfile = a(file, i, j); + + return regionfile.a(i & 31, j & 31); + } + -+ public static DataOutputStream d(File file1, int i, int j) { -+ RegionFile regionfile = a(file1, i, j); ++ public static DataOutputStream d(File file, int i, int j) { ++ RegionFile regionfile = a(file, i, j); + + return regionfile.b(i & 31, j & 31); + } ++ +} diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java new file mode 100644 -index 0000000..c2194af +index 0000000..6508fdf --- /dev/null +++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -0,0 +1,102 @@ +@@ -0,0 +1,106 @@ +package net.minecraft.server; + ++import com.google.common.collect.Lists; ++import io.netty.bootstrap.ServerBootstrap; ++import io.netty.channel.ChannelFuture; ++import io.netty.channel.EventLoopGroup; ++import io.netty.channel.socket.nio.NioServerSocketChannel; ++import io.netty.util.concurrent.GenericFutureListener; +import java.net.InetAddress; -+import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.Callable; -+ -+import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder; -+import net.minecraft.util.io.netty.bootstrap.ServerBootstrap; -+import net.minecraft.util.io.netty.channel.ChannelFuture; -+import net.minecraft.util.io.netty.channel.nio.NioEventLoopGroup; -+import net.minecraft.util.io.netty.channel.socket.nio.NioServerSocketChannel; -+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ServerConnection { + -+ private static final Logger b = LogManager.getLogger(); -+ private static final NioEventLoopGroup c = new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty IO #%d").setDaemon(true).build()); -+ private final MinecraftServer d; -+ public volatile boolean a; -+ private final List e = Collections.synchronizedList(new ArrayList()); -+ private final List f = Collections.synchronizedList(new ArrayList()); ++ private static final Logger d = LogManager.getLogger(); ++ public static final LazyInitVar a = new LazyInitNioEventLoopGroup(); ++ public static final LazyInitVar b = new LazyInitLocalEventLoopGroup(); ++ private final MinecraftServer e; ++ public volatile boolean c; ++ private final List f = Collections.synchronizedList(Lists.newArrayList()); ++ private final List g = Collections.synchronizedList(Lists.newArrayList()); + + public ServerConnection(MinecraftServer minecraftserver) { -+ this.d = minecraftserver; -+ this.a = true; ++ this.e = minecraftserver; ++ this.c = true; + } + + public void a(InetAddress inetaddress, int i) { -+ List list = this.e; ++ List list = this.f; + -+ synchronized (this.e) { -+ this.e.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ServerConnectionChannel(this)).group(c).localAddress(inetaddress, i)).bind().syncUninterruptibly()); ++ synchronized (this.f) { ++ this.f.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ServerConnectionChannel(this)).group((EventLoopGroup) ServerConnection.a.c()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); + } + } + + public void b() { -+ this.a = false; -+ Iterator iterator = this.e.iterator(); ++ this.c = false; ++ Iterator iterator = this.f.iterator(); + + while (iterator.hasNext()) { + ChannelFuture channelfuture = (ChannelFuture) iterator.next(); + -+ channelfuture.channel().close().syncUninterruptibly(); ++ try { ++ channelfuture.channel().close().sync(); ++ } catch (InterruptedException interruptedexception) { ++ ServerConnection.d.error("Interrupted whilst closing channel"); ++ } + } ++ + } + + public void c() { -+ List list = this.f; ++ List list = this.g; + -+ synchronized (this.f) { -+ Iterator iterator = this.f.iterator(); ++ synchronized (this.g) { ++ Iterator iterator = this.g.iterator(); + + while (iterator.hasNext()) { + NetworkManager networkmanager = (NetworkManager) iterator.next(); + -+ if (!networkmanager.isConnected()) { -+ iterator.remove(); -+ if (networkmanager.f() != null) { -+ networkmanager.getPacketListener().a(networkmanager.f()); -+ } else if (networkmanager.getPacketListener() != null) { -+ networkmanager.getPacketListener().a(new ChatComponentText("Disconnected")); -+ } -+ } else { -+ try { -+ networkmanager.a(); -+ } catch (Exception exception) { -+ if (networkmanager.c()) { -+ CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection"); -+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection"); ++ if (!networkmanager.h()) { ++ if (!networkmanager.g()) { ++ iterator.remove(); ++ networkmanager.l(); ++ } else { ++ try { ++ networkmanager.a(); ++ } catch (Exception exception) { ++ if (networkmanager.c()) { ++ CrashReport crashreport = CrashReport.a(exception, "Ticking memory connection"); ++ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Ticking connection"); + -+ crashreportsystemdetails.a("Connection", (Callable) (new CrashReportServerConnection(this, networkmanager))); -+ throw new ReportedException(crashreport); ++ crashreportsystemdetails.a("Connection", (Callable) (new CrashReportNetworkManager(this, networkmanager))); ++ throw new ReportedException(crashreport); ++ } ++ ++ ServerConnection.d.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); ++ ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); ++ ++ networkmanager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new NetworkManagerCloseFuture(this, networkmanager, chatcomponenttext), new GenericFutureListener[0]); ++ networkmanager.k(); + } -+ -+ b.warn("Failed to handle packet for " + networkmanager.getSocketAddress(), exception); -+ ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); -+ -+ networkmanager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener[] { new ServerConnectionFuture(this, networkmanager, chatcomponenttext)}); -+ networkmanager.g(); + } + } + } ++ + } + } + + public MinecraftServer d() { -+ return this.d; ++ return this.e; + } + + static List a(ServerConnection serverconnection) { -+ return serverconnection.f; ++ return serverconnection.g; + } + + static MinecraftServer b(ServerConnection serverconnection) { -+ return serverconnection.d; ++ return serverconnection.e; + } ++ +} diff --git a/src/main/java/net/minecraft/server/ServerConnectionChannel.java b/src/main/java/net/minecraft/server/ServerConnectionChannel.java new file mode 100644 -index 0000000..d7d93a0 +index 0000000..8473d48 --- /dev/null +++ b/src/main/java/net/minecraft/server/ServerConnectionChannel.java @@ -0,0 +1,37 @@ +package net.minecraft.server; + -+import net.minecraft.util.io.netty.channel.Channel; -+import net.minecraft.util.io.netty.channel.ChannelException; -+import net.minecraft.util.io.netty.channel.ChannelInitializer; -+import net.minecraft.util.io.netty.channel.ChannelOption; -+import net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler; ++import io.netty.channel.Channel; ++import io.netty.channel.ChannelException; ++import io.netty.channel.ChannelInitializer; ++import io.netty.channel.ChannelOption; ++import io.netty.handler.timeout.ReadTimeoutHandler; + +class ServerConnectionChannel extends ChannelInitializer { + @@ -2947,8 +4396,8 @@ index 0000000..d7d93a0 + ; + } + -+ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(this.a)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(NetworkManager.h)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(NetworkManager.h)); -+ NetworkManager networkmanager = new NetworkManager(false); ++ channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(this.a)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); ++ NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); + + ServerConnection.a(this.a).add(networkmanager); + channel.pipeline().addLast("packet_handler", networkmanager); @@ -2957,12 +4406,18 @@ index 0000000..d7d93a0 +} diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java new file mode 100644 -index 0000000..57a501f +index 0000000..4561825 --- /dev/null +++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java -@@ -0,0 +1,202 @@ +@@ -0,0 +1,213 @@ +package net.minecraft.server; + ++import com.google.common.collect.Maps; ++import com.google.common.collect.Sets; ++import com.google.gson.JsonElement; ++import com.google.gson.JsonObject; ++import com.google.gson.JsonParseException; ++import com.google.gson.JsonParser; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; @@ -2972,14 +4427,7 @@ index 0000000..57a501f +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; -+ -+import net.minecraft.util.com.google.common.collect.Maps; -+import net.minecraft.util.com.google.common.collect.Sets; -+import net.minecraft.util.com.google.gson.JsonElement; -+import net.minecraft.util.com.google.gson.JsonObject; -+import net.minecraft.util.com.google.gson.JsonParseException; -+import net.minecraft.util.com.google.gson.JsonParser; -+import net.minecraft.util.org.apache.commons.io.FileUtils; ++import org.apache.commons.io.FileUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + @@ -2992,9 +4440,9 @@ index 0000000..57a501f + private int f = -300; + private boolean g = false; + -+ public ServerStatisticManager(MinecraftServer minecraftserver, File file1) { ++ public ServerStatisticManager(MinecraftServer minecraftserver, File file) { + this.c = minecraftserver; -+ this.d = file1; ++ this.d = file; + } + + public void a() { @@ -3003,19 +4451,21 @@ index 0000000..57a501f + this.a.clear(); + this.a.putAll(this.a(FileUtils.readFileToString(this.d))); + } catch (IOException ioexception) { -+ b.error("Couldn\'t read statistics file " + this.d, ioexception); ++ ServerStatisticManager.b.error("Couldn\'t read statistics file " + this.d, ioexception); + } catch (JsonParseException jsonparseexception) { -+ b.error("Couldn\'t parse statistics file " + this.d, jsonparseexception); ++ ServerStatisticManager.b.error("Couldn\'t parse statistics file " + this.d, jsonparseexception); + } + } ++ + } + + public void b() { + try { + FileUtils.writeStringToFile(this.d, a(this.a)); + } catch (IOException ioexception) { -+ b.error("Couldn\'t save stats", ioexception); ++ ServerStatisticManager.b.error("Couldn\'t save stats", ioexception); + } ++ + } + + public void setStatistic(EntityHuman entityhuman, Statistic statistic, int i) { @@ -3025,10 +4475,18 @@ index 0000000..57a501f + this.e.add(statistic); + if (statistic.d() && j == 0 && i > 0) { + this.g = true; -+ if (this.c.at()) { ++ if (this.c.az()) { + this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); + } + } ++ ++ if (statistic.d() && j > 0 && i == 0) { ++ this.g = true; ++ if (this.c.az()) { ++ this.c.getPlayerList().sendMessage(new ChatMessage("chat.type.achievement.taken", new Object[] { entityhuman.getScoreboardDisplayName(), statistic.j()})); ++ } ++ } ++ + } + + public Set c() { @@ -3073,14 +4531,14 @@ index 0000000..57a501f + ijsonstatistic.a(jsonobject1.get("progress")); + statisticwrapper.a(ijsonstatistic); + } catch (Throwable throwable) { -+ b.warn("Invalid statistic progress in " + this.d, throwable); ++ ServerStatisticManager.b.warn("Invalid statistic progress in " + this.d, throwable); + } + } + } + + hashmap.put(statistic, statisticwrapper); + } else { -+ b.warn("Invalid statistic in " + this.d + ": Don\'t know what " + (String) entry.getKey() + " is"); ++ ServerStatisticManager.b.warn("Invalid statistic in " + this.d + ": Don\'t know what " + (String) entry.getKey() + " is"); + } + } + @@ -3103,7 +4561,7 @@ index 0000000..57a501f + try { + jsonobject1.add("progress", ((StatisticWrapper) entry.getValue()).b().a()); + } catch (Throwable throwable) { -+ b.warn("Couldn\'t save statistic " + ((Statistic) entry.getKey()).e() + ": error serializing progress", throwable); ++ ServerStatisticManager.b.warn("Couldn\'t save statistic " + ((Statistic) entry.getKey()).e() + ": error serializing progress", throwable); + } + + jsonobject.add(((Statistic) entry.getKey()).name, jsonobject1); @@ -3123,10 +4581,11 @@ index 0000000..57a501f + + this.e.add(statistic); + } ++ + } + + public void a(EntityPlayer entityplayer) { -+ int i = this.c.al(); ++ int i = this.c.ar(); + HashMap hashmap = Maps.newHashMap(); + + if (this.g || i - this.f > 300) { @@ -3162,16 +4621,17 @@ index 0000000..57a501f + public boolean e() { + return this.g; + } ++ +} diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java new file mode 100644 -index 0000000..97308d0 +index 0000000..49b7aa1 --- /dev/null +++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -0,0 +1,219 @@ +@@ -0,0 +1,213 @@ +package net.minecraft.server; + -+import java.util.HashMap; ++import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.List; +import java.util.Map; @@ -3180,31 +4640,32 @@ index 0000000..97308d0 + +public abstract class StructureGenerator extends WorldGenBase { + -+ private PersistentStructure e; -+ protected Map d = new HashMap(); ++ private PersistentStructure d; ++ protected Map e = Maps.newHashMap(); + + public StructureGenerator() {} + + public abstract String a(); + -+ protected final void a(World world, int i, int j, int k, int l, Block[] ablock) { ++ protected final void a(World world, int i, int j, int k, int l, ChunkSnapshot chunksnapshot) { + this.a(world); -+ if (!this.d.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) { ++ if (!this.e.containsKey(Long.valueOf(ChunkCoordIntPair.a(i, j)))) { + this.b.nextInt(); + + try { + if (this.a(i, j)) { + StructureStart structurestart = this.b(i, j); + -+ this.d.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); ++ this.e.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); + this.a(i, j, structurestart); + } ++ + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Exception preparing structure feature"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Feature being prepared"); + + crashreportsystemdetails.a("Is feature chunk", (Callable) (new CrashReportIsFeatureChunk(this, i, j))); -+ crashreportsystemdetails.a("Chunk location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); ++ crashreportsystemdetails.a("Chunk location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); + crashreportsystemdetails.a("Chunk pos hash", (Callable) (new CrashReportChunkPosHash(this, i, j))); + crashreportsystemdetails.a("Structure type", (Callable) (new CrashReportStructureType(this))); + throw new ReportedException(crashreport); @@ -3212,18 +4673,19 @@ index 0000000..97308d0 + } + } + -+ public boolean a(World world, Random random, int i, int j) { ++ public boolean a(World world, Random random, ChunkCoordIntPair chunkcoordintpair) { + this.a(world); -+ int k = (i << 4) + 8; -+ int l = (j << 4) + 8; ++ int i = (chunkcoordintpair.x << 4) + 8; ++ int j = (chunkcoordintpair.z << 4) + 8; + boolean flag = false; -+ Iterator iterator = this.d.values().iterator(); ++ Iterator iterator = this.e.values().iterator(); + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); + -+ if (structurestart.d() && structurestart.a().a(k, l, k + 15, l + 15)) { -+ structurestart.a(world, random, new StructureBoundingBox(k, l, k + 15, l + 15)); ++ if (structurestart.d() && structurestart.a(chunkcoordintpair) && structurestart.a().a(i, j, i + 15, j + 15)) { ++ structurestart.a(world, random, new StructureBoundingBox(i, j, i + 15, j + 15)); ++ structurestart.b(chunkcoordintpair); + flag = true; + this.a(structurestart.e(), structurestart.f(), structurestart); + } @@ -3232,24 +4694,24 @@ index 0000000..97308d0 + return flag; + } + -+ public boolean b(int i, int j, int k) { ++ public boolean b(BlockPosition blockposition) { + this.a(this.c); -+ return this.c(i, j, k) != null; ++ return this.c(blockposition) != null; + } + -+ protected StructureStart c(int i, int j, int k) { -+ Iterator iterator = this.d.values().iterator(); ++ protected StructureStart c(BlockPosition blockposition) { ++ Iterator iterator = this.e.values().iterator(); + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); + -+ if (structurestart.d() && structurestart.a().a(i, k, i, k)) { ++ if (structurestart.d() && structurestart.a().b((BaseBlockPosition) blockposition)) { + Iterator iterator1 = structurestart.b().iterator(); + + while (iterator1.hasNext()) { + StructurePiece structurepiece = (StructurePiece) iterator1.next(); + -+ if (structurepiece.c().b(i, j, k)) { ++ if (structurepiece.c().b((BaseBlockPosition) blockposition)) { + return structurestart; + } + } @@ -3259,9 +4721,9 @@ index 0000000..97308d0 + return null; + } + -+ public boolean d(int i, int j, int k) { -+ this.a(this.c); -+ Iterator iterator = this.d.values().iterator(); ++ public boolean a(World world, BlockPosition blockposition) { ++ this.a(world); ++ Iterator iterator = this.e.values().iterator(); + + StructureStart structurestart; + @@ -3271,31 +4733,28 @@ index 0000000..97308d0 + } + + structurestart = (StructureStart) iterator.next(); -+ } while (!structurestart.d()); ++ } while (!structurestart.d() || !structurestart.a().b((BaseBlockPosition) blockposition)); + -+ return structurestart.a().a(i, k, i, k); ++ return true; + } + -+ public ChunkPosition getNearestGeneratedFeature(World world, int i, int j, int k) { ++ public BlockPosition getNearestGeneratedFeature(World world, BlockPosition blockposition) { + this.c = world; + this.a(world); + this.b.setSeed(world.getSeed()); -+ long l = this.b.nextLong(); -+ long i1 = this.b.nextLong(); -+ long j1 = (long) (i >> 4) * l; -+ long k1 = (long) (k >> 4) * i1; ++ long i = this.b.nextLong(); ++ long j = this.b.nextLong(); ++ long k = (long) (blockposition.getX() >> 4) * i; ++ long l = (long) (blockposition.getZ() >> 4) * j; + -+ this.b.setSeed(j1 ^ k1 ^ world.getSeed()); -+ this.a(world, i >> 4, k >> 4, 0, 0, (Block[]) null); ++ this.b.setSeed(k ^ l ^ world.getSeed()); ++ this.a(world, blockposition.getX() >> 4, blockposition.getZ() >> 4, 0, 0, (ChunkSnapshot) null); + double d0 = Double.MAX_VALUE; -+ ChunkPosition chunkposition = null; -+ Iterator iterator = this.d.values().iterator(); ++ BlockPosition blockposition1 = null; ++ Iterator iterator = this.e.values().iterator(); + -+ ChunkPosition chunkposition1; -+ int l1; -+ int i2; ++ BlockPosition blockposition2; + double d1; -+ int j2; + + while (iterator.hasNext()) { + StructureStart structurestart = (StructureStart) iterator.next(); @@ -3303,58 +4762,52 @@ index 0000000..97308d0 + if (structurestart.d()) { + StructurePiece structurepiece = (StructurePiece) structurestart.b().get(0); + -+ chunkposition1 = structurepiece.a(); -+ i2 = chunkposition1.x - i; -+ l1 = chunkposition1.y - j; -+ j2 = chunkposition1.z - k; -+ d1 = (double) (i2 * i2 + l1 * l1 + j2 * j2); ++ blockposition2 = structurepiece.a(); ++ d1 = blockposition2.i(blockposition); + if (d1 < d0) { + d0 = d1; -+ chunkposition = chunkposition1; ++ blockposition1 = blockposition2; + } + } + } + -+ if (chunkposition != null) { -+ return chunkposition; ++ if (blockposition1 != null) { ++ return blockposition1; + } else { -+ List list = this.o_(); ++ List list = this.y_(); + + if (list != null) { -+ ChunkPosition chunkposition2 = null; ++ BlockPosition blockposition3 = null; + Iterator iterator1 = list.iterator(); + + while (iterator1.hasNext()) { -+ chunkposition1 = (ChunkPosition) iterator1.next(); -+ i2 = chunkposition1.x - i; -+ l1 = chunkposition1.y - j; -+ j2 = chunkposition1.z - k; -+ d1 = (double) (i2 * i2 + l1 * l1 + j2 * j2); ++ blockposition2 = (BlockPosition) iterator1.next(); ++ d1 = blockposition2.i(blockposition); + if (d1 < d0) { + d0 = d1; -+ chunkposition2 = chunkposition1; ++ blockposition3 = blockposition2; + } + } + -+ return chunkposition2; ++ return blockposition3; + } else { + return null; + } + } + } + -+ protected List o_() { ++ protected List y_() { + return null; + } + + private void a(World world) { -+ if (this.e == null) { -+ this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); -+ if (this.e == null) { -+ this.e = new PersistentStructure(this.a()); -+ world.a(this.a(), (PersistentBase) this.e); ++ if (this.d == null) { ++ this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); ++ if (this.d == null) { ++ this.d = new PersistentStructure(this.a()); ++ world.a(this.a(), (PersistentBase) this.d); + } else { -+ NBTTagCompound nbttagcompound = this.e.a(); ++ NBTTagCompound nbttagcompound = this.d.a(); + Iterator iterator = nbttagcompound.c().iterator(); + + while (iterator.hasNext()) { @@ -3370,32 +4823,150 @@ index 0000000..97308d0 + StructureStart structurestart = WorldGenFactory.a(nbttagcompound1, world); + + if (structurestart != null) { -+ this.d.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); ++ this.e.put(Long.valueOf(ChunkCoordIntPair.a(i, j)), structurestart); + } + } + } + } + } + } ++ + } + + private void a(int i, int j, StructureStart structurestart) { -+ this.e.a(structurestart.a(i, j), i, j); -+ this.e.c(); ++ this.d.a(structurestart.a(i, j), i, j); ++ this.d.c(); + } + + protected abstract boolean a(int i, int j); + + protected abstract StructureStart b(int i, int j); +} -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +diff --git a/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java b/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java new file mode 100644 -index 0000000..a283204 +index 0000000..48436ff --- /dev/null -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -0,0 +1,247 @@ ++++ b/src/main/java/net/minecraft/server/SwitchHelperBlockFlowerPot.java +@@ -0,0 +1,102 @@ +package net.minecraft.server; + ++class SwitchHelperBlockFlowerPot { ++ ++ static final int[] a; ++ static final int[] b = new int[EnumFlowerVarient.values().length]; ++ ++ static { ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.POPPY.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.BLUE_ORCHID.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror1) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.ALLIUM.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror2) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.HOUSTONIA.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror3) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.RED_TULIP.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror4) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.ORANGE_TULIP.ordinal()] = 6; ++ } catch (NoSuchFieldError nosuchfielderror5) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.WHITE_TULIP.ordinal()] = 7; ++ } catch (NoSuchFieldError nosuchfielderror6) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.PINK_TULIP.ordinal()] = 8; ++ } catch (NoSuchFieldError nosuchfielderror7) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.b[EnumFlowerVarient.OXEYE_DAISY.ordinal()] = 9; ++ } catch (NoSuchFieldError nosuchfielderror8) { ++ ; ++ } ++ ++ a = new int[EnumLogVariant.values().length]; ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.OAK.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror9) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.SPRUCE.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror10) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.BIRCH.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror11) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.JUNGLE.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror12) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.ACACIA.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror13) { ++ ; ++ } ++ ++ try { ++ SwitchHelperBlockFlowerPot.a[EnumLogVariant.DARK_OAK.ordinal()] = 6; ++ } catch (NoSuchFieldError nosuchfielderror14) { ++ ; ++ } ++ ++ } ++} +diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +new file mode 100644 +index 0000000..edbf02f +--- /dev/null ++++ b/src/main/java/net/minecraft/server/UserCache.java +@@ -0,0 +1,223 @@ ++package net.minecraft.server; ++ ++import com.google.common.base.Charsets; ++import com.google.common.collect.Iterators; ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; ++import com.google.common.io.Files; ++import com.google.gson.Gson; ++import com.google.gson.GsonBuilder; ++import com.mojang.authlib.Agent; ++import com.mojang.authlib.GameProfile; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; @@ -3412,17 +4983,7 @@ index 0000000..a283204 +import java.util.Locale; +import java.util.Map; +import java.util.UUID; -+ -+import net.minecraft.util.com.google.common.base.Charsets; -+import net.minecraft.util.com.google.common.collect.Iterators; -+import net.minecraft.util.com.google.common.collect.Lists; -+import net.minecraft.util.com.google.common.collect.Maps; -+import net.minecraft.util.com.google.common.io.Files; -+import net.minecraft.util.com.google.gson.Gson; -+import net.minecraft.util.com.google.gson.GsonBuilder; -+import net.minecraft.util.com.mojang.authlib.Agent; -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+import net.minecraft.util.org.apache.commons.io.IOUtils; ++import org.apache.commons.io.IOUtils; + +public class UserCache { + @@ -3435,9 +4996,9 @@ index 0000000..a283204 + private final File g; + private static final ParameterizedType h = new UserCacheEntryType(); + -+ public UserCache(MinecraftServer minecraftserver, File file1) { ++ public UserCache(MinecraftServer minecraftserver, File file) { + this.f = minecraftserver; -+ this.g = file1; ++ this.g = file; + GsonBuilder gsonbuilder = new GsonBuilder(); + + gsonbuilder.registerTypeHierarchyAdapter(UserCacheEntry.class, new BanEntrySerializer(this, (GameProfileLookup) null)); @@ -3477,22 +5038,19 @@ index 0000000..a283204 + + String s = gameprofile.getName().toLowerCase(Locale.ROOT); + UserCacheEntry usercacheentry = new UserCacheEntry(this, gameprofile, date, (GameProfileLookup) null); -+ LinkedList linkedlist = this.e; + -+ synchronized (this.e) { -+ if (this.d.containsKey(uuid)) { -+ UserCacheEntry usercacheentry1 = (UserCacheEntry) this.d.get(uuid); ++ if (this.d.containsKey(uuid)) { ++ UserCacheEntry usercacheentry1 = (UserCacheEntry) this.d.get(uuid); + -+ this.c.remove(usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); -+ this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercacheentry); -+ this.e.remove(gameprofile); -+ } else { -+ this.d.put(uuid, usercacheentry); -+ this.c.put(s, usercacheentry); -+ } -+ -+ this.e.addFirst(gameprofile); ++ this.c.remove(usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); ++ this.c.put(gameprofile.getName().toLowerCase(Locale.ROOT), usercacheentry); ++ this.e.remove(gameprofile); ++ } else { ++ this.d.put(uuid, usercacheentry); ++ this.c.put(s, usercacheentry); + } ++ ++ this.e.addFirst(gameprofile); + } + + public GameProfile getProfile(String s) { @@ -3502,12 +5060,7 @@ index 0000000..a283204 + if (usercacheentry != null && (new Date()).getTime() >= UserCacheEntry.a(usercacheentry).getTime()) { + this.d.remove(usercacheentry.a().getId()); + this.c.remove(usercacheentry.a().getName().toLowerCase(Locale.ROOT)); -+ LinkedList linkedlist = this.e; -+ -+ synchronized (this.e) { -+ this.e.remove(usercacheentry.a()); -+ } -+ ++ this.e.remove(usercacheentry.a()); + usercacheentry = null; + } + @@ -3515,12 +5068,8 @@ index 0000000..a283204 + + if (usercacheentry != null) { + gameprofile = usercacheentry.a(); -+ LinkedList linkedlist1 = this.e; -+ -+ synchronized (this.e) { -+ this.e.remove(gameprofile); -+ this.e.addFirst(gameprofile); -+ } ++ this.e.remove(gameprofile); ++ this.e.addFirst(gameprofile); + } else { + gameprofile = a(this.f, s1); + if (gameprofile != null) { @@ -3550,12 +5099,9 @@ index 0000000..a283204 + + if (usercacheentry != null) { + GameProfile gameprofile = usercacheentry.a(); -+ LinkedList linkedlist = this.e; + -+ synchronized (this.e) { -+ this.e.remove(gameprofile); -+ this.e.addFirst(gameprofile); -+ } ++ this.e.remove(gameprofile); ++ this.e.addFirst(gameprofile); + } + + return usercacheentry; @@ -3565,11 +5111,11 @@ index 0000000..a283204 + List list = null; + BufferedReader bufferedreader = null; + -+ label81: { ++ label64: { + try { + bufferedreader = Files.newReader(this.g, Charsets.UTF_8); -+ list = (List) this.b.fromJson(bufferedreader, h); -+ break label81; ++ list = (List) this.b.fromJson(bufferedreader, UserCache.h); ++ break label64; + } catch (FileNotFoundException filenotfoundexception) { + ; + } finally { @@ -3582,12 +5128,7 @@ index 0000000..a283204 + if (list != null) { + this.c.clear(); + this.d.clear(); -+ LinkedList linkedlist = this.e; -+ -+ synchronized (this.e) { -+ this.e.clear(); -+ } -+ ++ this.e.clear(); + list = Lists.reverse(list); + Iterator iterator = list.iterator(); + @@ -3599,6 +5140,7 @@ index 0000000..a283204 + } + } + } ++ + } + + public void c() { @@ -3616,17 +5158,12 @@ index 0000000..a283204 + } finally { + IOUtils.closeQuietly(bufferedwriter); + } ++ + } + + private List a(int i) { + ArrayList arraylist = Lists.newArrayList(); -+ LinkedList linkedlist = this.e; -+ ArrayList arraylist1; -+ -+ synchronized (this.e) { -+ arraylist1 = Lists.newArrayList(Iterators.limit(this.e.iterator(), i)); -+ } -+ ++ ArrayList arraylist1 = Lists.newArrayList(Iterators.limit(this.e.iterator(), i)); + Iterator iterator = arraylist1.iterator(); + + while (iterator.hasNext()) { @@ -3640,19 +5177,19 @@ index 0000000..a283204 + + return arraylist; + } ++ +} diff --git a/src/main/java/net/minecraft/server/UserCacheEntry.java b/src/main/java/net/minecraft/server/UserCacheEntry.java new file mode 100644 -index 0000000..fe129a5 +index 0000000..50b8b3c --- /dev/null +++ b/src/main/java/net/minecraft/server/UserCacheEntry.java -@@ -0,0 +1,34 @@ +@@ -0,0 +1,33 @@ +package net.minecraft.server; + ++import com.mojang.authlib.GameProfile; +import java.util.Date; + -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ +class UserCacheEntry { + + private final GameProfile b; @@ -3733,7 +5270,7 @@ index 0000000..678aa91 +} diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java new file mode 100644 -index 0000000..c0d0ff9 +index 0000000..2653bd8 --- /dev/null +++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java @@ -0,0 +1,166 @@ @@ -3747,31 +5284,29 @@ index 0000000..c0d0ff9 + super(flag); + } + -+ public boolean generate(World world, Random random, int i, int j, int k) { -+ int l = random.nextInt(3) + random.nextInt(2) + 6; ++ public boolean generate(World world, Random random, BlockPosition blockposition) { ++ int i = random.nextInt(3) + random.nextInt(2) + 6; + boolean flag = true; + -+ if (j >= 1 && j + l + 1 <= 256) { -+ int i1; -+ int j1; ++ if (blockposition.getY() >= 1 && blockposition.getY() + i + 1 <= 256) { ++ int j; ++ int k; + -+ for (int k1 = j; k1 <= j + 1 + l; ++k1) { ++ for (int l = blockposition.getY(); l <= blockposition.getY() + 1 + i; ++l) { + byte b0 = 1; + -+ if (k1 == j) { ++ if (l == blockposition.getY()) { + b0 = 0; + } + -+ if (k1 >= j + 1 + l - 2) { ++ if (l >= blockposition.getY() + 1 + i - 2) { + b0 = 2; + } + -+ for (i1 = i - b0; i1 <= i + b0 && flag; ++i1) { -+ for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) { -+ if (k1 >= 0 && k1 < 256) { -+ Block block = world.getType(i1, k1, j1); -+ -+ if (!this.a(block)) { ++ for (j = blockposition.getX() - b0; j <= blockposition.getX() + b0 && flag; ++j) { ++ for (k = blockposition.getZ() - b0; k <= blockposition.getZ() + b0 && flag; ++k) { ++ if (l >= 0 && l < 256) { ++ if (!this.a(world.getType(new BlockPosition(j, l, k)).getBlock())) { + flag = false; + } + } else { @@ -3784,100 +5319,101 @@ index 0000000..c0d0ff9 + if (!flag) { + return false; + } else { -+ Block block1 = world.getType(i, j - 1, k); ++ Block block = world.getType(blockposition.down()).getBlock(); + -+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) { -+ this.setType(world, i, j - 1, k, Blocks.DIRT); -+ this.setType(world, i + 1, j - 1, k, Blocks.DIRT); -+ this.setType(world, i + 1, j - 1, k + 1, Blocks.DIRT); -+ this.setType(world, i, j - 1, k + 1, Blocks.DIRT); -+ int l1 = random.nextInt(4); ++ if ((block == Blocks.GRASS || block == Blocks.DIRT) && blockposition.getY() < 256 - i - 1) { ++ this.a(world, blockposition.down()); ++ this.a(world, blockposition.a(1, -1, 0)); ++ this.a(world, blockposition.a(1, -1, 1)); ++ this.a(world, blockposition.a(0, -1, 1)); ++ EnumDirection enumdirection = EnumDirectionLimit.HORIZONTAL.a(random); + -+ i1 = l - random.nextInt(4); -+ j1 = 2 - random.nextInt(3); -+ int i2 = i; -+ int j2 = k; -+ int k2 = 0; ++ j = i - random.nextInt(4); ++ k = 2 - random.nextInt(3); ++ int i1 = blockposition.getX(); ++ int j1 = blockposition.getZ(); ++ int k1 = 0; + -+ int l2; -+ int i3; ++ int l1; ++ int i2; + -+ for (l2 = 0; l2 < l; ++l2) { -+ i3 = j + l2; -+ if (l2 >= i1 && j1 > 0) { -+ i2 += Direction.a[l1]; -+ j2 += Direction.b[l1]; -+ --j1; ++ for (l1 = 0; l1 < i; ++l1) { ++ i2 = blockposition.getY() + l1; ++ if (l1 >= j && k > 0) { ++ i1 += enumdirection.getAdjacentX(); ++ j1 += enumdirection.getAdjacentZ(); ++ --k; + } + -+ Block block2 = world.getType(i2, i3, j2); ++ BlockPosition blockposition1 = new BlockPosition(i1, i2, j1); ++ Material material = world.getType(blockposition1).getBlock().getMaterial(); + -+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) { -+ this.setTypeAndData(world, i2, i3, j2, Blocks.LOG2, 1); -+ this.setTypeAndData(world, i2 + 1, i3, j2, Blocks.LOG2, 1); -+ this.setTypeAndData(world, i2, i3, j2 + 1, Blocks.LOG2, 1); -+ this.setTypeAndData(world, i2 + 1, i3, j2 + 1, Blocks.LOG2, 1); -+ k2 = i3; ++ if (material == Material.AIR || material == Material.LEAVES) { ++ this.a(world, blockposition1, Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ this.a(world, blockposition1.east(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ this.a(world, blockposition1.south(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ this.a(world, blockposition1.east().south(), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ k1 = i2; + } + } + -+ for (l2 = -2; l2 <= 0; ++l2) { -+ for (i3 = -2; i3 <= 0; ++i3) { ++ for (l1 = -2; l1 <= 0; ++l1) { ++ for (i2 = -2; i2 <= 0; ++i2) { + byte b1 = -1; + -+ this.a(world, i2 + l2, k2 + b1, j2 + i3); -+ this.a(world, 1 + i2 - l2, k2 + b1, j2 + i3); -+ this.a(world, i2 + l2, k2 + b1, 1 + j2 - i3); -+ this.a(world, 1 + i2 - l2, k2 + b1, 1 + j2 - i3); -+ if ((l2 > -2 || i3 > -1) && (l2 != -1 || i3 != -2)) { ++ this.a(world, i1 + l1, k1 + b1, j1 + i2); ++ this.a(world, 1 + i1 - l1, k1 + b1, j1 + i2); ++ this.a(world, i1 + l1, k1 + b1, 1 + j1 - i2); ++ this.a(world, 1 + i1 - l1, k1 + b1, 1 + j1 - i2); ++ if ((l1 > -2 || i2 > -1) && (l1 != -1 || i2 != -2)) { + byte b2 = 1; + -+ this.a(world, i2 + l2, k2 + b2, j2 + i3); -+ this.a(world, 1 + i2 - l2, k2 + b2, j2 + i3); -+ this.a(world, i2 + l2, k2 + b2, 1 + j2 - i3); -+ this.a(world, 1 + i2 - l2, k2 + b2, 1 + j2 - i3); ++ this.a(world, i1 + l1, k1 + b2, j1 + i2); ++ this.a(world, 1 + i1 - l1, k1 + b2, j1 + i2); ++ this.a(world, i1 + l1, k1 + b2, 1 + j1 - i2); ++ this.a(world, 1 + i1 - l1, k1 + b2, 1 + j1 - i2); + } + } + } + + if (random.nextBoolean()) { -+ this.a(world, i2, k2 + 2, j2); -+ this.a(world, i2 + 1, k2 + 2, j2); -+ this.a(world, i2 + 1, k2 + 2, j2 + 1); -+ this.a(world, i2, k2 + 2, j2 + 1); ++ this.a(world, i1, k1 + 2, j1); ++ this.a(world, i1 + 1, k1 + 2, j1); ++ this.a(world, i1 + 1, k1 + 2, j1 + 1); ++ this.a(world, i1, k1 + 2, j1 + 1); + } + -+ for (l2 = -3; l2 <= 4; ++l2) { -+ for (i3 = -3; i3 <= 4; ++i3) { -+ if ((l2 != -3 || i3 != -3) && (l2 != -3 || i3 != 4) && (l2 != 4 || i3 != -3) && (l2 != 4 || i3 != 4) && (Math.abs(l2) < 3 || Math.abs(i3) < 3)) { -+ this.a(world, i2 + l2, k2, j2 + i3); ++ for (l1 = -3; l1 <= 4; ++l1) { ++ for (i2 = -3; i2 <= 4; ++i2) { ++ if ((l1 != -3 || i2 != -3) && (l1 != -3 || i2 != 4) && (l1 != 4 || i2 != -3) && (l1 != 4 || i2 != 4) && (Math.abs(l1) < 3 || Math.abs(i2) < 3)) { ++ this.a(world, i1 + l1, k1, j1 + i2); + } + } + } + -+ for (l2 = -1; l2 <= 2; ++l2) { -+ for (i3 = -1; i3 <= 2; ++i3) { -+ if ((l2 < 0 || l2 > 1 || i3 < 0 || i3 > 1) && random.nextInt(3) <= 0) { -+ int j3 = random.nextInt(3) + 2; ++ for (l1 = -1; l1 <= 2; ++l1) { ++ for (i2 = -1; i2 <= 2; ++i2) { ++ if ((l1 < 0 || l1 > 1 || i2 < 0 || i2 > 1) && random.nextInt(3) <= 0) { ++ int j2 = random.nextInt(3) + 2; + -+ int k3; ++ int k2; + -+ for (k3 = 0; k3 < j3; ++k3) { -+ this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1); ++ for (k2 = 0; k2 < j2; ++k2) { ++ this.a(world, new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); + } + -+ int l3; ++ int l2; + -+ for (k3 = -1; k3 <= 1; ++k3) { -+ for (l3 = -1; l3 <= 1; ++l3) { -+ this.a(world, i2 + l2 + k3, k2 - 0, j2 + i3 + l3); ++ for (k2 = -1; k2 <= 1; ++k2) { ++ for (l2 = -1; l2 <= 1; ++l2) { ++ this.a(world, i1 + l1 + k2, k1 - 0, j1 + i2 + l2); + } + } + -+ for (k3 = -2; k3 <= 2; ++k3) { -+ for (l3 = -2; l3 <= 2; ++l3) { -+ if (Math.abs(k3) != 2 || Math.abs(l3) != 2) { -+ this.a(world, i2 + l2 + k3, k2 - 1, j2 + i3 + l3); ++ for (k2 = -2; k2 <= 2; ++k2) { ++ for (l2 = -2; l2 <= 2; ++l2) { ++ if (Math.abs(k2) != 2 || Math.abs(l2) != 2) { ++ this.a(world, i1 + l1 + k2, k1 - 1, j1 + i2 + l2); + } + } + } @@ -3896,22 +5432,23 @@ index 0000000..c0d0ff9 + } + + private void a(World world, int i, int j, int k) { -+ Block block = world.getType(i, j, k); ++ Block block = world.getType(new BlockPosition(i, j, k)).getBlock(); + + if (block.getMaterial() == Material.AIR) { -+ this.setTypeAndData(world, i, j, k, Blocks.LEAVES2, 1); ++ this.a(world, new BlockPosition(i, j, k), Blocks.LEAVES2, 1); + } ++ + } +} diff --git a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java new file mode 100644 -index 0000000..1e5efc4 +index 0000000..02e6208 --- /dev/null +++ b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -@@ -0,0 +1,97 @@ +@@ -0,0 +1,104 @@ +package net.minecraft.server; + -+import java.util.ArrayList; ++import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; @@ -3921,13 +5458,13 @@ index 0000000..1e5efc4 + +public class WorldGenLargeFeature extends StructureGenerator { + -+ private static List e = Arrays.asList(new BiomeBase[] { BiomeBase.DESERT, BiomeBase.DESERT_HILLS, BiomeBase.JUNGLE, BiomeBase.JUNGLE_HILLS, BiomeBase.SWAMPLAND}); ++ private static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.DESERT, BiomeBase.DESERT_HILLS, BiomeBase.JUNGLE, BiomeBase.JUNGLE_HILLS, BiomeBase.SWAMPLAND}); + private List f; + private int g; + private int h; + + public WorldGenLargeFeature() { -+ this.f = new ArrayList(); ++ this.f = Lists.newArrayList(); + this.g = 32; + this.h = 8; + this.f.add(new BiomeMeta(EntityWitch.class, 1, 1, 1)); @@ -3944,6 +5481,7 @@ index 0000000..1e5efc4 + this.g = MathHelper.a((String) entry.getValue(), this.g, this.h + 1); + } + } ++ + } + + public String a() { @@ -3964,15 +5502,20 @@ index 0000000..1e5efc4 + + int i1 = i / this.g; + int j1 = j / this.g; -+ Random random = this.c.A(i1, j1, 14357617); ++ Random random = this.c.a(i1, j1, 14357617); + + i1 *= this.g; + j1 *= this.g; + i1 += random.nextInt(this.g - this.h); + j1 += random.nextInt(this.g - this.h); + if (k == i1 && l == j1) { -+ BiomeBase biomebase = this.c.getWorldChunkManager().getBiome(k * 16 + 8, l * 16 + 8); -+ Iterator iterator = e.iterator(); ++ BiomeBase biomebase = this.c.getWorldChunkManager().getBiome(new BlockPosition(k * 16 + 8, 0, l * 16 + 8)); ++ ++ if (biomebase == null) { ++ return false; ++ } ++ ++ Iterator iterator = WorldGenLargeFeature.d.iterator(); + + while (iterator.hasNext()) { + BiomeBase biomebase1 = (BiomeBase) iterator.next(); @@ -3990,8 +5533,8 @@ index 0000000..1e5efc4 + return new WorldGenLargeFeatureStart(this.c, this.b, i, j); + } + -+ public boolean a(int i, int j, int k) { -+ StructureStart structurestart = this.c(i, j, k); ++ public boolean a(BlockPosition blockposition) { ++ StructureStart structurestart = this.c(blockposition); + + if (structurestart != null && structurestart instanceof WorldGenLargeFeatureStart && !structurestart.a.isEmpty()) { + StructurePiece structurepiece = (StructurePiece) structurestart.a.getFirst(); @@ -4005,13 +5548,14 @@ index 0000000..1e5efc4 + public List b() { + return this.f; + } ++ +} diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java new file mode 100644 -index 0000000..c207a9c +index 0000000..38e9602 --- /dev/null +++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -@@ -0,0 +1,101 @@ +@@ -0,0 +1,100 @@ +package net.minecraft.server; + +import java.util.Random; @@ -4020,48 +5564,47 @@ index 0000000..c207a9c + + public WorldGenPackedIce2() {} + -+ public boolean generate(World world, Random random, int i, int j, int k) { -+ while (world.isEmpty(i, j, k) && j > 2) { -+ --j; ++ public boolean generate(World world, Random random, BlockPosition blockposition) { ++ while (world.isEmpty(blockposition) && blockposition.getY() > 2) { ++ blockposition = blockposition.down(); + } + -+ if (world.getType(i, j, k) != Blocks.SNOW_BLOCK) { ++ if (world.getType(blockposition).getBlock() != Blocks.SNOW) { + return false; + } else { -+ j += random.nextInt(4); -+ int l = random.nextInt(4) + 7; -+ int i1 = l / 4 + random.nextInt(2); ++ blockposition = blockposition.up(random.nextInt(4)); ++ int i = random.nextInt(4) + 7; ++ int j = i / 4 + random.nextInt(2); + -+ if (i1 > 1 && random.nextInt(60) == 0) { -+ j += 10 + random.nextInt(30); ++ if (j > 1 && random.nextInt(60) == 0) { ++ blockposition = blockposition.up(10 + random.nextInt(30)); + } + -+ int j1; -+ int k1; -+ int l1; ++ int k; ++ int l; + -+ for (j1 = 0; j1 < l; ++j1) { -+ float f = (1.0F - (float) j1 / (float) l) * (float) i1; ++ for (k = 0; k < i; ++k) { ++ float f = (1.0F - (float) k / (float) i) * (float) j; + -+ k1 = MathHelper.f(f); ++ l = MathHelper.f(f); + -+ for (l1 = -k1; l1 <= k1; ++l1) { -+ float f1 = (float) MathHelper.a(l1) - 0.25F; ++ for (int i1 = -l; i1 <= l; ++i1) { ++ float f1 = (float) MathHelper.a(i1) - 0.25F; + -+ for (int i2 = -k1; i2 <= k1; ++i2) { -+ float f2 = (float) MathHelper.a(i2) - 0.25F; ++ for (int j1 = -l; j1 <= l; ++j1) { ++ float f2 = (float) MathHelper.a(j1) - 0.25F; + -+ if ((l1 == 0 && i2 == 0 || f1 * f1 + f2 * f2 <= f * f) && (l1 != -k1 && l1 != k1 && i2 != -k1 && i2 != k1 || random.nextFloat() <= 0.75F)) { -+ Block block = world.getType(i + l1, j + j1, k + i2); ++ if ((i1 == 0 && j1 == 0 || f1 * f1 + f2 * f2 <= f * f) && (i1 != -l && i1 != l && j1 != -l && j1 != l || random.nextFloat() <= 0.75F)) { ++ Block block = world.getType(blockposition.a(i1, k, j1)).getBlock(); + -+ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -+ this.setType(world, i + l1, j + j1, k + i2, Blocks.PACKED_ICE); ++ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { ++ this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE); + } + -+ if (j1 != 0 && k1 > 1) { -+ block = world.getType(i + l1, j - j1, k + i2); -+ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -+ this.setType(world, i + l1, j - j1, k + i2, Blocks.PACKED_ICE); ++ if (k != 0 && l > 1) { ++ block = world.getType(blockposition.a(i1, -k, j1)).getBlock(); ++ if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { ++ this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE); + } + } + } @@ -4069,41 +5612,41 @@ index 0000000..c207a9c + } + } + -+ j1 = i1 - 1; -+ if (j1 < 0) { -+ j1 = 0; -+ } else if (j1 > 1) { -+ j1 = 1; ++ k = j - 1; ++ if (k < 0) { ++ k = 0; ++ } else if (k > 1) { ++ k = 1; + } + -+ for (int j2 = -j1; j2 <= j1; ++j2) { -+ k1 = -j1; ++ for (int k1 = -k; k1 <= k; ++k1) { ++ l = -k; + -+ while (k1 <= j1) { -+ l1 = j - 1; -+ int k2 = 50; ++ while (l <= k) { ++ BlockPosition blockposition1 = blockposition.a(k1, -1, l); ++ int l1 = 50; + -+ if (Math.abs(j2) == 1 && Math.abs(k1) == 1) { -+ k2 = random.nextInt(5); ++ if (Math.abs(k1) == 1 && Math.abs(l) == 1) { ++ l1 = random.nextInt(5); + } + + while (true) { -+ if (l1 > 50) { -+ Block block1 = world.getType(i + j2, l1, k + k1); ++ if (blockposition1.getY() > 50) { ++ Block block1 = world.getType(blockposition1).getBlock(); + -+ if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { -+ this.setType(world, i + j2, l1, k + k1, Blocks.PACKED_ICE); ++ if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { ++ this.a(world, blockposition1, Blocks.PACKED_ICE); ++ blockposition1 = blockposition1.down(); + --l1; -+ --k2; -+ if (k2 <= 0) { -+ l1 -= random.nextInt(5) + 1; -+ k2 = random.nextInt(5); ++ if (l1 <= 0) { ++ blockposition1 = blockposition1.down(random.nextInt(5) + 1); ++ l1 = random.nextInt(5); + } + continue; + } + } + -+ ++k1; ++ ++l; + break; + } + } @@ -4115,10 +5658,10 @@ index 0000000..c207a9c +} diff --git a/src/main/java/net/minecraft/server/WorldGenVillage.java b/src/main/java/net/minecraft/server/WorldGenVillage.java new file mode 100644 -index 0000000..7ca18a1 +index 0000000..375de85 --- /dev/null +++ b/src/main/java/net/minecraft/server/WorldGenVillage.java -@@ -0,0 +1,75 @@ +@@ -0,0 +1,77 @@ +package net.minecraft.server; + +import java.util.Arrays; @@ -4130,7 +5673,7 @@ index 0000000..7ca18a1 + +public class WorldGenVillage extends StructureGenerator { + -+ public static final List e = Arrays.asList(new BiomeBase[] { BiomeBase.PLAINS, BiomeBase.DESERT, BiomeBase.SAVANNA}); ++ public static final List d = Arrays.asList(new BiomeBase[] { BiomeBase.PLAINS, BiomeBase.DESERT, BiomeBase.SAVANNA}); + private int f; + private int g; + private int h; @@ -4153,6 +5696,7 @@ index 0000000..7ca18a1 + this.g = MathHelper.a((String) entry.getValue(), this.g, this.h + 1); + } + } ++ + } + + public String a() { @@ -4173,14 +5717,14 @@ index 0000000..7ca18a1 + + int i1 = i / this.g; + int j1 = j / this.g; -+ Random random = this.c.A(i1, j1, 10387312); ++ Random random = this.c.a(i1, j1, 10387312); + + i1 *= this.g; + j1 *= this.g; + i1 += random.nextInt(this.g - this.h); + j1 += random.nextInt(this.g - this.h); + if (k == i1 && l == j1) { -+ boolean flag = this.c.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, e); ++ boolean flag = this.c.getWorldChunkManager().a(k * 16 + 8, l * 16 + 8, 0, WorldGenVillage.d); + + if (flag) { + return true; @@ -4193,6 +5737,7 @@ index 0000000..7ca18a1 + protected StructureStart b(int i, int j) { + return new WorldGenVillageStart(this.c, this.b, i, j, this.f); + } ++ +} diff --git a/src/main/java/org/spigotmc/SneakyThrow.java b/src/main/java/org/spigotmc/SneakyThrow.java new file mode 100644 @@ -4228,5 +5773,5 @@ literal 0 HcmV?d00001 -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch index a7609fb7b5..6df5e3ffff 100644 --- a/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch +++ b/CraftBukkit-Patches/0003-Skeleton-API-Implementations.patch @@ -1,4 +1,4 @@ -From c3f529b0c38959cca79017feac7bd3d312b647aa Mon Sep 17 00:00:00 2001 +From f313b15b07c642bdd687eada899fa22f4d43d653 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 15:10:56 +1000 Subject: [PATCH] Skeleton API Implementations @@ -6,10 +6,10 @@ Subject: [PATCH] Skeleton API Implementations This contains the basic, empty implementations for some Spigot-API extensions. They are included early in the patching progress so that compilation will still succeed midway despite the APIs only being provided by subsequent patches. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index eb0b342..1fb4eeb 100644 +index f2a78c1..c20a2d5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1768,4 +1768,14 @@ public final class CraftServer implements Server { +@@ -1620,4 +1620,14 @@ public final class CraftServer implements Server { public UnsafeValues getUnsafe() { return CraftMagicNumbers.INSTANCE; } @@ -25,10 +25,10 @@ index eb0b342..1fb4eeb 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f4dec5b..7112c77 100644 +index 2f21f7a..4ab7c05 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1313,4 +1313,14 @@ public class CraftWorld implements World { +@@ -1323,4 +1323,14 @@ public class CraftWorld implements World { cps.queueUnload(chunk.locX, chunk.locZ); } } @@ -44,7 +44,7 @@ index f4dec5b..7112c77 100644 + // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -index 4f8d47d..09e7223 100644 +index dca8520..bf48e6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -71,4 +71,15 @@ public class CraftArrow extends AbstractProjectile implements Arrow { @@ -64,12 +64,12 @@ index 4f8d47d..09e7223 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 b8a9a14..4198dae 100644 +index b7e9d8f..4b26bb0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -402,4 +402,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - - return getHandle().vehicle.getBukkitEntity(); +@@ -436,4 +436,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + public boolean isCustomNameVisible() { + return getHandle().getCustomNameVisible(); } + + // Spigot start @@ -81,15 +81,35 @@ index b8a9a14..4198dae 100644 + { + return spigot; + } ++ // Spigot end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +index 64e346d..243e8e5 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +@@ -27,4 +27,15 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike + public EntityType getType() { + return EntityType.LIGHTNING; + } ++ ++ // Spigot start ++ private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() { ++ ++ }; ++ ++ @Override ++ public LightningStrike.Spigot spigot() { ++ return spigot; ++ } + // 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 bbf310b..da0c78e 100644 +index 286a58c..fb07b7d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1287,4 +1287,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1309,4 +1309,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } - collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); } + + // Spigot start @@ -122,8 +142,55 @@ index c9738c4..32d4a67 100644 + { + return spigot; + } ++ // Spigot end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +index 7095f6d..c7d3657 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java ++++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +@@ -58,4 +58,11 @@ final class CraftScore implements Score { + public CraftScoreboard getScoreboard() { + return objective.getScoreboard(); + } ++ ++ // Spigot start ++ @Override ++ public boolean isScoreSet() throws IllegalStateException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ // Spigot end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +index 8a640d3..e38d109 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java ++++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +@@ -142,4 +142,26 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { + scoreboard.teams.remove(team.getName()); + setUnregistered(); + } ++ ++ // Spigot start ++ @Override ++ public Set getEntries() throws IllegalStateException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ ++ @Override ++ public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ ++ @Override ++ public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } ++ ++ @Override ++ public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException { ++ throw new UnsupportedOperationException("Not supported yet."); ++ } + // Spigot end } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch index daf5fc896d..02b6020e6d 100644 --- a/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch +++ b/CraftBukkit-Patches/0004-Obfuscation-Helpers.patch @@ -1,4 +1,4 @@ -From dfc4c44370852db4d3b5f17f54adabb1c4d1a45d Mon Sep 17 00:00:00 2001 +From 0ec0c2a68e29d25a42c0c5c9d55d99b189df039f Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 14 Apr 2014 10:38:04 +1000 Subject: [PATCH] Obfuscation Helpers @@ -6,22 +6,22 @@ Subject: [PATCH] Obfuscation Helpers Provides several friendly named methods which map to a obfuscated method. Obfuscated methods which are used frequently should be added to this file to ease with updates to new Minecraft versions. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e65cbfa..998de35 100644 +index 4a39203..00e897b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1225,6 +1225,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - } +@@ -1298,6 +1298,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + } + // Spigot Start + public ServerConnection getServerConnection() + { -+ return this.p; ++ return this.q; + } + // Spigot End - public ServerConnection ai() { - return this.p; + public ServerConnection ao() { + return this.q; } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0005-Spigot-Configuration.patch b/CraftBukkit-Patches/0005-Spigot-Configuration.patch index 012853c6b6..fe05056c40 100644 --- a/CraftBukkit-Patches/0005-Spigot-Configuration.patch +++ b/CraftBukkit-Patches/0005-Spigot-Configuration.patch @@ -1,4 +1,4 @@ -From 590b9e6daca8420d6d7f3baae9380f553408bb28 Mon Sep 17 00:00:00 2001 +From 246253b92d92085145293e7c5d64a20fd836f083 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 7 Jul 2013 09:32:53 +1000 Subject: [PATCH] Spigot Configuration @@ -6,11 +6,11 @@ Subject: [PATCH] Spigot Configuration Provides the basic infrastructure to load and save the Spigot configuration file, spigot.yml diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 83f2dad..c591de0 100644 +index 29c0a34..424b71d 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -116,6 +116,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (this.L() < 0) { + if (this.Q() < 0) { this.setPort(this.propertyManager.getInt("server-port", 25565)); } + // Spigot start @@ -19,7 +19,7 @@ index 83f2dad..c591de0 100644 + org.spigotmc.SpigotConfig.registerCommands(); + // Spigot end - i.info("Generating keypair"); + DedicatedServer.LOGGER.info("Generating keypair"); this.a(MinecraftEncryption.b()); @@ -130,7 +135,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return false; @@ -33,34 +33,34 @@ index 83f2dad..c591de0 100644 + // Spigot End if (!this.getOnlineMode()) { - i.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); + DedicatedServer.LOGGER.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 08c506c..12c613c 100644 +index 0767445..94463a4 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -106,6 +106,7 @@ public abstract class World implements IBlockAccess { - public boolean pvpMode; - public boolean keepSpawnInMemory = true; - public ChunkGenerator generator; +@@ -85,6 +85,7 @@ public abstract class World implements IBlockAccess { + public long ticksPerMonsterSpawns; + public boolean populating; + private int tickPosition; + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public CraftWorld getWorld() { return this.world; -@@ -121,6 +122,7 @@ public abstract class World implements IBlockAccess { +@@ -99,6 +100,7 @@ public abstract class World implements IBlockAccess { + } - // 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 + protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { ++ this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // 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 1fb4eeb..9d45f34 100644 +index c20a2d5..ff9efe9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -323,8 +323,10 @@ public final class CraftServer implements Server { - updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update")); - updater.check(serverVersion); +@@ -245,8 +245,10 @@ public final class CraftServer implements Server { + chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold"); + loadIcon(); - loadPlugins(); - enablePlugins(PluginLoadOrder.STARTUP); @@ -71,15 +71,15 @@ index 1fb4eeb..9d45f34 100644 } public boolean getCommandBlockOverride(String command) { -@@ -789,6 +791,7 @@ public final class CraftServer implements Server { +@@ -672,6 +674,7 @@ public final class CraftServer implements Server { logger.log(Level.WARNING, "Failed to load banned-players.json, " + ex.getMessage()); } + org.spigotmc.SpigotConfig.init(); // Spigot for (WorldServer world : console.worlds) { - world.difficulty = difficulty; + world.worldData.setDifficulty(difficulty); world.setSpawnFlags(monsters, animals); -@@ -803,11 +806,14 @@ public final class CraftServer implements Server { +@@ -686,11 +689,14 @@ public final class CraftServer implements Server { } else { world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns(); } @@ -96,7 +96,7 @@ index 1fb4eeb..9d45f34 100644 int pollCount = 0; diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java new file mode 100644 -index 0000000..8ae9862 +index 0000000..6837305 --- /dev/null +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -0,0 +1,138 @@ @@ -158,8 +158,8 @@ index 0000000..8ae9862 + + commands = new HashMap(); + -+ version = getInt( "config-version", 7 ); -+ set( "config-version", 7 ); ++ version = getInt( "config-version", 8 ); ++ set( "config-version", 8 ); + readConfig( SpigotConfig.class, null ); + } + @@ -316,5 +316,5 @@ index 0000000..961ddb4 + } +} -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch b/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch index 941ea4348a..3dfae5e797 100644 --- a/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch +++ b/CraftBukkit-Patches/0006-Better-Chunk-Tick-Selection.patch @@ -1,4 +1,4 @@ -From cd02a08b0e6122b9061162abdf9ef24be9df1af9 Mon Sep 17 00:00:00 2001 +From 0e407f08a361f677443120db69572f7c73268167 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 @@ -6,24 +6,25 @@ Subject: [PATCH] Better Chunk Tick Selection An optimized chunk ticking algorithm which better selects chunks around players which are active on the server. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 12c613c..7ecd668 100644 +index e8c86d2..4d630b1 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -62,7 +62,7 @@ public abstract class World implements IBlockAccess { - public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public - public boolean isStatic; - // CraftBukkit start - public, longhashset +@@ -64,7 +64,7 @@ public abstract class World implements IBlockAccess { + public Scoreboard scoreboard = new Scoreboard(); + public final boolean isStatic; + // CraftBukkit - longhashset - protected LongHashSet chunkTickList = new LongHashSet(); + // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot private int K; public boolean allowMonsters; public boolean allowAnimals; -@@ -79,6 +79,30 @@ public abstract class World implements IBlockAccess { - private boolean M; - int[] I; - +@@ -85,6 +85,31 @@ public abstract class World implements IBlockAccess { + public long ticksPerMonsterSpawns; + public boolean populating; + private int tickPosition; ++ + // Spigot start -+ protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList; ++ protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; + protected float growthOdds = 100; + protected float modifiedOdds = 100; + private final byte chunkTickRadius; @@ -31,7 +32,7 @@ index 12c613c..7ecd668 100644 + public static long chunkToKey(int x, int z) + { + long k = ( ( ( (long) x ) & 0xFFFF0000L ) << 16 ) | ( ( ( (long) x ) & 0x0000FFFFL ) << 0 ); -+ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 ); ++ k |= ( ( ( (long) z ) & 0xFFFF0000L ) << 32 ) | ( ( ( (long) z ) & 0x0000FFFFL ) << 16 ); + return k; + } + @@ -46,22 +47,22 @@ index 12c613c..7ecd668 100644 + } + // Spigot end + - public BiomeBase getBiome(int i, int j) { - if (this.isLoaded(i, 0, j)) { - Chunk chunk = this.getChunkAtWorldCoords(i, j); -@@ -128,6 +152,11 @@ public abstract class World implements IBlockAccess { + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + + public CraftWorld getWorld() { +@@ -106,6 +131,11 @@ public abstract class World implements IBlockAccess { this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit // CraftBukkit end + // Spigot start + this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 ); -+ this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); ++ this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); + this.chunkTickList.setAutoCompactionFactor( 0 ); + // Spigot end this.K = this.random.nextInt(12000); this.allowMonsters = true; -@@ -1987,17 +2016,44 @@ public abstract class World implements IBlockAccess { +@@ -1884,17 +1914,44 @@ public abstract class World implements IBlockAccess { int k; int l; @@ -84,15 +85,15 @@ index 12c613c..7ecd668 100644 entityhuman = (EntityHuman) this.players.get(i); j = MathHelper.floor(entityhuman.locX / 16.0D); k = MathHelper.floor(entityhuman.locZ / 16.0D); - l = this.p(); + l = this.q(); - for (int i1 = -l; i1 <= l; ++i1) { - for (int j1 = -l; j1 <= l; ++j1) { -- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k)); // CraftBukkit +- this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(i1 + j, j1 + k)); + // Spigot start - Always update the chunk the player is on + long key = chunkToKey( j, k ); + int existingPlayers = Math.max( 0, chunkTickList.get( key ) ); // filter out -1 -+ chunkTickList.put(key, (short) (existingPlayers + 1)); ++ chunkTickList.put( key, (short) ( existingPlayers + 1 ) ); + + // Check and see if we update the chunks surrounding the player this tick + for ( int chunk = 0; chunk < chunksPerPlayer; chunk++ ) @@ -100,7 +101,7 @@ index 12c613c..7ecd668 100644 + int dx = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); + int dz = ( random.nextBoolean() ? 1 : -1 ) * random.nextInt( randRange ); + long hash = chunkToKey( dx + j, dz + k ); -+ if ( !chunkTickList.contains( hash ) && this.isChunkLoaded( dx + j, dz + k ) ) ++ if ( !chunkTickList.contains( hash ) && this.chunkProvider.isChunkLoaded(dx + j, dz + k ) ) + { + chunkTickList.put( hash, (short) -1 ); // no players } @@ -110,44 +111,56 @@ index 12c613c..7ecd668 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 ba7965d..71626fa 100644 +index 1a6024f..93e5a14 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -307,10 +307,20 @@ public class WorldServer extends World { - // CraftBukkit start - // Iterator iterator = this.chunkTickList.iterator(); +@@ -344,12 +344,15 @@ public class WorldServer extends World implements IAsyncTaskHandler { + protected void h() { + super.h(); + if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { +- Iterator iterator = this.chunkTickList.iterator(); ++ // Spigot start ++ gnu.trove.iterator.TLongShortIterator iterator = this.chunkTickList.iterator(); -- for (long chunkCoord : this.chunkTickList.popAll()) { -+ // Spigot start -+ for (net.minecraft.util.gnu.trove.iterator.TLongShortIterator iter = chunkTickList.iterator(); iter.hasNext();) { -+ iter.advance(); -+ long chunkCoord = iter.key(); -+ int chunkX = World.keyToX(chunkCoord); -+ int chunkZ = World.keyToZ(chunkCoord); -+ // If unloaded, or in procedd of being unloaded, drop it -+ if ( ( !this.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) ) + while (iterator.hasNext()) { +- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); ++ iterator.advance(); ++ long chunkCoord = iterator.key(); + +- this.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z).b(false); ++ this.getChunkAt(World.keyToX( chunkCoord ), World.keyToZ( chunkCoord )).b(false); ++ // Spigot end + } + + } else { +@@ -361,9 +364,21 @@ public class WorldServer extends World implements IAsyncTaskHandler { + // ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next(); + // int k = chunkcoordintpair1.x * 16; + // int l = chunkcoordintpair1.z * 16; +- for (long chunkCoord : 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.remove(); -+ continue; -+ } -+ // 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; ++ iter.advance(); ++ long chunkCoord = iter.key(); ++ int chunkX = World.keyToX( chunkCoord ); ++ int chunkZ = World.keyToZ( chunkCoord ); ++ // If unloaded, or in procedd of being unloaded, drop it ++ if ( ( !this.chunkProvider.isChunkLoaded( chunkX, chunkZ ) ) || ( this.chunkProviderServer.unloadQueue.contains( chunkX, chunkZ ) ) ) ++ { ++ iter.remove(); ++ continue; ++ } ++ // Spigot end ++ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); + int k = chunkX * 16; + int l = chunkZ * 16; + +@@ -458,6 +473,12 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } -@@ -401,6 +411,7 @@ public class WorldServer extends World { - - 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); - } - } -@@ -409,6 +420,12 @@ public class WorldServer extends World { - - this.methodProfiler.b(); } + // Spigot Start + if ( spigotConfig.clearChunksOnTick ) @@ -157,7 +170,7 @@ index ba7965d..71626fa 100644 + // Spigot End } - public boolean a(int i, int j, int k, Block block) { + protected BlockPosition a(BlockPosition blockposition) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 961ddb4..90a227f 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -179,5 +192,5 @@ index 961ddb4..90a227f 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch b/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch index ca279d3998..2490ea0660 100644 --- a/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch +++ b/CraftBukkit-Patches/0007-Crop-Growth-Rates.patch @@ -1,4 +1,4 @@ -From 4600e04f4209c804d64951143128240f3a68c3cf Mon Sep 17 00:00:00 2001 +From bec392e5a87c0d036a931c482c6e13df404bbded Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 17:17:20 +1000 Subject: [PATCH] Crop Growth Rates @@ -6,10 +6,10 @@ Subject: [PATCH] Crop Growth Rates Allows configuring the growth rates of crops as a percentage of their normal growth rate. diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 9876ebf..c043b9a 100644 +index 59d03ce..12e2b79 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -804,4 +804,16 @@ public class Block { +@@ -927,4 +927,16 @@ public class Block { return 0; } // CraftBukkit end @@ -27,111 +27,110 @@ index 9876ebf..c043b9a 100644 + // Spigot end } diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index e920c6f..f55e531 100644 +index 7046683..8569204 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 { - if (l < 3) { - int i1 = world.getData(i, j, k); +@@ -29,7 +29,7 @@ public class BlockCactus extends Block { + if (i < 3) { + int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); + +- if (j == 15) { ++ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot + world.setTypeUpdate(blockposition1, this.getBlockData()); + IBlockData iblockdata1 = iblockdata.set(BlockCactus.AGE, Integer.valueOf(0)); -- if (i1 == 15) { -+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot - CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit - world.setData(i, j, k, 0, 4); - this.doPhysics(world, i, j + 1, k, this); diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java -index 875181f..fd28d85 100644 +index 2ce2e34..d61251f 100644 --- a/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java -@@ -29,7 +29,7 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement - if (l < 7) { - float f = this.n(world, i, j, k); +@@ -32,8 +32,7 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement + if (i < 7) { + float f = a((Block) this, world, blockposition); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { -+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot - ++l; - CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit - } +- // CraftBukkit start ++ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start + IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1)); + CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); + // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java -index abd991b..7c00158 100644 +index 7516e21..8357fee 100644 --- a/src/main/java/net/minecraft/server/BlockGrass.java +++ b/src/main/java/net/minecraft/server/BlockGrass.java -@@ -39,7 +39,8 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { - } +@@ -45,7 +45,7 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { // CraftBukkit end - } else if (world.getLightLevel(i, j + 1, k) >= 9) { -- for (int l = 0; l < 4; ++l) { -+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot -+ for (int l = 0; l < numGrowth; ++l) { // Spigot - int i1 = i + random.nextInt(3) - 1; - int j1 = j + random.nextInt(5) - 3; - int k1 = k + random.nextInt(3) - 1; + } else { + if (world.getLightLevel(blockposition.up()) >= 9) { +- for (int i = 0; i < 4; ++i) { ++ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot + BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + Block block = world.getType(blockposition1.up()).getBlock(); + IBlockData iblockdata1 = world.getType(blockposition1); diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java -index 6671a84..4daa273 100644 +index f2944be..decefa9 100644 --- a/src/main/java/net/minecraft/server/BlockMushroom.java +++ b/src/main/java/net/minecraft/server/BlockMushroom.java -@@ -19,7 +19,7 @@ public class BlockMushroom extends BlockPlant implements IBlockFragilePlantEleme +@@ -20,7 +20,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 + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit - if (random.nextInt(25) == 0) { -+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot - byte b0 = 4; - int l = 5; - ++ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot int i = 5; + int i = 5; + boolean flag = true; + Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator(); diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java -index a01a6e6..2854bbc 100644 +index 8f792e4..cb383a5 100644 --- a/src/main/java/net/minecraft/server/BlockMycel.java +++ b/src/main/java/net/minecraft/server/BlockMycel.java -@@ -33,7 +33,8 @@ public class BlockMycel extends Block { - } +@@ -44,7 +44,7 @@ public class BlockMycel extends Block { // CraftBukkit end - } else if (world.getLightLevel(i, j + 1, k) >= 9) { -- for (int l = 0; l < 4; ++l) { -+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot -+ for (int l = 0; l < numGrowth; ++l) { // Spigot - int i1 = i + random.nextInt(3) - 1; - int j1 = j + random.nextInt(5) - 3; - int k1 = k + random.nextInt(3) - 1; + } else { + if (world.getLightLevel(blockposition.up()) >= 9) { +- for (int i = 0; i < 4; ++i) { ++ for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot + BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + IBlockData iblockdata1 = world.getType(blockposition1); + Block block = world.getType(blockposition1.up()).getBlock(); diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index a1350f6..6c04ad2 100644 +index ae7c617..11631da 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -24,7 +24,7 @@ public class BlockReed extends Block { - if (l < 3) { - int i1 = world.getData(i, j, k); +@@ -28,7 +28,7 @@ public class BlockReed extends Block { + if (i < 3) { + int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); -- if (i1 == 15) { -+ 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, 0); // CraftBukkit - world.setData(i, j, k, 0, 4); - } else { +- if (j == 15) { ++ if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot + // CraftBukkit start + // world.setTypeUpdate(blockposition.up(), this.getBlockData()); + // world.setTypeAndData(blockposition, iblockdata.set(BlockReed.AGE, Integer.valueOf(0)), 4); diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java -index 89e60a8..8258395 100644 +index ff4f576..39c0cba 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java -@@ -27,7 +27,7 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen - public void a(World world, int i, int j, int k, Random random) { +@@ -28,7 +28,7 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { if (!world.isStatic) { - super.a(world, i, j, k, random); -- if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) { -+ if (world.getLightLevel(i, j + 1, k) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot + super.b(world, blockposition, iblockdata, random); +- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) { ++ if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot) { // CraftBukkit start world.captureTreeGeneration = true; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java -index 40ad1c6..b37b187 100644 +index 23661a8..24e4d85 100644 --- a/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java -@@ -26,7 +26,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { - if (world.getLightLevel(i, j + 1, k) >= 9) { - float f = this.n(world, i, j, k); +@@ -47,7 +47,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { + if (world.getLightLevel(blockposition.up()) >= 9) { + float f = BlockCrops.a((Block) this, world, blockposition); - if (random.nextInt((int) (25.0F / f) + 1) == 0) { + if (random.nextInt((int) (world.growthOdds / (this == Blocks.PUMPKIN_STEM? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot - int l = world.getData(i, j, k); + int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue(); - if (l < 7) { + if (i < 7) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 90a227f..7e79ba5 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -173,5 +172,5 @@ index 90a227f..7e79ba5 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch b/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch index c2416c1200..f227d5a7a2 100644 --- a/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch +++ b/CraftBukkit-Patches/0008-More-Efficient-Chunk-Save-Queue.patch @@ -1,4 +1,4 @@ -From 0744f8a9ee4ffbd0f160aac4f4b48898b4b8e124 Mon Sep 17 00:00:00 2001 +From 0274f34174a47601b4fececf698e65325670b3bb 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 @@ -6,18 +6,24 @@ Subject: [PATCH] More Efficient Chunk Save Queue Optimizes the data structures behind the chunk save queue into ones more suitable for the type of data and access which they are used for. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 9402f0f..ea45af2 100644 +index a5175fd..9ab0b5e 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -15,6 +15,7 @@ import org.apache.logging.log4j.Logger; - +@@ -15,8 +15,11 @@ import org.apache.logging.log4j.Logger; public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { -+ private java.util.LinkedHashMap pendingSaves = new java.util.LinkedHashMap(); // Spigot private static final Logger a = LogManager.getLogger(); - private List b = new ArrayList(); - private Set c = new HashSet(); -@@ -30,13 +31,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +- private List b = Lists.newArrayList(); +- private Set c = Sets.newHashSet(); ++ // Spigot start ++ private java.util.LinkedHashMap pendingSaves = new java.util.LinkedHashMap(); ++ // private List b = Lists.newArrayList(); ++ // private Set c = Sets.newHashSet(); ++ // Spigot end + private Object d = new Object(); + private final File e; + +@@ -29,13 +32,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); synchronized (this.d) { @@ -36,7 +42,7 @@ index 9402f0f..ea45af2 100644 } return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31); -@@ -63,14 +62,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -62,14 +63,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { Object object = this.d; synchronized (this.d) { @@ -56,7 +62,7 @@ index 9402f0f..ea45af2 100644 } if (nbttagcompound == null) { -@@ -150,17 +147,11 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -150,17 +149,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { Object object = this.d; synchronized (this.d) { @@ -71,14 +77,16 @@ index 9402f0f..ea45af2 100644 + if (this.pendingSaves.put(chunkcoordintpair, new PendingChunkToSave(chunkcoordintpair, nbttagcompound)) != null) { + return; } -- + - this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); - this.c.add(chunkcoordintpair); ++ // this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound)); ++ // this.c.add(chunkcoordintpair); + // Spigot end - FileIOThread.a.a(this); + FileIOThread.a().a(this); } } -@@ -170,12 +161,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -170,12 +166,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { Object object = this.d; synchronized (this.d) { @@ -97,5 +105,5 @@ index 9402f0f..ea45af2 100644 if (pendingchunktosave != null) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch b/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch index fab9f27969..589c4bf7c4 100644 --- a/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch +++ b/CraftBukkit-Patches/0009-Merge-tweaks-and-configuration.patch @@ -1,4 +1,4 @@ -From 97b423f6d3b88ae933e6005d8b00a32096a047f8 Mon Sep 17 00:00:00 2001 +From 5fbdb53b2c7e4ed1a2eebbeaeb9f4b28d34f23a8 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,45 +6,45 @@ 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 394bfbf..c8c0d6a 100644 +index e2c0712..7f16401 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -117,7 +117,10 @@ public class EntityItem extends Entity { +@@ -122,7 +122,10 @@ public class EntityItem extends Entity { } - private void k() { -- Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator(); + private void w() { +- Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(0.5D, 0.0D, 0.5D)).iterator(); + // Spigot start + double radius = world.spigotConfig.itemMerge; -+ Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(radius, radius, radius)).iterator(); ++ Iterator iterator = this.world.a(EntityItem.class, this.getBoundingBox().grow(radius, radius, radius)).iterator(); + // Spigot end while (iterator.hasNext()) { EntityItem entityitem = (EntityItem) iterator.next(); -@@ -148,11 +151,13 @@ public class EntityItem extends Entity { - } else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) { - return false; - } else { -- itemstack1.count += itemstack.count; -- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); -- entityitem.age = Math.min(entityitem.age, this.age); -- entityitem.setItemStack(itemstack1); -- this.die(); -+ // Spigot start -+ itemstack.count += itemstack1.count; -+ this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); -+ this.age = Math.min(entityitem.age, this.age); -+ this.setItemStack(itemstack); -+ entityitem.die(); -+ // Spigot end - return true; - } - } else { +@@ -156,11 +159,13 @@ public class EntityItem extends Entity { + } else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) { + return false; + } else { +- itemstack1.count += itemstack.count; +- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); +- entityitem.age = Math.min(entityitem.age, this.age); +- entityitem.setItemStack(itemstack1); +- this.die(); ++ // Spigot start ++ itemstack.count += itemstack1.count; ++ this.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay); ++ this.age = Math.min(entityitem.age, this.age); ++ this.setItemStack(itemstack); ++ entityitem.die(); ++ // Spigot end + return true; + } + } else { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7ecd668..dcc87e8 100644 +index 4d630b1..18f0311 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1010,6 +1010,23 @@ public abstract class World implements IBlockAccess { +@@ -908,6 +908,23 @@ public abstract class World implements IBlockAccess { // Not all projectiles extend EntityProjectile, so check for Bukkit interface instead event = CraftEventFactory.callProjectileLaunchEvent(entity); } @@ -53,7 +53,7 @@ index 7ecd668..dcc87e8 100644 + EntityExperienceOrb xp = (EntityExperienceOrb) entity; + double radius = spigotConfig.expMerge; + if (radius > 0) { -+ List entities = this.getEntities(entity, entity.boundingBox.grow(radius, radius, radius)); ++ List entities = this.getEntities(entity, entity.getBoundingBox().grow(radius, radius, radius)); + for (Entity e : entities) { + if (e instanceof EntityExperienceOrb) { + EntityExperienceOrb loopItem = (EntityExperienceOrb) e; @@ -92,5 +92,5 @@ index 7e79ba5..1545a61 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0011-Async-Operation-Catching.patch b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch similarity index 80% rename from CraftBukkit-Patches/0011-Async-Operation-Catching.patch rename to CraftBukkit-Patches/0010-Async-Operation-Catching.patch index 9ffb3ba959..d215678a59 100644 --- a/CraftBukkit-Patches/0011-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch @@ -1,4 +1,4 @@ -From 6ef33540f17b60e923a59626dc721ab79f68e4f3 Mon Sep 17 00:00:00 2001 +From 3397d600dc9d5afeb67b5979f7490b5bfce721c1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 25 Mar 2014 16:10:01 +1100 Subject: [PATCH] Async Operation Catching @@ -6,30 +6,30 @@ 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 c043b9a..0893a6f 100644 +index 12e2b79..9a19752 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -433,9 +433,13 @@ public class Block { +@@ -268,9 +268,13 @@ public class Block { return 10; } -- public void onPlace(World world, int i, int j, int k) {} -+ public void onPlace(World world, int i, int j, int k) { +- public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {} ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { + org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot + } -- 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, Block block, int l) { +- public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {} ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { + org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot + } 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 1af0e67..70b0181 100644 +index c9058db..350f2f7 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java -@@ -91,6 +91,7 @@ public class EntityTracker { +@@ -94,6 +94,7 @@ public class EntityTracker { } public void addEntity(Entity entity, int i, int j, boolean flag) { @@ -37,7 +37,7 @@ index 1af0e67..70b0181 100644 if (i > this.e) { i = this.e; } -@@ -125,6 +126,7 @@ public class EntityTracker { +@@ -129,6 +130,7 @@ public class EntityTracker { } public void untrackEntity(Entity entity) { @@ -46,18 +46,18 @@ index 1af0e67..70b0181 100644 EntityPlayer entityplayer = (EntityPlayer) entity; 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 0cf9ad5..f654d58 100644 +index 7c58740..f5d518f 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -299,6 +299,7 @@ public class EntityTrackerEntry { +@@ -308,6 +308,7 @@ public class EntityTrackerEntry { } public void updatePlayer(EntityPlayer entityplayer) { + org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot if (entityplayer != this.tracker) { - double d0 = entityplayer.locX - (double) (this.xLoc / 32); - double d1 = entityplayer.locZ - (double) (this.zLoc / 32); -@@ -515,6 +516,7 @@ public class EntityTrackerEntry { + if (this.c(entityplayer)) { + if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { +@@ -536,6 +537,7 @@ public class EntityTrackerEntry { } public void clear(EntityPlayer entityplayer) { @@ -66,18 +66,18 @@ index 0cf9ad5..f654d58 100644 this.trackedPlayers.remove(entityplayer); entityplayer.d(this.tracker); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index dcc87e8..d12ef7a 100644 +index 4cd59aa..a16be9b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -979,6 +979,7 @@ public abstract class World implements IBlockAccess { +@@ -878,6 +878,7 @@ public abstract class World implements IBlockAccess { } public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason + org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot if (entity == null) return false; // CraftBukkit end - -@@ -1086,6 +1087,7 @@ public abstract class World implements IBlockAccess { + int i = MathHelper.floor(entity.locX / 16.0D); +@@ -985,6 +986,7 @@ public abstract class World implements IBlockAccess { } public void removeEntity(Entity entity) { @@ -85,16 +85,16 @@ index dcc87e8..d12ef7a 100644 entity.die(); if (entity instanceof EntityHuman) { this.players.remove(entity); -@@ -2466,6 +2468,7 @@ public abstract class World implements IBlockAccess { +@@ -2410,6 +2412,7 @@ public abstract class World implements IBlockAccess { } - public void a(List list) { + public void b(Collection collection) { + org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot // CraftBukkit start - // this.entityList.addAll(list); - Entity entity = null; + // this.entityList.addAll(collection); + Iterator iterator = collection.iterator(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 7112c77..c76c3d3 100644 +index 4ab7c05..b9032cd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -162,6 +162,7 @@ public class CraftWorld implements World { @@ -122,10 +122,10 @@ index 7112c77..c76c3d3 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 6493ce7..8b599f2 100644 +index fb07b7d..01b1822 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -238,6 +238,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -214,6 +214,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void kickPlayer(String message) { @@ -169,5 +169,5 @@ index 0000000..4b3aa85 + } +} -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0010-LongHash-Tweaks.patch b/CraftBukkit-Patches/0010-LongHash-Tweaks.patch deleted file mode 100644 index f623bc77b7..0000000000 --- a/CraftBukkit-Patches/0010-LongHash-Tweaks.patch +++ /dev/null @@ -1,225 +0,0 @@ -From 0c3794fe2fabe95056ec884d1b83e4ac4560b699 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 21 Jun 2013 17:13:47 +1000 -Subject: [PATCH] LongHash Tweaks - -Tweaks the LongHash algorithm and provides a large array based map to look up values centered around the origin, ie the access normally seen on a Minecraft server. - -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -index 691cafd..9d54472 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -@@ -10,6 +10,6 @@ public class LongHash { - } - - public static int lsw(long l) { -- return (int) (l & 0xFFFFFFFF) + Integer.MIN_VALUE; -+ return (int) (l) + Integer.MIN_VALUE; // Spigot - remove redundant & - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -index 22c96c5..7f659b7 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -@@ -31,6 +31,7 @@ public class LongHashSet { - private int elements; - private long[] values; - private int modCount; -+ private org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongHashSet() { - this(INITIAL_SIZE); -@@ -56,10 +57,30 @@ public class LongHashSet { - } - - public boolean contains(int msw, int lsw) { -+ // Spigot start -+ if ( elements == 0 ) -+ { -+ return false; -+ } -+ if ( flat.contains( msw, lsw ) ) -+ { -+ return true; -+ } -+ // Spigot end - return contains(LongHash.toLong(msw, lsw)); - } - - public boolean contains(long value) { -+ // Spigot start -+ if ( elements == 0 ) -+ { -+ return false; -+ } -+ if ( flat.contains( value ) ) -+ { -+ return true; -+ } -+ // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -82,6 +103,7 @@ public class LongHashSet { - } - - public boolean add(long value) { -+ flat.put( value, Boolean.TRUE ); // Spigot - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -125,10 +147,18 @@ public class LongHashSet { - } - - public void remove(int msw, int lsw) { -- remove(LongHash.toLong(msw, lsw)); -+ // Spigot start -+ flat.remove(msw, lsw); -+ remove0(LongHash.toLong(msw, lsw)); - } - - public boolean remove(long value) { -+ flat.remove(value); -+ return remove0(value); -+ } -+ -+ private boolean remove0(long value) { -+ // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -161,6 +191,7 @@ public class LongHashSet { - - freeEntries = values.length; - modCount++; -+ flat = new org.spigotmc.FlatMap(); - } - - public long[] toArray() { -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -index 01861cc..2e5b436 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -@@ -28,6 +28,7 @@ public class LongObjectHashMap implements Cloneable, Serializable { - private transient V[][] values; - private transient int modCount; - private transient int size; -+ private transient org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongObjectHashMap() { - initialize(); -@@ -61,6 +62,17 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V get(long key) { -+ // Spigot start -+ if ( size == 0 ) -+ { -+ return null; -+ } -+ V val = flat.get( key ); -+ if ( val != null ) -+ { -+ return val; -+ } -+ // Spigot end - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) return null; -@@ -78,6 +90,7 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V put(long key, V value) { -+ flat.put(key, value); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] innerKeys = keys[index]; - V[] innerValues = values[index]; -@@ -124,6 +137,7 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V remove(long key) { -+ flat.remove(key); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) { -@@ -174,6 +188,7 @@ public class LongObjectHashMap implements Cloneable, Serializable { - size = 0; - Arrays.fill(keys, null); - Arrays.fill(values, null); -+ flat = new org.spigotmc.FlatMap(); - } - - public Set keySet() { -diff --git a/src/main/java/org/spigotmc/FlatMap.java b/src/main/java/org/spigotmc/FlatMap.java -new file mode 100644 -index 0000000..9416f6e ---- /dev/null -+++ b/src/main/java/org/spigotmc/FlatMap.java -@@ -0,0 +1,64 @@ -+package org.spigotmc; -+ -+import org.bukkit.craftbukkit.util.LongHash; -+ -+public class FlatMap -+{ -+ -+ private static final int FLAT_LOOKUP_SIZE = 512; -+ private final Object[][] flatLookup = new Object[ FLAT_LOOKUP_SIZE * 2 ][ FLAT_LOOKUP_SIZE * 2 ]; -+ -+ public void put(long msw, long lsw, V value) -+ { -+ long acx = Math.abs( msw ); -+ long acz = Math.abs( lsw ); -+ if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -+ { -+ flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )] = value; -+ } -+ } -+ -+ public void put(long key, V value) -+ { -+ put( LongHash.msw( key ), LongHash.lsw( key ), value ); -+ -+ } -+ -+ public void remove(long key) -+ { -+ put( key, null ); -+ } -+ -+ public void remove(long msw, long lsw) -+ { -+ put( msw, lsw, null ); -+ } -+ -+ public boolean contains(long msw, long lsw) -+ { -+ return get( msw, lsw ) != null; -+ } -+ -+ public boolean contains(long key) -+ { -+ return get( key ) != null; -+ } -+ -+ public V get(long msw, long lsw) -+ { -+ long acx = Math.abs( msw ); -+ long acz = Math.abs( lsw ); -+ if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -+ { -+ return (V) flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )]; -+ } else -+ { -+ return null; -+ } -+ } -+ -+ public V get(long key) -+ { -+ return get( LongHash.msw( key ), LongHash.lsw( key ) ); -+ } -+} --- -1.9.1 - diff --git a/CraftBukkit-Patches/0012-View-Distance.patch b/CraftBukkit-Patches/0011-View-Distance.patch similarity index 84% rename from CraftBukkit-Patches/0012-View-Distance.patch rename to CraftBukkit-Patches/0011-View-Distance.patch index 430abceb91..eef3c38dfc 100644 --- a/CraftBukkit-Patches/0012-View-Distance.patch +++ b/CraftBukkit-Patches/0011-View-Distance.patch @@ -1,4 +1,4 @@ -From 96c3f91f9741f81bce19d0b681a8adaf05eb234f Mon Sep 17 00:00:00 2001 +From 84fd7cb51f698d601ac8d22e24e9baf6f04953b7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Mar 2013 09:52:41 +1100 Subject: [PATCH] View Distance @@ -6,7 +6,7 @@ Subject: [PATCH] View Distance This commit allows the user to select per world view distances, and view distances below 3. Be wary of the issues selecting a view distance of 1 or 2 may cause! diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index ae53635..cc1b095 100644 +index 8ac9387..5ca5935 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -26,9 +26,9 @@ public class PlayerChunkMap { @@ -16,24 +16,24 @@ index ae53635..cc1b095 100644 - public PlayerChunkMap(WorldServer worldserver) { + public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) { this.world = worldserver; -- this.a(worldserver.getMinecraftServer().getPlayerList().s()); +- this.a(worldserver.getMinecraftServer().getPlayerList().t()); + this.a(viewDistance); // Spigot } public WorldServer a() { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 71626fa..8f25a15 100644 +index 93e5a14..f34b76e 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -55,7 +55,7 @@ public class WorldServer extends World { +@@ -62,7 +62,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { // CraftBukkit end this.server = minecraftserver; this.tracker = new EntityTracker(this); - this.manager = new PlayerChunkMap(this); + this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot - if (this.entitiesById == null) { - this.entitiesById = new IntHashMap(); - } + this.worldProvider.a(this); + this.chunkProvider = this.k(); + this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 1545a61..6cc3a91 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -51,5 +51,5 @@ index 1545a61..6cc3a91 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0013-Spigot-Timings.patch b/CraftBukkit-Patches/0012-Spigot-Timings.patch similarity index 80% rename from CraftBukkit-Patches/0013-Spigot-Timings.patch rename to CraftBukkit-Patches/0012-Spigot-Timings.patch index 1a8c12c756..54769b695b 100644 --- a/CraftBukkit-Patches/0013-Spigot-Timings.patch +++ b/CraftBukkit-Patches/0012-Spigot-Timings.patch @@ -1,4 +1,4 @@ -From 6dc58e160c5b62dc3c5d6f1bb40678a44fcac26d Mon Sep 17 00:00:00 2001 +From 0684c3cc896612daa522771c2faadafebd1c776a Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 10 Jan 2013 00:18:11 -0500 Subject: [PATCH] Spigot Timings @@ -6,70 +6,70 @@ Subject: [PATCH] Spigot Timings Overhauls the Timings System adding performance tracking all around the Minecraft Server diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 3ac0ae4..9acfe12 100644 +index 4ac212b..7519bfa 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -847,6 +847,7 @@ public class Chunk { +@@ -876,6 +876,7 @@ public class Chunk { } public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { + world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot - if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) { - ichunkprovider.getChunkAt(ichunkprovider1, i, j); - } -@@ -862,6 +863,7 @@ public class Chunk { - if (ichunkprovider.isChunkLoaded(i - 1, j - 1) && !ichunkprovider.getOrCreateChunk(i - 1, j - 1).done && ichunkprovider.isChunkLoaded(i, j - 1) && ichunkprovider.isChunkLoaded(i - 1, j)) { - ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1); + boolean flag = ichunkprovider.isChunkLoaded(i, j - 1); + boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j); + boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1); +@@ -922,6 +923,7 @@ public class Chunk { + } } + + world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot } - public int d(int i, int j) { + public BlockPosition h(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index c88d5d4..22330c3 100644 +index a363af7..9ee7e75 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -137,6 +137,7 @@ public class ChunkProviderServer implements IChunkProvider { - boolean newChunk = false; +@@ -130,6 +130,7 @@ public class ChunkProviderServer implements IChunkProvider { + // CraftBukkit end if (chunk == null) { + world.timings.syncChunkLoadTimer.startTiming(); // Spigot chunk = this.loadChunk(i, j); if (chunk == null) { if (this.chunkProvider == null) { -@@ -187,6 +188,7 @@ public class ChunkProviderServer implements IChunkProvider { - } +@@ -181,6 +182,7 @@ public class ChunkProviderServer implements IChunkProvider { // CraftBukkit end + chunk.loadNearby(this, this, i, j); + world.timings.syncChunkLoadTimer.stopTiming(); // Spigot } return chunk; -@@ -219,7 +221,9 @@ public class ChunkProviderServer implements IChunkProvider { +@@ -215,7 +217,9 @@ public class ChunkProviderServer implements IChunkProvider { if (chunk != null) { - chunk.lastSaved = this.world.getTime(); + chunk.setLastSaved(this.world.getTime()); if (this.chunkProvider != null) { + world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot - this.chunkProvider.recreateStructures(i, j); + this.chunkProvider.recreateStructures(chunk, i, j); + world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot } } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index ea45af2..59fe8ac 100644 +index 9ab0b5e..1eea51c 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -44,7 +44,9 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -45,7 +45,9 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { // CraftBukkit start - Add async variant, provide compatibility public Chunk a(World world, int i, int j) { + world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot - Object[] data = this.loadChunk(world, i, j); + Object[] data = loadChunk(world, i, j); + world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot if (data != null) { Chunk chunk = (Chunk) data[0]; NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; -@@ -343,6 +345,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -381,6 +383,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { // CraftBukkit end @@ -77,7 +77,7 @@ index ea45af2..59fe8ac 100644 NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); if (nbttaglist1 != null) { -@@ -368,7 +371,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -406,7 +409,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } } } @@ -87,7 +87,7 @@ index ea45af2..59fe8ac 100644 NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities", 10); if (nbttaglist2 != null) { -@@ -381,6 +385,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -419,6 +423,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } } } @@ -96,16 +96,16 @@ index ea45af2..59fe8ac 100644 if (nbttagcompound.hasKeyOfType("TileTicks", 9)) { NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks", 10); -@@ -393,6 +399,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -438,6 +444,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } } } + world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot - // return chunk; // CraftBukkit + // return chunk; // CraftBukkit } diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index c591de0..58e68da 100644 +index 424b71d..390c6eb 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -18,6 +18,7 @@ import java.io.PrintStream; @@ -116,27 +116,27 @@ index c591de0..58e68da 100644 import org.bukkit.event.server.ServerCommandEvent; // CraftBukkit end -@@ -291,6 +292,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -317,6 +318,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - public void aB() { + public void aM() { + SpigotTimings.serverCommandTimer.startTiming(); // Spigot - while (!this.j.isEmpty()) { - ServerCommand servercommand = (ServerCommand) this.j.remove(0); + while (!this.k.isEmpty()) { + ServerCommand servercommand = (ServerCommand) this.k.remove(0); -@@ -303,6 +305,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - this.server.dispatchServerCommand(this.console, servercommand); +@@ -330,6 +332,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer // CraftBukkit end } + + SpigotTimings.serverCommandTimer.stopTiming(); // Spigot } - public boolean X() { + public boolean ad() { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 09c9c8e..a7d9c11 100644 +index 6e395b6..e2f3456 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -15,6 +15,7 @@ import org.bukkit.entity.Hanging; +@@ -16,6 +16,7 @@ import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Painting; import org.bukkit.entity.Vehicle; @@ -144,7 +144,7 @@ index 09c9c8e..a7d9c11 100644 import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.painting.PaintingBreakByEntityEvent; -@@ -113,6 +114,8 @@ public abstract class Entity { +@@ -112,6 +113,8 @@ public abstract class Entity implements ICommandListener { public boolean valid; // CraftBukkit public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only @@ -153,27 +153,28 @@ index 09c9c8e..a7d9c11 100644 public int getId() { return this.id; } -@@ -416,6 +419,7 @@ public abstract class Entity { - return; - } - // CraftBukkit end +@@ -378,6 +381,8 @@ public abstract class Entity implements ICommandListener { + } + + public void move(double d0, double d1, double d2) { + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot - if (this.X) { - this.boundingBox.d(d0, d1, d2); - this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; -@@ -724,6 +728,7 @@ public abstract class Entity { ++ + if (this.T) { + this.a(this.getBoundingBox().c(d0, d1, d2)); + this.recalcPosition(); +@@ -716,6 +721,7 @@ public abstract class Entity implements ICommandListener { this.world.methodProfiler.b(); } + org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - protected String H() { + private void recalcPosition() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0c63b2c..6a0bee6 100644 +index 0aaee5f..803b5df 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -16,6 +16,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; +@@ -17,6 +17,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; import org.bukkit.event.entity.EntityRegainHealthEvent; // CraftBukkit end @@ -181,99 +182,99 @@ index 0c63b2c..6a0bee6 100644 + public abstract class EntityLiving extends Entity { - private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); -@@ -1357,6 +1359,7 @@ public abstract class EntityLiving extends Entity { + private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); +@@ -1384,6 +1386,7 @@ public abstract class EntityLiving extends Entity { } - public void h() { + public void s_() { + SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.h(); + super.s_(); if (!this.world.isStatic) { - int i = this.aZ(); -@@ -1395,7 +1398,9 @@ public abstract class EntityLiving extends Entity { + int i = this.bu(); +@@ -1422,7 +1425,9 @@ public abstract class EntityLiving extends Entity { } } + SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.e(); + this.m(); + SpigotTimings.timerEntityTickRest.startTiming(); // Spigot double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); -@@ -1460,6 +1465,7 @@ public abstract class EntityLiving extends Entity { +@@ -1487,6 +1492,7 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); - this.aX += f2; + this.aR += f2; + SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } - protected float f(float f, float f1) { -@@ -1524,6 +1530,7 @@ public abstract class EntityLiving extends Entity { + protected float h(float f, float f1) { +@@ -1551,6 +1557,7 @@ public abstract class EntityLiving extends Entity { } this.world.methodProfiler.a("ai"); + SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.bh()) { - this.bc = false; - this.bd = 0.0F; -@@ -1541,6 +1548,7 @@ public abstract class EntityLiving extends Entity { - this.aO = this.yaw; - } + if (this.bC()) { + this.aW = false; + this.aX = 0.0F; +@@ -1561,6 +1568,7 @@ public abstract class EntityLiving extends Entity { + this.doTick(); + this.world.methodProfiler.b(); } + SpigotTimings.timerEntityAI.stopTiming(); // Spigot this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); -@@ -1562,11 +1570,15 @@ public abstract class EntityLiving extends Entity { - this.bd *= 0.98F; - this.be *= 0.98F; - this.bf *= 0.9F; +@@ -1582,11 +1590,15 @@ public abstract class EntityLiving extends Entity { + this.aX *= 0.98F; + this.aY *= 0.98F; + this.aZ *= 0.9F; + SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.e(this.bd, this.be); + this.g(this.aX, this.aY); + SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot this.world.methodProfiler.b(); this.world.methodProfiler.a("push"); if (!this.world.isStatic) { + SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.bo(); + this.bK(); + SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot } this.world.methodProfiler.b(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 998de35..0a15416 100644 +index 00e897b..1cb9d38 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -37,6 +37,7 @@ import jline.console.ConsoleReader; - import joptsimple.OptionSet; +@@ -45,6 +45,7 @@ import joptsimple.OptionSet; + import org.bukkit.craftbukkit.Main; import org.bukkit.World.Environment; +import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.server.RemoteServerCommandEvent; import org.bukkit.event.world.WorldSaveEvent; -@@ -545,6 +546,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - protected void t() {} +@@ -587,6 +588,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + protected void x() {} - protected void u() throws ExceptionWorldConflict { // CraftBukkit - added throws + protected void y() throws ExceptionWorldConflict { // CraftBukkit - added throws + SpigotTimings.serverTickTimer.startTiming(); // Spigot long i = System.nanoTime(); ++this.ticks; -@@ -571,10 +573,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -613,10 +615,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } - if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit + if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit + SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); - this.u.savePlayers(); + this.v.savePlayers(); this.saveChunks(true); this.methodProfiler.b(); + SpigotTimings.worldSaveTimer.stopTiming(); // Spigot } this.methodProfiler.a("tallying"); -@@ -591,21 +595,30 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -633,6 +637,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.methodProfiler.b(); this.methodProfiler.b(); @@ -281,8 +282,10 @@ index 998de35..0a15416 100644 + org.spigotmc.CustomTimingsHandler.tick(); // Spigot } - public void v() { - this.methodProfiler.a("levels"); + public void z() { +@@ -651,16 +657,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + + this.methodProfiler.c("levels"); + SpigotTimings.schedulerTimer.startTiming(); // Spigot // CraftBukkit start @@ -304,7 +307,7 @@ index 998de35..0a15416 100644 // Send time updates to everyone, it will get the right time from the world the player is in. if (this.ticks % 20 == 0) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) { -@@ -613,6 +626,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -668,6 +681,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time } } @@ -312,27 +315,27 @@ index 998de35..0a15416 100644 int i; -@@ -638,7 +652,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -691,7 +705,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs CrashReport crashreport; try { + worldserver.timings.doTick.startTiming(); // Spigot worldserver.doTick(); + worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable) { - crashreport = CrashReport.a(throwable, "Exception ticking world"); + } catch (Throwable throwable1) { + crashreport = CrashReport.a(throwable1, "Exception ticking world"); worldserver.a(crashreport); -@@ -646,7 +662,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -699,7 +715,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } try { + worldserver.timings.tickEntities.startTiming(); // Spigot worldserver.tickEntities(); + worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable1) { - crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); + } catch (Throwable throwable2) { + crashreport = CrashReport.a(throwable2, "Exception ticking world entities"); worldserver.a(crashreport); -@@ -655,7 +673,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -708,7 +726,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.methodProfiler.b(); this.methodProfiler.a("tracker"); @@ -342,41 +345,41 @@ index 998de35..0a15416 100644 this.methodProfiler.b(); this.methodProfiler.b(); // } // CraftBukkit -@@ -664,14 +684,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -717,14 +737,20 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } this.methodProfiler.c("connection"); + SpigotTimings.connectionTimer.startTiming(); // Spigot - this.ai().c(); + this.ao().c(); + SpigotTimings.connectionTimer.stopTiming(); // Spigot this.methodProfiler.c("players"); + SpigotTimings.playerListTimer.startTiming(); // Spigot - this.u.tick(); + this.v.tick(); + SpigotTimings.playerListTimer.stopTiming(); // Spigot this.methodProfiler.c("tickables"); + SpigotTimings.tickablesTimer.startTiming(); // Spigot - for (i = 0; i < this.n.size(); ++i) { - ((IUpdatePlayerListBox) this.n.get(i)).a(); + for (i = 0; i < this.o.size(); ++i) { + ((IUpdatePlayerListBox) this.o.get(i)).c(); } + 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 3a98439..69004ea 100644 +index 9b71ffc..2a0cea5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -941,6 +941,8 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -1031,6 +1031,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end private void handleCommand(String s) { + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot + - // CraftBukkit start - whole method + // CraftBukkit start - whole method this.c.info(this.player.getName() + " issued server command: " + s); -@@ -950,18 +952,22 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -1040,18 +1042,22 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -396,31 +399,31 @@ index 3a98439..69004ea 100644 return; } + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot - //this.minecraftServer.getCommandHandler().a(this.player, s); + // this.minecraftServer.getCommandHandler().a(this.player, s); // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index b2de58b..befe9a9 100644 +index ec76148..a93ad27 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -7,10 +7,12 @@ import java.util.concurrent.Callable; +@@ -6,10 +6,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 - public class TileEntity { + public abstract class TileEntity { + public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot private static final Logger a = LogManager.getLogger(); - private static Map i = new HashMap(); - private static Map j = new HashMap(); + private static Map f = Maps.newHashMap(); + private static Map g = Maps.newHashMap(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d12ef7a..a5843b0 100644 +index a16be9b..5fc707f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -16,6 +16,7 @@ import org.bukkit.Bukkit; +@@ -18,6 +18,7 @@ import org.bukkit.Bukkit; import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.craftbukkit.util.LongHashSet; @@ -428,8 +431,8 @@ index d12ef7a..a5843b0 100644 import org.bukkit.generator.ChunkGenerator; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; -@@ -132,6 +133,8 @@ public abstract class World implements IBlockAccess { - public ChunkGenerator generator; +@@ -112,6 +113,8 @@ public abstract class World implements IBlockAccess { + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + public final SpigotTimings.WorldTimingsHandler timings; // Spigot @@ -437,64 +440,72 @@ index d12ef7a..a5843b0 100644 public CraftWorld getWorld() { return this.world; } -@@ -183,6 +186,7 @@ public abstract class World implements IBlockAccess { +@@ -149,6 +152,7 @@ public abstract class World implements IBlockAccess { + this.M = worldprovider.getWorldBorder(); - this.worldProvider.a(this); - this.chunkProvider = this.j(); + this.getServer().addWorld(this.world); // CraftBukkit + timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings - if (!this.worldData.isInitialized()) { - try { - this.a(worldsettings); -@@ -1313,6 +1317,7 @@ public abstract class World implements IBlockAccess { - this.f.clear(); + } + + public World b() { +@@ -1239,6 +1243,7 @@ public abstract class World implements IBlockAccess { + this.g.clear(); this.methodProfiler.c("regular"); + timings.entityTick.startTiming(); // Spigot // CraftBukkit start - Use field for loop variable for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { entity = (Entity) this.entityList.get(this.tickPosition); -@@ -1328,7 +1333,9 @@ public abstract class World implements IBlockAccess { +@@ -1255,7 +1260,9 @@ public abstract class World implements IBlockAccess { this.methodProfiler.a("tick"); if (!entity.dead) { try { + SpigotTimings.tickEntityTimer.startTiming(); // Spigot - this.playerJoinedWorld(entity); + this.g(entity); + SpigotTimings.tickEntityTimer.stopTiming(); // Spigot } catch (Throwable throwable1) { crashreport = CrashReport.a(throwable1, "Ticking entity"); crashreportsystemdetails = crashreport.a("Entity being ticked"); -@@ -1353,7 +1360,9 @@ public abstract class World implements IBlockAccess { +@@ -1280,7 +1287,9 @@ public abstract class World implements IBlockAccess { this.methodProfiler.b(); } + timings.entityTick.stopTiming(); // Spigot this.methodProfiler.c("blockEntities"); + timings.tileEntityTick.startTiming(); // Spigot - this.M = true; + this.L = true; // CraftBukkit start - From below, clean up tile entities before ticking them if (!this.b.isEmpty()) { -@@ -1369,8 +1378,11 @@ public abstract class World implements IBlockAccess { +@@ -1300,6 +1309,7 @@ public abstract class World implements IBlockAccess { - if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { - try { -+ tileentity.tickTimer.startTiming(); // Spigot - tileentity.h(); -+ tileentity.tickTimer.stopTiming(); // Spigot - } catch (Throwable throwable2) { -+ tileentity.tickTimer.stopTiming(); // Spigot - crashreport = CrashReport.a(throwable2, "Ticking block entity"); - crashreportsystemdetails = crashreport.a("Block entity being ticked"); - tileentity.a(crashreportsystemdetails); -@@ -1390,6 +1402,8 @@ public abstract class World implements IBlockAccess { + if (this.isLoaded(blockposition) && this.M.a(blockposition)) { + try { ++ tileentity.tickTimer.startTiming(); // Spigot + ((IUpdatePlayerListBox) tileentity).c(); + } catch (Throwable throwable2) { + CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity"); +@@ -1308,6 +1318,11 @@ public abstract class World implements IBlockAccess { + tileentity.a(crashreportsystemdetails1); + throw new ReportedException(crashreport1); + } ++ // Spigot start ++ finally { ++ tileentity.tickTimer.stopTiming(); ++ } ++ // Spigot end + } + } + +@@ -1320,6 +1335,8 @@ public abstract class World implements IBlockAccess { } } + timings.tileEntityTick.stopTiming(); // Spigot + timings.tileEntityPending.startTiming(); // Spigot - this.M = false; + this.L = false; /* CraftBukkit start - Moved up if (!this.b.isEmpty()) { -@@ -1430,6 +1444,7 @@ public abstract class World implements IBlockAccess { +@@ -1352,6 +1369,7 @@ public abstract class World implements IBlockAccess { this.a.clear(); } @@ -502,32 +513,32 @@ index d12ef7a..a5843b0 100644 this.methodProfiler.b(); this.methodProfiler.b(); } -@@ -1454,6 +1469,7 @@ public abstract class World implements IBlockAccess { +@@ -1396,6 +1414,7 @@ public abstract class World implements IBlockAccess { // CraftBukkit start - Use neighbor cache instead of looking up Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); - if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.b(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { + if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { + entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.S = entity.locX; - entity.T = entity.locY; -@@ -1516,6 +1532,7 @@ public abstract class World implements IBlockAccess { - entity.passenger = null; + entity.P = entity.locX; + entity.Q = entity.locY; +@@ -1459,6 +1478,7 @@ public abstract class World implements IBlockAccess { } } + + entity.tickTimer.stopTiming(); // Spigot } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 8f25a15..d93eb8b 100644 +index f34b76e..9012c9e 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -185,10 +185,13 @@ public class WorldServer extends World { +@@ -212,10 +212,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { // 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)) { + if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) { + timings.mobSpawn.startTiming(); // Spigot - 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); + this.R.a(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L); + timings.mobSpawn.stopTiming(); // Spigot // CraftBukkit end } @@ -537,7 +548,7 @@ index 8f25a15..d93eb8b 100644 this.methodProfiler.c("chunkSource"); this.chunkProvider.unloadChunks(); int j = this.a(1.0F); -@@ -202,21 +205,36 @@ public class WorldServer extends World { +@@ -229,21 +232,34 @@ public class WorldServer extends World implements IAsyncTaskHandler { this.worldData.setDayTime(this.worldData.getDayTime() + 1L); } @@ -548,7 +559,7 @@ index 8f25a15..d93eb8b 100644 + timings.doTickPending.stopTiming(); // Spigot this.methodProfiler.c("tickBlocks"); + timings.doTickTiles.startTiming(); // Spigot - this.g(); + this.h(); + timings.doTickTiles.stopTiming(); // Spigot this.methodProfiler.c("chunkMap"); + timings.doChunkMap.startTiming(); // Spigot @@ -565,20 +576,18 @@ index 8f25a15..d93eb8b 100644 + timings.doPortalForcer.stopTiming(); // Spigot this.methodProfiler.b(); + timings.doSounds.startTiming(); // Spigot - this.Z(); -+ timings.doSounds.stopTiming(); // Spigot - -+ timings.doChunkGC.startTiming(); // Spigot + this.ak(); + this.getWorld().processChunkGC(); // CraftBukkit + timings.doChunkGC.stopTiming(); // Spigot } - public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) { + public BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9d45f34..01de2fd 100644 +index ff9efe9..0d23ec1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1778,6 +1778,11 @@ public final class CraftServer implements Server { +@@ -1630,6 +1630,11 @@ public final class CraftServer implements Server { private final Spigot spigot = new Spigot() { @@ -591,7 +600,7 @@ index 9d45f34..01de2fd 100644 public Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c76c3d3..28aa997 100644 +index b9032cd..84c52d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -252,9 +252,11 @@ public class CraftWorld implements World { @@ -783,7 +792,7 @@ index 0000000..558574f + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -index 9cf1b49..c249e77 100644 +index c2d4c2e..f0db29f 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -40,7 +40,9 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider Date: Fri, 21 Jun 2013 17:29:54 +1000 Subject: [PATCH] Fix Mob Spawning Relative to View Distance @@ -8,20 +8,20 @@ Changes the mob spawning algorithm to properly account for view distance and the Needs better documentation. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9acfe12..b6f3761 100644 +index 7519bfa..c3059b6 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -40,6 +40,7 @@ public class Chunk { - public int r; - public long s; - private int x; -+ protected net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap entityCount = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap(); // Spigot +@@ -42,6 +42,7 @@ public class Chunk { + private long u; + private int v; + private ConcurrentLinkedQueue w; ++ protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking private int neighbors = 0x1 << 12; -@@ -635,6 +636,22 @@ public class Chunk { - entity.ai = k; - entity.aj = this.locZ; +@@ -662,6 +663,22 @@ public class Chunk { + entity.af = k; + entity.ag = this.locZ; this.entitySlices[k].add(entity); + // Spigot start - increment creature type count + // Keep this synced up with World.a(Class) @@ -42,7 +42,7 @@ index 9acfe12..b6f3761 100644 } public void b(Entity entity) { -@@ -651,6 +668,22 @@ public class Chunk { +@@ -678,6 +695,22 @@ public class Chunk { } this.entitySlices[i].remove(entity); @@ -64,24 +64,26 @@ index 9acfe12..b6f3761 100644 + // Spigot end } - public boolean d(int i, int j, int k) { + public boolean d(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 1dfc346..75427b5 100644 +index 25988d4..43954b3 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 { - return new ChunkPosition(k, i1, l); - } +@@ -19,6 +19,25 @@ public final class SpawnerCreature { + + public SpawnerCreature() {} + // Spigot start - get entity count only from chunks being processed in b + private int getEntityCount(WorldServer server, Class oClass) + { + int i = 0; -+ for ( Long coord : this.a.keySet() ) ++ Iterator it = this.b.iterator(); ++ while ( it.hasNext() ) + { ++ Long coord = it.next(); + int x = LongHash.msw( coord ); + int z = LongHash.lsw( coord ); -+ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z ) ) ++ if ( !server.chunkProviderServer.unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) ) + { + i += server.getChunkAt( x, z ).entityCount.get( oClass ); + } @@ -90,53 +92,57 @@ index 1dfc346..75427b5 100644 + } + // Spigot end + - public int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) { + public int a(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) { if (!flag && !flag1) { return 0; -@@ -42,6 +59,11 @@ public final class SpawnerCreature { +@@ -38,6 +57,11 @@ public final class SpawnerCreature { - j = MathHelper.floor(entityhuman.locZ / 16.0D); - byte b0 = 8; -+ // Spigot Start -+ b0 = worldserver.spigotConfig.mobSpawnRange; -+ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0; -+ b0 = ( b0 > 8 ) ? 8 : b0; -+ // Spigot End + j = MathHelper.floor(entityhuman.locZ / 16.0D); + byte b0 = 8; ++ // Spigot Start ++ b0 = worldserver.spigotConfig.mobSpawnRange; ++ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0; ++ b0 = ( b0 > 8 ) ? 8 : b0; ++ // Spigot End - for (int l = -b0; l <= b0; ++l) { for (int i1 = -b0; i1 <= b0; ++i1) { -@@ -89,13 +111,15 @@ public final class SpawnerCreature { + for (k = -b0; k <= b0; ++k) { +@@ -88,17 +112,19 @@ public final class SpawnerCreature { if (limit == 0) { continue; } -+ int mobcnt = 0; ++ int mobcnt = 0; // Spigot // CraftBukkit end -- if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && worldserver.a(enumcreaturetype.a()) <= limit * this.a.size() / 256) { // CraftBukkit - use per-world limits -+ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && (mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * this.a.size() / 256) { // Spigot - use per-world limits and use all loaded chunks - Iterator iterator = this.a.keySet().iterator(); + if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2)) { + k = worldserver.a(enumcreaturetype.a()); + int l1 = limit * i / a; // CraftBukkit - use per-world limits -+ int moblimit = (limit * this.a.size() / 256) - mobcnt + 1; // Spigot - up to 1 more than limit - label110: -- while (iterator.hasNext()) { -+ while (iterator.hasNext() && (moblimit > 0)) { // Spigot - while more allowed - // CraftBukkit start = use LongHash and LongObjectHashMap - long key = ((Long) iterator.next()).longValue(); +- if (k <= l1) { ++ if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) { + Iterator iterator1 = this.b.iterator(); -@@ -160,6 +184,13 @@ public final class SpawnerCreature { - groupdataentity = entityinsentient.prepare(groupdataentity); - worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); - // CraftBukkit end -+ // Spigot start -+ if ( --moblimit <= 0 ) -+ { -+ // If we're past limit, stop spawn -+ continue label110; -+ } -+ // Spigot end - if (j2 >= entityinsentient.bB()) { - continue label110; - } ++ int moblimit = (limit * i / 256) - mobcnt + 1; // Spigot - up to 1 more than limit + label115: +- while (iterator1.hasNext()) { ++ while (iterator1.hasNext() && (moblimit > 0)) { // Spigot - while more allowed + // CraftBukkit start = use LongHash and LongObjectHashMap + long key = ((Long) iterator1.next()).longValue(); + BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key)); +@@ -156,6 +182,13 @@ public final class SpawnerCreature { + worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature + } + ++ // Spigot start ++ if ( --moblimit <= 0 ) ++ { ++ // If we're past limit, stop spawn ++ continue label115; ++ } ++ // Spigot end + if (l2 >= entityinsentient.bU()) { + continue label115; + } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 6cc3a91..46249d7 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -154,5 +160,5 @@ index 6cc3a91..46249d7 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0015-Handle-Null-Tile-Entities.patch b/CraftBukkit-Patches/0014-Handle-Null-Tile-Entities.patch similarity index 71% rename from CraftBukkit-Patches/0015-Handle-Null-Tile-Entities.patch rename to CraftBukkit-Patches/0014-Handle-Null-Tile-Entities.patch index 041ffdab4e..4c81dc6d71 100644 --- a/CraftBukkit-Patches/0015-Handle-Null-Tile-Entities.patch +++ b/CraftBukkit-Patches/0014-Handle-Null-Tile-Entities.patch @@ -1,14 +1,14 @@ -From 259d75f8ba67a5b5b6f8dbebf9e517c749c00d24 Mon Sep 17 00:00:00 2001 +From 81e9b691cfb2a3c0e0df11bf2e05f041e0d7438f 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 a5843b0..e03712a 100644 +index 3802264..a3fc086 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1375,6 +1375,13 @@ public abstract class World implements IBlockAccess { +@@ -1303,6 +1303,13 @@ public abstract class World implements IBlockAccess { while (iterator.hasNext()) { TileEntity tileentity = (TileEntity) iterator.next(); @@ -20,8 +20,8 @@ index a5843b0..e03712a 100644 + } + // Spigot end - if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) { - try { + if (!tileentity.x() && tileentity.t()) { + BlockPosition blockposition = tileentity.getPosition(); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0016-Entity-Activation-Range.patch b/CraftBukkit-Patches/0015-Entity-Activation-Range.patch similarity index 86% rename from CraftBukkit-Patches/0016-Entity-Activation-Range.patch rename to CraftBukkit-Patches/0015-Entity-Activation-Range.patch index 95ef2a801c..5fc0f1d99e 100644 --- a/CraftBukkit-Patches/0016-Entity-Activation-Range.patch +++ b/CraftBukkit-Patches/0015-Entity-Activation-Range.patch @@ -1,4 +1,4 @@ -From 696c8e0e4980786ee03c711cf5681cdf11f491af Mon Sep 17 00:00:00 2001 +From 160cff443e01980c29589470d51bc54fb447148e Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 3 Feb 2013 05:10:21 -0500 Subject: [PATCH] Entity Activation Range @@ -9,19 +9,19 @@ 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 a7d9c11..33798d8 100644 +index bb5e17d..ba1c2f2 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -90,7 +90,7 @@ public abstract class Entity { +@@ -89,7 +89,7 @@ public abstract class Entity implements ICommandListener { public int ticksLived; public int maxFireTicks; - public int fireTicks; // CraftBukkit - private -> public + public int fireTicks; - protected boolean inWater; + public boolean inWater; // Spigot - protected -> public public int noDamageTicks; - private boolean justCreated; + protected boolean justCreated; protected boolean fireProof; -@@ -114,7 +114,13 @@ public abstract class Entity { +@@ -113,7 +113,13 @@ public abstract class Entity implements ICommandListener { public boolean valid; // CraftBukkit public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only @@ -35,10 +35,10 @@ index a7d9c11..33798d8 100644 public int getId() { return this.id; -@@ -141,7 +147,12 @@ public abstract class Entity { +@@ -143,7 +149,12 @@ public abstract class Entity implements ICommandListener { this.setPosition(0.0D, 0.0D, 0.0D); if (world != null) { - this.dimension = world.worldProvider.dimension; + this.dimension = world.worldProvider.getDimension(); + // Spigot start + this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, world.spigotConfig); + } else { @@ -49,11 +49,11 @@ index a7d9c11..33798d8 100644 this.datawatcher = new DataWatcher(this); this.datawatcher.a(0, Byte.valueOf((byte) 0)); diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java -index 36ed831..7ddca48 100644 +index 3303d19..8ae38f7 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 { - private float bq; +@@ -9,6 +9,31 @@ public abstract class EntityAgeable extends EntityCreature { + private float bl; public boolean ageLocked = false; // CraftBukkit + // Spigot start @@ -85,7 +85,7 @@ index 36ed831..7ddca48 100644 super(world); } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 88b0751..ac5d5d2 100644 +index 3ba285a..ae00f60 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -15,7 +15,7 @@ public class EntityArrow extends Entity implements IProjectile { @@ -99,7 +99,7 @@ index 88b0751..ac5d5d2 100644 public Entity shooter; @@ -24,6 +24,18 @@ public class EntityArrow extends Entity implements IProjectile { private double damage = 2.0D; - public int knockbackStrength; // CraftBukkit - private -> public + public int knockbackStrength; + // Spigot Start + @Override @@ -107,7 +107,7 @@ index 88b0751..ac5d5d2 100644 + { + if ( this.inGround ) + { -+ this.at += 19; // Despawn counter. First int after shooter ++ this.ap += 19; // Despawn counter. First int after shooter + } + super.inactiveTick(); + } @@ -117,12 +117,12 @@ index 88b0751..ac5d5d2 100644 super(world); this.j = 10.0D; diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -index 759d46c..b977cf7 100644 +index 8357157..16400c3 100644 --- a/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java @@ -5,6 +5,15 @@ public class EntityFireworks extends Entity { private int ticksFlown; - public int expectedLifespan; // CraftBukkit - private -> public + public int expectedLifespan; + // Spigot Start + @Override @@ -137,10 +137,10 @@ index 759d46c..b977cf7 100644 super(world); this.a(0.25F, 0.25F); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 6a0bee6..92ad5c7 100644 +index 8da3ddd..c4e3e9d 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -84,6 +84,13 @@ public abstract class EntityLiving extends Entity { +@@ -83,6 +83,13 @@ public abstract class EntityLiving extends Entity { public int maxAirTicks = 300; ArrayList drops = null; // CraftBukkit end @@ -148,31 +148,31 @@ index 6a0bee6..92ad5c7 100644 + public void inactiveTick() + { + super.inactiveTick(); -+ ++this.aU; // Above all the floats ++ ++this.aT; // Above all the floats + } + // Spigot end - public EntityLiving(World world) { - super(world); + public void G() { + this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e03712a..e876b66 100644 +index a3fc086..c006526 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1317,6 +1317,7 @@ public abstract class World implements IBlockAccess { - this.f.clear(); +@@ -1243,6 +1243,7 @@ public abstract class World implements IBlockAccess { + this.g.clear(); this.methodProfiler.c("regular"); + org.spigotmc.ActivationRange.activateEntities(this); // Spigot timings.entityTick.startTiming(); // Spigot // CraftBukkit start - Use field for loop variable for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { -@@ -1473,9 +1474,11 @@ public abstract class World implements IBlockAccess { +@@ -1418,9 +1419,11 @@ public abstract class World implements IBlockAccess { int j = MathHelper.floor(entity.locZ); byte b0 = 32; - // CraftBukkit start - Use neighbor cache instead of looking up - Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); -- if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.b(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { +- if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { + // Spigot start + if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { + entity.ticksLived++; @@ -180,7 +180,7 @@ index e03712a..e876b66 100644 + } else { entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.S = entity.locX; + entity.P = entity.locX; diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java index 558574f..41d2d87 100644 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java @@ -197,14 +197,15 @@ index 558574f..41d2d87 100644 public static final HashMap pluginTaskTimingMap = new HashMap(); diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java new file mode 100644 -index 0000000..903172a +index 0000000..8ca6e20 --- /dev/null +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +1,296 @@ +@@ -0,0 +1,278 @@ +package org.spigotmc; + +import java.util.ArrayList; +import java.util.List; ++import java.util.Set; +import net.minecraft.server.AxisAlignedBB; +import net.minecraft.server.Chunk; +import net.minecraft.server.Entity; @@ -222,6 +223,7 @@ index 0000000..903172a +import net.minecraft.server.EntityMonster; +import net.minecraft.server.EntityProjectile; +import net.minecraft.server.EntitySheep; ++import net.minecraft.server.EntitySlice; +import net.minecraft.server.EntitySlime; +import net.minecraft.server.EntityTNTPrimed; +import net.minecraft.server.EntityVillager; @@ -291,26 +293,6 @@ index 0000000..903172a + } + + /** -+ * Utility method to grow an AABB without creating a new AABB or touching -+ * the pool, so we can re-use ones we have. -+ * -+ * @param target -+ * @param source -+ * @param x -+ * @param y -+ * @param z -+ */ -+ public static void growBB(AxisAlignedBB target, AxisAlignedBB source, int x, int y, int z) -+ { -+ target.a = source.a - x; -+ target.b = source.b - y; -+ target.c = source.c - z; -+ target.d = source.d + x; -+ target.e = source.e + y; -+ target.f = source.f + z; -+ } -+ -+ /** + * Find what entities are in range of the players in the world and set + * active if in range. + * @@ -331,10 +313,10 @@ index 0000000..903172a + { + + player.activatedTick = MinecraftServer.currentTick; -+ growBB( maxBB, player.boundingBox, maxRange, 256, maxRange ); -+ growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange ); -+ growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange ); -+ growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange ); ++ maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange ); ++ miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange ); ++ animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange ); ++ monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange ); + + int i = MathHelper.floor( maxBB.a / 16.0D ); + int j = MathHelper.floor( maxBB.d / 16.0D ); @@ -362,9 +344,9 @@ index 0000000..903172a + */ + private static void activateChunkEntities(Chunk chunk) + { -+ for ( List slice : chunk.entitySlices ) ++ for ( EntitySlice slice : chunk.entitySlices ) + { -+ for ( Entity entity : slice ) ++ for ( Entity entity : (Set) slice ) + { + if ( MinecraftServer.currentTick > entity.activatedTick ) + { @@ -376,20 +358,20 @@ index 0000000..903172a + switch ( entity.activationType ) + { + case 1: -+ if ( monsterBB.b( entity.boundingBox ) ) ++ if ( monsterBB.b( entity.getBoundingBox() ) ) + { + entity.activatedTick = MinecraftServer.currentTick; + } + break; + case 2: -+ if ( animalBB.b( entity.boundingBox ) ) ++ if ( animalBB.b( entity.getBoundingBox() ) ) + { + entity.activatedTick = MinecraftServer.currentTick; + } + break; + case 3: + default: -+ if ( miscBB.b( entity.boundingBox ) ) ++ if ( miscBB.b( entity.getBoundingBox() ) ) + { + entity.activatedTick = MinecraftServer.currentTick; + } @@ -428,15 +410,15 @@ index 0000000..903172a + if ( entity instanceof EntityLiving ) + { + EntityLiving living = (EntityLiving) entity; -+ if ( living.attackTicks > 0 || living.hurtTicks > 0 || living.effects.size() > 0 ) ++ if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTicks > 0 || living.effects.size() > 0 ) + { + return true; + } -+ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).target != null ) ++ if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null ) + { + return true; + } -+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).bY() /* Getter for first boolean */ ) ++ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ ) + { + return true; + } @@ -518,5 +500,5 @@ index 46249d7..ed2836a 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0017-Metrics.patch b/CraftBukkit-Patches/0016-Metrics.patch similarity index 99% rename from CraftBukkit-Patches/0017-Metrics.patch rename to CraftBukkit-Patches/0016-Metrics.patch index 7281be1344..85b0e27d78 100644 --- a/CraftBukkit-Patches/0017-Metrics.patch +++ b/CraftBukkit-Patches/0016-Metrics.patch @@ -1,4 +1,4 @@ -From 726c32d9a80f49276d9596dc785664653cece467 Mon Sep 17 00:00:00 2001 +From 73ed5ee29cb1766c1646967dffab9f104a63d1cb 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..d9c3b63 +} \ 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 a4de4e9..dc4d4b3 100644 +index 6837305..fdd4fe1 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 a4de4e9..dc4d4b3 100644 static void readConfig(Class clazz, Object instance) -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0018-PlayerItemDamageEvent.patch b/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch similarity index 76% rename from CraftBukkit-Patches/0018-PlayerItemDamageEvent.patch rename to CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch index 22a5dc196c..11f51e5531 100644 --- a/CraftBukkit-Patches/0018-PlayerItemDamageEvent.patch +++ b/CraftBukkit-Patches/0017-PlayerItemDamageEvent.patch @@ -1,28 +1,26 @@ -From e966fa6d6dc7ef524fb7285960bdcd8744e9d232 Mon Sep 17 00:00:00 2001 +From cc4f72301e86bf997da5da7adf86ed658aed26c6 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 c9d74d3..a2ab06a 100644 +index 0502bcb..204ae01 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -279,7 +279,13 @@ public final class ItemStack { - return this.item.getMaxDurability(); +@@ -305,6 +305,11 @@ public final class ItemStack { } -+ // Spigot start public boolean isDamaged(int i, Random random) { + return isDamaged(i, random, null); + } + + public boolean isDamaged(int i, Random random, EntityLiving entityliving) { + // Spigot end - if (!this.g()) { + if (!this.e()) { return false; } else { -@@ -294,7 +300,16 @@ public final class ItemStack { +@@ -319,7 +324,16 @@ public final class ItemStack { } i -= k; @@ -40,15 +38,15 @@ index c9d74d3..a2ab06a 100644 return false; } } -@@ -307,7 +322,7 @@ public final class ItemStack { +@@ -332,7 +346,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.aI())) { -+ if (this.isDamaged(i, entityliving.aI(), entityliving)) { // Spigot - entityliving.a(this); + if (this.e()) { +- if (this.isDamaged(i, entityliving.bb())) { ++ if (this.isDamaged(i, entityliving.bb(), entityliving)) { // Spigot + entityliving.b(this); --this.count; if (entityliving instanceof EntityHuman) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0020-Prevent-NPE-in-CraftSign.patch b/CraftBukkit-Patches/0018-Prevent-NPE-in-CraftSign.patch similarity index 61% rename from CraftBukkit-Patches/0020-Prevent-NPE-in-CraftSign.patch rename to CraftBukkit-Patches/0018-Prevent-NPE-in-CraftSign.patch index 053834b820..2194a9b452 100644 --- a/CraftBukkit-Patches/0020-Prevent-NPE-in-CraftSign.patch +++ b/CraftBukkit-Patches/0018-Prevent-NPE-in-CraftSign.patch @@ -1,4 +1,4 @@ -From 31decbb03eaed1acb57f79fc9a128dd806029373 Mon Sep 17 00:00:00 2001 +From fab5ba1054b3144296518fdd3852e561218de1ad 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 @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent NPE in CraftSign This commit prevents the constructor of CraftSign throwing an NPE when it cannot get the sign tile entity. Instead it will fallback to a 4 empty lined sign, and not try to do anything to those lines on .update(). diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index 77717d5..1533dd4 100644 +index 724dbd1..1b603b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -@@ -14,6 +14,12 @@ public class CraftSign extends CraftBlockState implements Sign { +@@ -17,6 +17,12 @@ public class CraftSign extends CraftBlockState implements Sign { CraftWorld world = (CraftWorld) block.getWorld(); sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ()); @@ -20,17 +20,8 @@ index 77717d5..1533dd4 100644 + } + // Spigot end lines = new String[sign.lines.length]; - System.arraycopy(sign.lines, 0, lines, 0, lines.length); + System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length); } -@@ -34,7 +40,7 @@ public class CraftSign extends CraftBlockState implements Sign { - public boolean update(boolean force, boolean applyPhysics) { - boolean result = super.update(force, applyPhysics); - -- if (result) { -+ if (result && sign != null) { // Spigot, add null check - sign.lines = sanitizeLines(lines); - sign.update(); - } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0021-Entity-Tracking-Ranges.patch b/CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch similarity index 97% rename from CraftBukkit-Patches/0021-Entity-Tracking-Ranges.patch rename to CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch index 8766fc2f6c..a8cba77a58 100644 --- a/CraftBukkit-Patches/0021-Entity-Tracking-Ranges.patch +++ b/CraftBukkit-Patches/0019-Entity-Tracking-Ranges.patch @@ -1,4 +1,4 @@ -From 2c59fc73e053f597d163844ba2b38e54168566bc Mon Sep 17 00:00:00 2001 +From e24ea35293d323a1666931db31c059e2f8775fff Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 20 Feb 2013 11:58:47 -0500 Subject: [PATCH] Entity Tracking Ranges @@ -12,10 +12,10 @@ 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 70b0181..c0766d6 100644 +index 350f2f7..e3b2864 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java -@@ -92,6 +92,7 @@ public class EntityTracker { +@@ -95,6 +95,7 @@ public class EntityTracker { public void addEntity(Entity entity, int i, int j, boolean flag) { org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot @@ -105,5 +105,5 @@ index 0000000..4bf4d2a + } +} -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0019-Faster-UUID-for-entities.patch b/CraftBukkit-Patches/0019-Faster-UUID-for-entities.patch deleted file mode 100644 index 7baf45125a..0000000000 --- a/CraftBukkit-Patches/0019-Faster-UUID-for-entities.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 4075f4f1be59696cbddd8df88b0f10f8fc5f41cc 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 - -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 33798d8..18e4d8d 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -141,7 +141,7 @@ public abstract class Entity { - this.random = new Random(); - this.maxFireTicks = 1; - this.justCreated = true; -- this.uniqueID = UUID.randomUUID(); -+ this.uniqueID = new UUID(random.nextLong(), random.nextLong()); // Spigot - this.as = EnumEntitySize.SIZE_2; - this.world = world; - this.setPosition(0.0D, 0.0D, 0.0D); --- -1.9.1 - diff --git a/CraftBukkit-Patches/0023-Thread-Naming-and-Tweaks.patch b/CraftBukkit-Patches/0020-Thread-Naming-and-Tweaks.patch similarity index 94% rename from CraftBukkit-Patches/0023-Thread-Naming-and-Tweaks.patch rename to CraftBukkit-Patches/0020-Thread-Naming-and-Tweaks.patch index 9fbb27a6bf..21521f5986 100644 --- a/CraftBukkit-Patches/0023-Thread-Naming-and-Tweaks.patch +++ b/CraftBukkit-Patches/0020-Thread-Naming-and-Tweaks.patch @@ -1,4 +1,4 @@ -From 94171e10243a8feca65e35c70a9a4774e43c178a Mon Sep 17 00:00:00 2001 +From 9c06e031213caf1c0463c736134f5bee4f91b1a9 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 @@ -19,5 +19,5 @@ index 8442ecb..93d8d42 100644 private CraftAsyncDebugger debugTail = debugHead; private static final int RECENT_TICKS; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0024-Close-Unloaded-Save-Files.patch b/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch similarity index 68% rename from CraftBukkit-Patches/0024-Close-Unloaded-Save-Files.patch rename to CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch index 656ace519a..f5196d68e0 100644 --- a/CraftBukkit-Patches/0024-Close-Unloaded-Save-Files.patch +++ b/CraftBukkit-Patches/0021-Close-Unloaded-Save-Files.patch @@ -1,39 +1,31 @@ -From 321030ab9c4665edec42a775e7366ae71c7cc535 Mon Sep 17 00:00:00 2001 +From 6c17a534faf1cbea851c45f3b3ba2963c9554ba3 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 diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 900ed68..829f4a3 100644 +index f4f72ef..1b03878 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -10,7 +10,7 @@ import java.util.Map; public class RegionFileCache { -- private static final Map a = new HashMap(); -+ public static final Map a = new HashMap(); // CraftBukkit - private -> public +- private static final Map a = Maps.newHashMap(); ++ public static final Map a = Maps.newHashMap(); // Spigot - private -> public - public static synchronized RegionFile a(File file1, int i, int j) { - File file2 = new File(file1, "region"); + public static synchronized RegionFile a(File file, int i, int j) { + File file1 = new File(file, "region"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d997b48..6dc4157 100644 +index 0d23ec1..2da23eb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -85,6 +85,8 @@ import net.minecraft.server.MinecraftServer; - import net.minecraft.server.MobEffectList; - import net.minecraft.server.PropertyManager; - import net.minecraft.server.ServerCommand; -+import net.minecraft.server.RegionFile; -+import net.minecraft.server.RegionFileCache; - import net.minecraft.server.ServerNBTManager; - import net.minecraft.server.WorldLoaderServer; - import net.minecraft.server.WorldManager; -@@ -1062,6 +1064,30 @@ public final class CraftServer implements Server { +@@ -945,6 +945,31 @@ public final class CraftServer implements Server { + worlds.remove(world.getName().toLowerCase()); console.worlds.remove(console.worlds.indexOf(handle)); - ++ + File parentFolder = world.getWorldFolder().getAbsoluteFile(); + + // Synchronized because access to RegionFileCache.a is guarded by this lock. @@ -62,5 +54,5 @@ index d997b48..6dc4157 100644 } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0022-Limit-Custom-Map-Rendering.patch b/CraftBukkit-Patches/0022-Limit-Custom-Map-Rendering.patch deleted file mode 100644 index 601d81ab0b..0000000000 --- a/CraftBukkit-Patches/0022-Limit-Custom-Map-Rendering.patch +++ /dev/null @@ -1,74 +0,0 @@ -From db9b904657edc497a64cf54815bc9e0a45c6e59e 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 - -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 ec708d1..d22b6c9 100644 ---- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java -+++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java -@@ -37,23 +37,29 @@ public class WorldMapHumanTracker { - int i; - int j; - -- org.bukkit.craftbukkit.map.RenderData render = this.worldMap.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) trackee.getBukkitEntity()); // CraftBukkit -+ // Spigot start -+ boolean custom = this.worldMap.mapView.renderers.size() > 1 || !(this.worldMap.mapView.renderers.get(0) instanceof org.bukkit.craftbukkit.map.CraftMapRenderer); -+ org.bukkit.craftbukkit.map.RenderData render = (custom) ? this.worldMap.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) trackee.getBukkitEntity()) : null; // CraftBukkit - - if (--this.g < 0) { - this.g = 4; -- abyte = new byte[render.cursors.size() * 3 + 1]; // CraftBukkit -+ abyte = new byte[((custom) ? render.cursors.size() : this.worldMap.decorations.size()) * 3 + 1]; // CraftBukkit - abyte[0] = 1; - i = 0; - - // CraftBukkit start -- for (i = 0; i < render.cursors.size(); ++i) { -- org.bukkit.map.MapCursor cursor = render.cursors.get(i); -- if (!cursor.isVisible()) continue; - -- abyte[i * 3 + 1] = (byte) (cursor.getRawType() << 4 | cursor.getDirection() & 15); -- abyte[i * 3 + 2] = (byte) cursor.getX(); -- abyte[i * 3 + 3] = (byte) cursor.getY(); -+ // Spigot start -+ for (Iterator iterator = ((custom) ? render.cursors.iterator() : this.worldMap.decorations.values().iterator()); iterator.hasNext(); ++i) { -+ org.bukkit.map.MapCursor cursor = (custom) ? (org.bukkit.map.MapCursor) iterator.next() : null; -+ if (cursor != null && !cursor.isVisible()) continue; -+ WorldMapDecoration deco = (custom) ? null : (WorldMapDecoration) iterator.next(); -+ -+ abyte[i * 3 + 1] = (byte) (((custom) ? cursor.getRawType() : deco.type) << 4 | ((custom) ? cursor.getDirection() : deco.rotation) & 15); -+ abyte[i * 3 + 2] = (byte) ((custom) ? cursor.getX() : deco.locX); -+ abyte[i * 3 + 3] = (byte) ((custom) ? cursor.getY() : deco.locY); - } -+ // Spigot end - // CraftBukkit end - - boolean flag = !itemstack.A(); -@@ -88,7 +94,7 @@ public class WorldMapHumanTracker { - abyte1[2] = (byte) j; - - for (int i1 = 0; i1 < abyte1.length - 3; ++i1) { -- abyte1[i1 + 3] = render.buffer[(i1 + j) * 128 + i]; // CraftBukkit -+ abyte1[i1 + 3] = ((custom) ? render.buffer : this.worldMap.colors)[(i1 + j) * 128 + i]; - } - - this.c[i] = -1; -diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java -index 1a150d9..c9f0027 100644 ---- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java -+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java -@@ -18,7 +18,7 @@ import org.bukkit.map.MapView; - public final class CraftMapView implements MapView { - - private final Map renderCache = new HashMap(); -- private final List renderers = new ArrayList(); -+ public final List renderers = new ArrayList(); // Spigot - private final Map> canvases = new HashMap>(); - protected final WorldMap worldMap; - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0025-Remove-o-Option.patch b/CraftBukkit-Patches/0022-Remove-o-Option.patch similarity index 82% rename from CraftBukkit-Patches/0025-Remove-o-Option.patch rename to CraftBukkit-Patches/0022-Remove-o-Option.patch index 39e475126c..c0df484726 100644 --- a/CraftBukkit-Patches/0025-Remove-o-Option.patch +++ b/CraftBukkit-Patches/0022-Remove-o-Option.patch @@ -1,4 +1,4 @@ -From 6a1f16ee41738ccbf252c9ccefbf677780592a29 Mon Sep 17 00:00:00 2001 +From 74aa07fb1297175eaebfd4192c8b8e2668518e2e 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 c6cd6fb..fefa221 100644 +index 00b35a1..622d6e0 100644 --- a/src/main/java/net/minecraft/server/PropertyManager.java +++ b/src/main/java/net/minecraft/server/PropertyManager.java -@@ -52,7 +52,7 @@ public class PropertyManager { +@@ -53,7 +53,7 @@ public class PropertyManager { } private T getOverride(String name, T value) { @@ -19,5 +19,5 @@ index c6cd6fb..fefa221 100644 } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0026-Recipe-Deconstruction.patch b/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch similarity index 74% rename from CraftBukkit-Patches/0026-Recipe-Deconstruction.patch rename to CraftBukkit-Patches/0023-Recipe-Deconstruction.patch index ea9be58150..9499355667 100644 --- a/CraftBukkit-Patches/0026-Recipe-Deconstruction.patch +++ b/CraftBukkit-Patches/0023-Recipe-Deconstruction.patch @@ -1,4 +1,4 @@ -From 4dd7d2d2d253da40bdf2d9fd35d5171d9d0fea92 Mon Sep 17 00:00:00 2001 +From d7c816bdcb7621b4a0d16b696c01c3b248f25f8c Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 1 Jun 2013 16:34:38 +1000 Subject: [PATCH] Recipe Deconstruction @@ -6,30 +6,30 @@ Subject: [PATCH] Recipe Deconstruction Some non API methods contributed by Asphodan to allow recipe deconstruction. diff --git a/src/main/java/net/minecraft/server/IRecipe.java b/src/main/java/net/minecraft/server/IRecipe.java -index bb28c12..c0836e4 100644 +index d2655a0..e5b116f 100644 --- a/src/main/java/net/minecraft/server/IRecipe.java +++ b/src/main/java/net/minecraft/server/IRecipe.java -@@ -11,4 +11,6 @@ public interface IRecipe { - ItemStack b(); - +@@ -13,4 +13,6 @@ public interface IRecipe { + ItemStack[] b(InventoryCrafting inventorycrafting); + org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit + + 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 cc444db..867dd07 100644 +index 407cbfb..6c3de90 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 { - private int width; - private int height; - private ItemStack[] items; -- private ItemStack result; +@@ -11,7 +11,7 @@ public class ShapedRecipes implements IRecipe { + private final int width; + private final int height; + private final ItemStack[] items; +- private final ItemStack result; + public ItemStack result; // Spigot private boolean e; public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) { -@@ -156,4 +156,11 @@ public class ShapedRecipes implements IRecipe { +@@ -171,4 +171,11 @@ public class ShapedRecipes implements IRecipe { this.e = true; return this; } @@ -42,10 +42,10 @@ index cc444db..867dd07 100644 + // Spigot end } diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java -index 0fab83c..21181fb 100644 +index 2d243d1..b6106db 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; +@@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; public class ShapelessRecipes implements IRecipe { @@ -54,7 +54,7 @@ index 0fab83c..21181fb 100644 private final List ingredients; public ShapelessRecipes(ItemStack itemstack, List list) { -@@ -75,4 +75,11 @@ public class ShapelessRecipes implements IRecipe { +@@ -90,4 +90,11 @@ public class ShapelessRecipes implements IRecipe { public int a() { return this.ingredients.size(); } @@ -67,5 +67,5 @@ index 0fab83c..21181fb 100644 + // Spigot end } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0027-Implement-Arrow-API.patch b/CraftBukkit-Patches/0024-Implement-Arrow-API.patch similarity index 85% rename from CraftBukkit-Patches/0027-Implement-Arrow-API.patch rename to CraftBukkit-Patches/0024-Implement-Arrow-API.patch index 12ab933a53..5d32d293c3 100644 --- a/CraftBukkit-Patches/0027-Implement-Arrow-API.patch +++ b/CraftBukkit-Patches/0024-Implement-Arrow-API.patch @@ -1,11 +1,11 @@ -From 9589617ddac0217b8c431e7a87697d549876eb8f Mon Sep 17 00:00:00 2001 +From fee2702652112ad10f09a9a7234fdd897ed1cc6a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Jun 2013 15:16:05 +1000 Subject: [PATCH] Implement Arrow API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -index 09e7223..8c8a173 100644 +index bf48e6e..ad489cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -75,6 +75,17 @@ public class CraftArrow extends AbstractProjectile implements Arrow { @@ -15,7 +15,7 @@ index 09e7223..8c8a173 100644 + @Override + public double getDamage() + { -+ return getHandle().e(); ++ return getHandle().j(); + } + + @Override @@ -27,5 +27,5 @@ index 09e7223..8c8a173 100644 public Arrow.Spigot spigot() -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0028-Hopper-Customisations.patch b/CraftBukkit-Patches/0025-Hopper-Customisations.patch similarity index 67% rename from CraftBukkit-Patches/0028-Hopper-Customisations.patch rename to CraftBukkit-Patches/0025-Hopper-Customisations.patch index b76285baf2..aabcfb4392 100644 --- a/CraftBukkit-Patches/0028-Hopper-Customisations.patch +++ b/CraftBukkit-Patches/0025-Hopper-Customisations.patch @@ -1,4 +1,4 @@ -From 7d24f487bbcc6261883e52a027a1223ab999e5b9 Mon Sep 17 00:00:00 2001 +From 01eedb54f5e95a52f76687ef625bddea00f9f368 Mon Sep 17 00:00:00 2001 From: erocs Date: Sun, 8 Sep 2013 12:06:15 -0700 Subject: [PATCH] Hopper Customisations @@ -6,76 +6,74 @@ Subject: [PATCH] Hopper Customisations Allows editing hopper cooldowns and amount transferred per tick. diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index ebdf08e..d77708b 100644 +index 7fe1f46..f4dc9c7 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -189,12 +189,18 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -193,12 +193,18 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } if (flag) { -- this.c(8); -+ this.c(world.spigotConfig.hopperTransfer); // Spigot +- this.d(8); ++ this.d(world.spigotConfig.hopperTransfer); // Spigot this.update(); return true; } } + // Spigot start -+ if ( !this.j() ) ++ if ( !this.n() ) + { -+ this.c( world.spigotConfig.hopperCheck ); ++ this.d( world.spigotConfig.hopperCheck ); + } + // Spigot end return false; } else { return false; -@@ -246,7 +252,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { - if (this.getItem(j) != null) { - ItemStack itemstack = this.getItem(j).cloneItemStack(); +@@ -252,7 +258,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + // ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection); + // CraftBukkit start - Call event when pushing items into other inventories -- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(j, 1)); -+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(j, world.spigotConfig.hopperAmount)); // Spigot +- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1)); ++ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, world.spigotConfig.hopperAmount)); // Spigot Inventory destinationInventory; // Have to special case large chests as they work oddly -@@ -260,11 +266,11 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -266,9 +272,10 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU this.getWorld().getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { - this.setItem(j, itemstack); -- this.c(8); // Delay hopper checks -+ this.c(world.spigotConfig.hopperTransfer); // Spigot + this.setItem(i, itemstack); +- this.d(8); // Delay hopper checks ++ this.d(world.spigotConfig.hopperTransfer); // Spigot return false; } + int origCount = event.getItem().getAmount(); // Spigot - ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), i); -- + ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection); + if (itemstack1 == null || itemstack1.count == 0) { - if (event.getItem().equals(oitemstack)) { - iinventory.update(); -@@ -274,7 +280,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -280,7 +287,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU // CraftBukkit end return true; } - + itemstack.count -= origCount - itemstack1.count; // Spigot - this.setItem(j, itemstack); + this.setItem(i, itemstack); } } -@@ -379,7 +385,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { - if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) { +@@ -386,7 +393,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU ItemStack itemstack1 = itemstack.cloneItemStack(); + // ItemStack itemstack2 = addItem(ihopper, iinventory.splitStack(i, 1), (EnumDirection) null); // CraftBukkit start - Call event on collection of items from inventories into the hopper - CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1)); + CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, ihopper.getWorld().spigotConfig.hopperAmount)); // Spigot Inventory sourceInventory; // Have to special case large chests as they work oddly -@@ -396,13 +402,14 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -403,13 +410,14 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU iinventory.setItem(i, itemstack1); if (ihopper instanceof TileEntityHopper) { -- ((TileEntityHopper) ihopper).c(8); // Delay hopper checks -+ ((TileEntityHopper) ihopper).c(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot +- ((TileEntityHopper) ihopper).d(8); // Delay hopper checks ++ ((TileEntityHopper) ihopper).d(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot } else if (ihopper instanceof EntityMinecartHopper) { - ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks + ((EntityMinecartHopper) ihopper).l(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot @@ -84,26 +82,26 @@ index ebdf08e..d77708b 100644 return false; } + int origCount = event.getItem().getAmount(); // Spigot - ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), -1); + ItemStack itemstack2 = addItem(ihopper, CraftItemStack.asNMSCopy(event.getItem()), null); if (itemstack2 == null || itemstack2.count == 0) { -@@ -415,6 +422,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { - +@@ -421,6 +429,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + // CraftBukkit end return true; } + itemstack1.count -= origCount - itemstack2.count; // Spigot iinventory.setItem(i, itemstack1); } -@@ -502,7 +510,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -511,7 +520,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + TileEntityHopper tileentityhopper = (TileEntityHopper) iinventory; + + if (tileentityhopper.o()) { +- tileentityhopper.d(8); ++ tileentityhopper.d(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot + } - if (flag) { - if (iinventory instanceof TileEntityHopper) { -- ((TileEntityHopper) iinventory).c(8); -+ ((TileEntityHopper) iinventory).c(((TileEntityHopper) iinventory).world.spigotConfig.hopperTransfer); // Spigot iinventory.update(); - } - diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 6421bf2..956c628 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -129,5 +127,5 @@ index 6421bf2..956c628 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0030-Implement-SpawnerSpawnEvent.patch b/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch similarity index 75% rename from CraftBukkit-Patches/0030-Implement-SpawnerSpawnEvent.patch rename to CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch index 53c0777b3d..eccb1f725c 100644 --- a/CraftBukkit-Patches/0030-Implement-SpawnerSpawnEvent.patch +++ b/CraftBukkit-Patches/0026-Implement-SpawnerSpawnEvent.patch @@ -1,4 +1,4 @@ -From ae39328c915d12f99f3dfa349331d8c17a4653e6 Mon Sep 17 00:00:00 2001 +From 83d0c4260671e7729eb482d7ce8fbe7d3b9b53e0 Mon Sep 17 00:00:00 2001 From: Andy Shulman Date: Mon, 15 Apr 2013 20:06:37 -0500 Subject: [PATCH] Implement SpawnerSpawnEvent. @@ -6,10 +6,10 @@ 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 93bb1ad..e39d533 100644 +index 0b177f0..13c7d58 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; +@@ -4,7 +4,11 @@ import com.google.common.collect.Lists; import java.util.Iterator; import java.util.List; @@ -22,13 +22,13 @@ index 93bb1ad..e39d533 100644 public abstract class MobSpawnerAbstract { -@@ -128,7 +132,12 @@ public abstract class MobSpawnerAbstract { +@@ -131,7 +135,12 @@ public abstract class MobSpawnerAbstract { entity.f(nbttagcompound); - if (entity.world != null) { + if (entity.world != null && flag) { - entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); ++ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); + if (!event.isCancelled()) { + entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + } @@ -36,37 +36,37 @@ index 93bb1ad..e39d533 100644 } NBTTagCompound nbttagcompound1; -@@ -152,6 +161,11 @@ public abstract class MobSpawnerAbstract { +@@ -155,6 +164,11 @@ public abstract class MobSpawnerAbstract { entity2.f(nbttagcompound2); entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch); + // CraftBukkit start - call SpawnerSpawnEvent, skip if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b(), this.c(), this.d()); ++ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b().getX(), this.b().getY(), this.b().getZ()); + if (event.isCancelled()) { + continue; + } - if (entity.world != null) { + if (entity.world != null && flag) { entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit } -@@ -163,7 +177,12 @@ public abstract class MobSpawnerAbstract { +@@ -166,7 +180,12 @@ public abstract class MobSpawnerAbstract { } - } else if (entity instanceof EntityLiving && entity.world != null) { - ((EntityInsentient) entity).prepare((GroupDataEntity) null); -- this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + } else if (entity instanceof EntityLiving && entity.world != null && flag) { + ((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null); +- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // Spigot start - call SpawnerSpawnEvent, abort if cancelled -+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); ++ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); + if (!event.isCancelled()) { -+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit ++ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + } + // Spigot end } 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 2c0065d..0db8897 100644 +index cc1d371..982e45c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -41,6 +41,7 @@ import org.bukkit.Statistic.Type; +@@ -18,6 +18,7 @@ import org.bukkit.Statistic.Type; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; @@ -74,7 +74,7 @@ index 2c0065d..0db8897 100644 import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftStatistic; import org.bukkit.craftbukkit.CraftWorld; -@@ -150,6 +151,22 @@ public class CraftEventFactory { +@@ -127,6 +128,22 @@ public class CraftEventFactory { } /** @@ -96,7 +96,7 @@ index 2c0065d..0db8897 100644 + /** * Bucket methods */ - public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, int clickedFace, ItemStack itemInHand) { + public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(EntityHuman who, int clickedX, int clickedY, int clickedZ, EnumDirection clickedFace, ItemStack itemInHand) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0031-Firework-Meta-Crash-Fix.patch b/CraftBukkit-Patches/0027-Firework-Meta-Crash-Fix.patch similarity index 93% rename from CraftBukkit-Patches/0031-Firework-Meta-Crash-Fix.patch rename to CraftBukkit-Patches/0027-Firework-Meta-Crash-Fix.patch index aacb1a613c..1cf142c637 100644 --- a/CraftBukkit-Patches/0031-Firework-Meta-Crash-Fix.patch +++ b/CraftBukkit-Patches/0027-Firework-Meta-Crash-Fix.patch @@ -1,4 +1,4 @@ -From 28e812c423844da20c528ce9b11b5ebd8a918754 Mon Sep 17 00:00:00 2001 +From 0680e62f3ebfa2e03d9eeef5188b4b2707304028 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 @@ -27,5 +27,5 @@ index 0f7da6b..5a409ae 100644 } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0032-Allow-Disabling-of-Command-Logging.patch b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch similarity index 70% rename from CraftBukkit-Patches/0032-Allow-Disabling-of-Command-Logging.patch rename to CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch index a66894ef96..a2844b3c89 100644 --- a/CraftBukkit-Patches/0032-Allow-Disabling-of-Command-Logging.patch +++ b/CraftBukkit-Patches/0028-Allow-Disabling-of-Command-Logging.patch @@ -1,24 +1,23 @@ -From abe67ad73f7f5c0d156def0bec08583d78a823d3 Mon Sep 17 00:00:00 2001 +From b3bcb677bd5bc7c5f845659b9239db32b9e293a6 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 9596da2..3a24fcd 100644 +index 0e4f35d..19aaf8f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -944,7 +944,7 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -1034,6 +1034,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot - // CraftBukkit start - whole method -- this.c.info(this.player.getName() + " issued server command: " + s); -+ if ( org.spigotmc.SpigotConfig.logCommands ) this.c.info(this.player.getName() + " issued server command: " + s); + // CraftBukkit start - whole method ++ if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot + this.c.info(this.player.getName() + " issued server command: " + s); CraftPlayer player = this.getPlayer(); - diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 6dfa8b0..c9e6dc5 100644 +index fdd4fe1..4e7d731 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -148,4 +148,10 @@ public class SpigotConfig @@ -33,5 +32,5 @@ index 6dfa8b0..c9e6dc5 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0033-Allow-Disabling-of-Command-TabComplete.patch b/CraftBukkit-Patches/0029-Allow-Disabling-of-Command-TabComplete.patch similarity index 89% rename from CraftBukkit-Patches/0033-Allow-Disabling-of-Command-TabComplete.patch rename to CraftBukkit-Patches/0029-Allow-Disabling-of-Command-TabComplete.patch index 1fe85fd4f2..0dc6236e2e 100644 --- a/CraftBukkit-Patches/0033-Allow-Disabling-of-Command-TabComplete.patch +++ b/CraftBukkit-Patches/0029-Allow-Disabling-of-Command-TabComplete.patch @@ -1,14 +1,14 @@ -From 42d2418969eb65f19fbd37e70ce1d614c60c052d Mon Sep 17 00:00:00 2001 +From 12e15f58613b671b868f1a0e74838e4780229a41 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 6dc4157..fdac2f6 100644 +index 2da23eb..463c0d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1698,6 +1698,13 @@ public final class CraftServer implements Server { +@@ -1549,6 +1549,13 @@ public final class CraftServer implements Server { } public List tabCompleteCommand(Player player, String message) { @@ -23,7 +23,7 @@ index 6dc4157..fdac2f6 100644 try { completions = getCommandMap().tabComplete(player, message.substring(1)); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index c9e6dc5..f611334 100644 +index 4e7d731..0a6ab75 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -154,4 +154,21 @@ public class SpigotConfig @@ -49,5 +49,5 @@ index c9e6dc5..f611334 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0029-Prevent-Shutdown-Hang.patch b/CraftBukkit-Patches/0029-Prevent-Shutdown-Hang.patch deleted file mode 100644 index 58a72faa13..0000000000 --- a/CraftBukkit-Patches/0029-Prevent-Shutdown-Hang.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 94c56282c7a751537d77bb10a8fc050662fe338a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 11 Jun 2013 11:54:32 +1000 -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 e6012fb..9eb25df 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1152,8 +1152,15 @@ public abstract class PlayerList { - } - - public void u() { -- 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() ); -+ if ( ( !this.players.isEmpty() ) && ( this.players.get( 0 ) == p ) ) -+ { -+ this.players.remove( 0 ); // Prevent shutdown hang if already disconnected -+ } -+ // Spigot end - } - } - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0034-Configurable-Messages.patch b/CraftBukkit-Patches/0030-Configurable-Messages.patch similarity index 78% rename from CraftBukkit-Patches/0034-Configurable-Messages.patch rename to CraftBukkit-Patches/0030-Configurable-Messages.patch index 8f52afe982..38ae915e7d 100644 --- a/CraftBukkit-Patches/0034-Configurable-Messages.patch +++ b/CraftBukkit-Patches/0030-Configurable-Messages.patch @@ -1,54 +1,54 @@ -From 5831308359be4561f282629032c081d3fee9187d Mon Sep 17 00:00:00 2001 +From 47b279108fd9133ea5de128653e563793275c2e1 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/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 52bc69b..b98079c 100644 +index f8bac48..e036bc6 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -64,11 +64,11 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -62,11 +62,11 @@ public class HandshakeListener implements PacketHandshakingInListener { // CraftBukkit end - if (packethandshakinginsetprotocol.d() > 5) { -- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.7.10"); -+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + if (packethandshakinginsetprotocol.b() > 47) { +- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8"); ++ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8" ) ); // Spigot + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); - } else if (packethandshakinginsetprotocol.d() < 5) { -- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.7.10"); -+ chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedClientMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); + } else if (packethandshakinginsetprotocol.b() < 47) { +- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8"); ++ chatcomponenttext = new ChatComponentText(java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8" ) ); // Spigot + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); this.b.close(chatcomponenttext); } else { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 9eb25df..110b7e0 100644 +index 5e882cc..2b8a3e5 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -365,7 +365,7 @@ public abstract class PlayerList { +@@ -357,7 +357,7 @@ public abstract class PlayerList { event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); } else if (!this.isWhitelisted(gameprofile)) { // 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 if (this.k.isBanned(socketaddress) && !this.k.get(gameprofile).hasExpired()) { - IpBanEntry ipbanentry = this.k.get(socketaddress); + } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { + IpBanEntry ipbanentry = this.l.get(socketaddress); -@@ -379,7 +379,7 @@ public abstract class PlayerList { +@@ -371,7 +371,7 @@ public abstract class PlayerList { } else { // 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, "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 fdac2f6..f8e2f0f 100644 +index 463c0d8..0741d7b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -745,11 +745,7 @@ public final class CraftServer implements Server { +@@ -626,11 +626,7 @@ public final class CraftServer implements Server { return true; } @@ -62,7 +62,7 @@ index fdac2f6..f8e2f0f 100644 return false; } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index f611334..4a89e70 100644 +index 0a6ab75..95bb141 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -12,6 +12,7 @@ import java.util.Map; @@ -81,7 +81,7 @@ index f611334..4a89e70 100644 + public static String whitelistMessage; + public static String unknownCommandMessage; + public static String serverFullMessage; -+ public static String outdatedClientMessage = "Outdated client! Please use {}"; ++ public static String outdatedClientMessage = "Outdated client! Please use {0}"; + public static String outdatedServerMessage = "Outdated server! I\'m still on {0}"; + private static String transform(String s) + { @@ -89,7 +89,7 @@ index f611334..4a89e70 100644 + } + private static void messages() + { -+ if (version < 4) ++ if (version < 8) + { + set( "messages.outdated-client", outdatedClientMessage ); + set( "messages.outdated-server", outdatedServerMessage ); @@ -103,5 +103,5 @@ index f611334..4a89e70 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0035-Allow-Disabling-of-Random-Lighting-Updates.patch b/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch similarity index 86% rename from CraftBukkit-Patches/0035-Allow-Disabling-of-Random-Lighting-Updates.patch rename to CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch index f554ab6ab2..75916380fe 100644 --- a/CraftBukkit-Patches/0035-Allow-Disabling-of-Random-Lighting-Updates.patch +++ b/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch @@ -1,27 +1,27 @@ -From 50a56d97e571d9998e56d5b8a0342d17296c13fc Mon Sep 17 00:00:00 2001 +From 88b404cb998842371744ba03f5ebd98f592f961c 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/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b6f3761..40c878b 100644 +index c3059b6..9e9ea23 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -931,7 +931,7 @@ public class Chunk { +@@ -994,7 +994,7 @@ public class Chunk { } - this.m = true; + this.p = true; - if (!this.lit && this.done) { + if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight - this.p(); + this.n(); } - } + diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e876b66..3806f7f 100644 +index c006526..fcb6557 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -2108,7 +2108,7 @@ public abstract class World implements IBlockAccess { +@@ -2009,7 +2009,7 @@ public abstract class World implements IBlockAccess { } this.methodProfiler.a("playerCheckLight"); @@ -47,5 +47,5 @@ index 956c628..8868ea3 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0036-Properly-Close-Inventories.patch b/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch similarity index 71% rename from CraftBukkit-Patches/0036-Properly-Close-Inventories.patch rename to CraftBukkit-Patches/0032-Properly-Close-Inventories.patch index 82d0ae4abc..ed542ce61d 100644 --- a/CraftBukkit-Patches/0036-Properly-Close-Inventories.patch +++ b/CraftBukkit-Patches/0032-Properly-Close-Inventories.patch @@ -1,4 +1,4 @@ -From 13bf7c59fcc316dd8adecba24c0dcbdc5b4ee654 Mon Sep 17 00:00:00 2001 +From 2847ce7bd37c53add794fec473be60b60224a17b 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,17 +6,17 @@ 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 40c878b..ab0af12 100644 +index 9e9ea23..208ba6b 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -783,6 +783,18 @@ public class Chunk { +@@ -808,6 +808,18 @@ public class Chunk { while (iterator.hasNext()) { TileEntity tileentity = (TileEntity) iterator.next(); + // Spigot Start + if ( tileentity instanceof IInventory ) + { -+ for ( org.bukkit.entity.HumanEntity h : new ArrayList( (List) ( (IInventory) tileentity ).getViewers() ) ) ++ for ( org.bukkit.entity.HumanEntity h : Lists.newArrayList((List) ( (IInventory) tileentity ).getViewers() ) ) + { + if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) + { @@ -26,16 +26,16 @@ index 40c878b..ab0af12 100644 + } + // Spigot End - this.world.a(tileentity); + this.world.b(tileentity); } -@@ -792,6 +804,18 @@ public class Chunk { - java.util.Iterator iter = this.entitySlices[i].iterator(); +@@ -818,6 +830,18 @@ public class Chunk { + java.util.Iterator iter = newList.iterator(); while (iter.hasNext()) { - Entity entity = (Entity) iter.next(); + Entity entity = iter.next(); + // Spigot Start + if ( entity instanceof IInventory ) + { -+ for ( org.bukkit.entity.HumanEntity h : new ArrayList( (List) ( (IInventory) entity ).getViewers() ) ) ++ for ( org.bukkit.entity.HumanEntity h : Lists.newArrayList( (List) ( (IInventory) entity ).getViewers() ) ) + { + if ( h instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity ) + { @@ -48,13 +48,13 @@ index 40c878b..ab0af12 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 13b75ff..bf8e745 100644 +index ab1b3a5..bf882de 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 +@@ -124,6 +124,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp } - public void b(int i) { + public void c(int i) { + // Spigot Start + for ( HumanEntity human : new java.util.ArrayList( transaction ) ) + { @@ -62,8 +62,8 @@ index 13b75ff..bf8e745 100644 + } + // Spigot End this.b = false; - super.b(i); + super.c(i); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0037-Disallow-Interaction-With-Self.patch b/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch similarity index 65% rename from CraftBukkit-Patches/0037-Disallow-Interaction-With-Self.patch rename to CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch index 978d1b6e03..64e211d2d4 100644 --- a/CraftBukkit-Patches/0037-Disallow-Interaction-With-Self.patch +++ b/CraftBukkit-Patches/0033-Disallow-Interaction-With-Self.patch @@ -1,27 +1,27 @@ -From 69835bb2783298e5849be719334d3f7884152f03 Mon Sep 17 00:00:00 2001 +From 9e733588f48678280a2209ff0b56c3d677aa9e02 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 3a24fcd..cc9878f 100644 +index 3bfcd94..24dd7f0 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1058,6 +1058,13 @@ public class PlayerConnection implements PacketPlayInListener { - if (this.player.dead) return; // CraftBukkit +@@ -1169,6 +1169,13 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); + // Spigot Start -+ if ( entity == player ) ++ if ( entity == player && !player.v() ) // RENAME + { + disconnect( "Cannot interact with self!" ); + return; + } + // Spigot End - this.player.v(); + this.player.z(); if (entity != null) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0039-Entity-Mount-and-Dismount-Events.patch b/CraftBukkit-Patches/0034-Entity-Mount-and-Dismount-Events.patch similarity index 51% rename from CraftBukkit-Patches/0039-Entity-Mount-and-Dismount-Events.patch rename to CraftBukkit-Patches/0034-Entity-Mount-and-Dismount-Events.patch index 57c192cb17..a609c36387 100644 --- a/CraftBukkit-Patches/0039-Entity-Mount-and-Dismount-Events.patch +++ b/CraftBukkit-Patches/0034-Entity-Mount-and-Dismount-Events.patch @@ -1,27 +1,27 @@ -From eb9ab3071de9fcfaf291a6ac0e86e79833abc238 Mon Sep 17 00:00:00 2001 +From 3deeab2aa8e79f1f1d45d3eb551e2ab981ee90cb 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 18e4d8d..85d7665 100644 +index 10e99d1..afa789f 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1450,6 +1450,7 @@ public abstract class Entity { +@@ -1545,6 +1545,7 @@ public abstract class Entity implements ICommandListener { } } // CraftBukkit end + pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot - - this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); + this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); this.vehicle.passenger = null; -@@ -1485,6 +1486,17 @@ public abstract class Entity { + } +@@ -1579,6 +1580,18 @@ public abstract class Entity implements ICommandListener { } } // CraftBukkit end + // Spigot Start -+ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4 ) ) ++ if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) ) + { + org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ); + pluginManager.callEvent( event ); @@ -31,21 +31,10 @@ index 18e4d8d..85d7665 100644 + } + } + // Spigot End - ++ 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 03485fe..54c77f8 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -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) { -+ world.getServer().getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot - // CraftBukkit start - use parent method instead to correctly fire VehicleExitEvent - Entity originalVehicle = this.vehicle; - // First statement moved down, second statement handled in parent method. + } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0040-Prevent-Ghost-Players-Caused-by-Plugins.patch b/CraftBukkit-Patches/0035-Prevent-Ghost-Players-Caused-by-Plugins.patch similarity index 73% rename from CraftBukkit-Patches/0040-Prevent-Ghost-Players-Caused-by-Plugins.patch rename to CraftBukkit-Patches/0035-Prevent-Ghost-Players-Caused-by-Plugins.patch index c1e0aaa816..5e6512d710 100644 --- a/CraftBukkit-Patches/0040-Prevent-Ghost-Players-Caused-by-Plugins.patch +++ b/CraftBukkit-Patches/0035-Prevent-Ghost-Players-Caused-by-Plugins.patch @@ -1,4 +1,4 @@ -From 44a7e0bcabdf2affdd2638c4d5ee13253352490d Mon Sep 17 00:00:00 2001 +From c963624b5abc0547e7c0eb224d362f23e130ac00 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,13 +6,13 @@ 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 110b7e0..6341b2b 100644 +index 2b8a3e5..fe4121f 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -492,6 +492,11 @@ public abstract class PlayerList { - Player respawnPlayer = this.cserver.getPlayer(entityplayer1); +@@ -481,6 +481,11 @@ public abstract class PlayerList { + Player respawnPlayer = cserver.getPlayer(entityplayer1); PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); - this.cserver.getPluginManager().callEvent(respawnEvent); + cserver.getPluginManager().callEvent(respawnEvent); + // Spigot Start + if (entityplayer.playerConnection.isDisconnected()) { + return entityplayer; @@ -22,5 +22,5 @@ index 110b7e0..6341b2b 100644 location = respawnEvent.getRespawnLocation(); entityplayer.reset(); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0041-Plug-World-Unload-Memory-Leak.patch b/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch similarity index 60% rename from CraftBukkit-Patches/0041-Plug-World-Unload-Memory-Leak.patch rename to CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch index 744c073e92..ab288c85fc 100644 --- a/CraftBukkit-Patches/0041-Plug-World-Unload-Memory-Leak.patch +++ b/CraftBukkit-Patches/0036-Plug-World-Unload-Memory-Leak.patch @@ -1,22 +1,22 @@ -From db804ccfb6c609e8cbb15a593db03cc5b542992b Mon Sep 17 00:00:00 2001 +From e6efbdee7fa312e978fc1cb5eedfd3568eb5684f 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 8e01414..e0469bb 100644 +index 2cdf7d3..6acfb62 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 +@@ -10,7 +10,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit + public class BlockRedstoneTorch extends BlockTorch { - private boolean isOn; -- private static Map b = new HashMap(); +- private static Map b = Maps.newHashMap(); + private static Map b = new java.util.WeakHashMap(); // Spigot + private final boolean isOn; - private boolean a(World world, int i, int j, int k, boolean flag) { - if (!b.containsKey(world)) { + private boolean a(World world, BlockPosition blockposition, boolean flag) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0042-Player-Collision-API.patch b/CraftBukkit-Patches/0037-Player-Collision-API.patch similarity index 62% rename from CraftBukkit-Patches/0042-Player-Collision-API.patch rename to CraftBukkit-Patches/0037-Player-Collision-API.patch index 363f9730aa..c2650c1d50 100644 --- a/CraftBukkit-Patches/0042-Player-Collision-API.patch +++ b/CraftBukkit-Patches/0037-Player-Collision-API.patch @@ -1,40 +1,47 @@ -From bfb15639e961d653d3ed86908db36ce3324f65fa Mon Sep 17 00:00:00 2001 +From 1416d961e1445f05084e49af2b1e7c64b293761f 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 a4e29b2..aeab36b 100644 +index 7c47e5b..6e9354f 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -430,7 +430,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -425,6 +425,7 @@ public abstract class EntityHuman extends EntityLiving { List list = this.world.getEntities(this, axisalignedbb); -- if (list != null) { -+ if (list != null && this.S()) { // Spigot: Add this.S() condition (second !this.isDead near bottom of EntityLiving) - for (int i = 0; i < list.size(); ++i) { - 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 92ad5c7..859e91f 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1596,7 +1596,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()) { -+ if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition ++ if (this.ae()) { // Spigot: Add this.ae() condition (second !this.isDead near bottom of EntityLiving) for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); +@@ -432,6 +433,7 @@ public abstract class EntityHuman extends EntityLiving { + this.d(entity); + } + } ++ } // Spigot + } + + } +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 86474de..6358f5e 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -1616,7 +1616,7 @@ public abstract class EntityLiving extends Entity { + protected void bK() { + List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + +- if (list != null && !list.isEmpty()) { ++ if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition + for (int i = 0; i < list.size(); ++i) { + 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 84673b4..46aa10e 100644 +index dc7654a..3bc77ae 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -63,6 +63,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -62,6 +62,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public double maxHealthCache; public boolean joining = true; // CraftBukkit end @@ -42,25 +49,25 @@ index 84673b4..46aa10e 100644 + public boolean collidesWithEntities = true; + + @Override -+ public boolean R() ++ public boolean ad() + { -+ return this.collidesWithEntities && super.R(); // (first !this.isDead near bottom of EntityLiving) ++ return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) + } + + @Override -+ public boolean S() ++ public boolean ae() + { -+ return this.collidesWithEntities && super.S(); // (second !this.isDead near bottom of EntityLiving) ++ return this.collidesWithEntities && super.ae(); // (second !this.isDead near bottom of EntityLiving) + } + // Spigot end 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 d02d728..62d237d 100644 +index 01b1822..984bea1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1292,6 +1292,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1314,6 +1314,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Spigot start private final Player.Spigot spigot = new Player.Spigot() { @@ -81,5 +88,5 @@ index d02d728..62d237d 100644 public Player.Spigot spigot() -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0043-Fully-Disable-Snooper-When-Not-Required.patch b/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch similarity index 65% rename from CraftBukkit-Patches/0043-Fully-Disable-Snooper-When-Not-Required.patch rename to CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch index 3fcdc017b0..96deb02a92 100644 --- a/CraftBukkit-Patches/0043-Fully-Disable-Snooper-When-Not-Required.patch +++ b/CraftBukkit-Patches/0038-Fully-Disable-Snooper-When-Not-Required.patch @@ -1,27 +1,27 @@ -From b082ecfc606ef0d3f554e5edd3a37c1342c7c59c Mon Sep 17 00:00:00 2001 +From 7cbfd8567af8064f01aba1ff03ce9b581d46226f 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 523f429..a9431be 100644 +index 1cb9d38..a227340 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -585,11 +585,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -627,11 +627,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.g[this.ticks % 100] = System.nanoTime() - i; this.methodProfiler.b(); this.methodProfiler.a("snooper"); -- if (!this.l.d() && this.ticks > 100) { -+ if (getSnooperEnabled() && !this.l.d() && this.ticks > 100) { // Spigot - this.l.a(); +- if (!this.m.d() && this.ticks > 100) { ++ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot + this.m.a(); } - if (this.ticks % 6000 == 0) { + if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot - this.l.b(); + this.m.b(); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0038-Lower-Chunk-Compression.patch b/CraftBukkit-Patches/0038-Lower-Chunk-Compression.patch deleted file mode 100644 index 1e4ea3120d..0000000000 --- a/CraftBukkit-Patches/0038-Lower-Chunk-Compression.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5717bbdf08a5430b7014a788bde0cdc202f77c18 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 2 Jul 2013 09:07:54 +1000 -Subject: [PATCH] Lower Chunk Compression - -Use a chunk compression level of 4 - this provides an optimal balance between speed and compression. - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 734faef..613c1f1 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -24,7 +24,7 @@ public class PacketPlayOutMapChunk extends Packet { - this.b = chunk.locZ; - this.g = flag; - ChunkMap chunkmap = a(chunk, flag, i); -- Deflater deflater = new Deflater(-1); -+ Deflater deflater = new Deflater(4); // Spigot - - this.d = chunkmap.c; - this.c = chunkmap.b; -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -index 3eac231..bf3a139 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 -- return new Deflater(6); -+ return new Deflater(4); // Spigot 6 -> 4 - } - }; - // CraftBukkit end --- -1.9.1 - diff --git a/CraftBukkit-Patches/0044-Add-Getter-for-Entity-Invulnerability.patch b/CraftBukkit-Patches/0039-Add-Getter-for-Entity-Invulnerability.patch similarity index 71% rename from CraftBukkit-Patches/0044-Add-Getter-for-Entity-Invulnerability.patch rename to CraftBukkit-Patches/0039-Add-Getter-for-Entity-Invulnerability.patch index bd2854433d..3febea3d6c 100644 --- a/CraftBukkit-Patches/0044-Add-Getter-for-Entity-Invulnerability.patch +++ b/CraftBukkit-Patches/0039-Add-Getter-for-Entity-Invulnerability.patch @@ -1,25 +1,25 @@ -From 43f1384e6eae1c1e76e195cee7eb63d2951898e3 Mon Sep 17 00:00:00 2001 +From d55e61ec721eaca35a88a0ff4fd900288beebe76 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 4198dae..ce18aea 100644 +index 4b26bb0..c50396d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -406,6 +406,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -440,6 +440,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { // Spigot start private final Spigot spigot = new Spigot() { + @Override + public boolean isInvulnerable() + { -+ return getHandle().isInvulnerable(); ++ return getHandle().isInvulnerable(net.minecraft.server.DamageSource.GENERIC); + } }; public Spigot spigot() -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0045-Cap-Minimum-Player-Speed.patch b/CraftBukkit-Patches/0040-Cap-Minimum-Player-Speed.patch similarity index 81% rename from CraftBukkit-Patches/0045-Cap-Minimum-Player-Speed.patch rename to CraftBukkit-Patches/0040-Cap-Minimum-Player-Speed.patch index 30da5ca1ec..161a25cd9b 100644 --- a/CraftBukkit-Patches/0045-Cap-Minimum-Player-Speed.patch +++ b/CraftBukkit-Patches/0040-Cap-Minimum-Player-Speed.patch @@ -1,14 +1,14 @@ -From 4b235a101141d1b82eeca1187c71d3d9fb37a184 Mon Sep 17 00:00:00 2001 +From 3c4614e2e411ef1ffcb250b7c2dfde392fd0f340 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 62d237d..6ac6520 100644 +index 984bea1..bf9dd99 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1165,7 +1165,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1178,7 +1178,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setFlySpeed(float value) { validateSpeed(value); EntityPlayer player = getHandle(); @@ -17,7 +17,7 @@ index 62d237d..6ac6520 100644 player.updateAbilities(); } -@@ -1173,7 +1173,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1187,7 +1187,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setWalkSpeed(float value) { validateSpeed(value); EntityPlayer player = getHandle(); @@ -27,5 +27,5 @@ index 62d237d..6ac6520 100644 } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0046-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch b/CraftBukkit-Patches/0041-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch similarity index 81% rename from CraftBukkit-Patches/0046-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch rename to CraftBukkit-Patches/0041-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch index 52a30e7b54..a978866758 100644 --- a/CraftBukkit-Patches/0046-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch +++ b/CraftBukkit-Patches/0041-Update-Inventory-and-Health-for-PlayerConsumeItemEve.patch @@ -1,17 +1,17 @@ -From 607ebff4ad51575949273908f73cb1dddc531ba1 Mon Sep 17 00:00:00 2001 +From bccecea300f4b3dc11024365a81ce16978dd240e 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 4bde9c1..01062ce 100644 +index 6e9354f..0844b60 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -277,6 +277,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -298,6 +298,10 @@ public abstract class EntityHuman extends EntityLiving { // Update client if (this instanceof EntityPlayer) { - ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.g)); + // Spigot Start + ((EntityPlayer) this).getBukkitEntity().updateInventory(); + ((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); @@ -20,5 +20,5 @@ index 4bde9c1..01062ce 100644 return; } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0042-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch b/CraftBukkit-Patches/0042-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch new file mode 100644 index 0000000000..1fa6cfd4bd --- /dev/null +++ b/CraftBukkit-Patches/0042-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch @@ -0,0 +1,26 @@ +From 8a3ecfb1768bc58ad25261d4ff1922989d3d1c2f 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 + +Adds BUKKIT-4355 + +diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java +index cc61759..7443873 100644 +--- a/src/main/java/net/minecraft/server/BlockTNT.java ++++ b/src/main/java/net/minecraft/server/BlockTNT.java +@@ -77,6 +77,11 @@ public class BlockTNT extends Block { + EntityArrow entityarrow = (EntityArrow) entity; + + if (entityarrow.isBurning()) { ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { ++ return; ++ } ++ // CraftBukkit end + this.a(world, blockposition, world.getType(blockposition).set(BlockTNT.EXPLODE, Boolean.valueOf(true)), entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); + world.setAir(blockposition); + } +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0048-Allow-Disabling-of-1.6.3-Structure-Saving.patch b/CraftBukkit-Patches/0043-Allow-Disabling-of-1.6.3-Structure-Saving.patch similarity index 78% rename from CraftBukkit-Patches/0048-Allow-Disabling-of-1.6.3-Structure-Saving.patch rename to CraftBukkit-Patches/0043-Allow-Disabling-of-1.6.3-Structure-Saving.patch index be7bcc4bd3..a9a3cadbdf 100644 --- a/CraftBukkit-Patches/0048-Allow-Disabling-of-1.6.3-Structure-Saving.patch +++ b/CraftBukkit-Patches/0043-Allow-Disabling-of-1.6.3-Structure-Saving.patch @@ -1,29 +1,29 @@ -From c1ded3f7da6746c8632b43730918a38f713dd21c Mon Sep 17 00:00:00 2001 +From 42a42f6ec9d5ad895bf66a398ac9de97f6a25d45 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 diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 97308d0..4d336d8 100644 +index 49b7aa1..ecab5d1 100644 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -178,7 +178,15 @@ public abstract class StructureGenerator extends WorldGenBase { +@@ -171,7 +171,15 @@ public abstract class StructureGenerator extends WorldGenBase { private void a(World world) { - if (this.e == null) { + if (this.d == null) { + // Spigot Start + if ( world.spigotConfig.saveStructureInfo ) + { - this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + } else + { -+ this.e = new PersistentStructure( this.a() ); ++ this.d = new PersistentStructure( this.a() ); + } + // Spigot End - if (this.e == null) { - this.e = new PersistentStructure(this.a()); - world.a(this.a(), (PersistentBase) this.e); + if (this.d == null) { + this.d = new PersistentStructure(this.a()); + world.a(this.a(), (PersistentBase) this.d); diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 8868ea3..48ae475 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -46,5 +46,5 @@ index 8868ea3..48ae475 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0049-Item-Despawn-Rate.patch b/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch similarity index 86% rename from CraftBukkit-Patches/0049-Item-Despawn-Rate.patch rename to CraftBukkit-Patches/0044-Item-Despawn-Rate.patch index ca05cf1ffc..7648921f66 100644 --- a/CraftBukkit-Patches/0049-Item-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0044-Item-Despawn-Rate.patch @@ -1,17 +1,17 @@ -From 1516f2ee15c86afee40f177aafd6be011cbb8412 Mon Sep 17 00:00:00 2001 +From f6fe4b96cae27d007b322988f85dc7c3876c5a25 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 c8c0d6a..a45bed9 100644 +index 7f16401..e35f78f 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -104,7 +104,7 @@ public class EntityItem extends Entity { - } +@@ -108,7 +108,7 @@ public class EntityItem extends Entity { + // Craftbukkit end */ - // ++this.age; // CraftBukkit - Moved up + this.W(); - if (!this.world.isStatic && this.age >= 6000) { + if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot // CraftBukkit start - fire ItemDespawnEvent @@ -34,5 +34,5 @@ index 48ae475..6d31363 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0050-Don-t-Special-Case-X-Move-Value.patch b/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch similarity index 81% rename from CraftBukkit-Patches/0050-Don-t-Special-Case-X-Move-Value.patch rename to CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch index 5e447ed6d6..00fa8b9651 100644 --- a/CraftBukkit-Patches/0050-Don-t-Special-Case-X-Move-Value.patch +++ b/CraftBukkit-Patches/0045-Don-t-Special-Case-X-Move-Value.patch @@ -1,14 +1,14 @@ -From 422f1722ca154f6cc792cc86ec87cd91ae91ab30 Mon Sep 17 00:00:00 2001 +From f27c8faa6a5a02f356acebca0f5c178265c79fef 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 cc9878f..f170ad0 100644 +index b903a81..310ab0c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -106,6 +106,7 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -108,6 +108,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList private float lastPitch = Float.MAX_VALUE; private float lastYaw = Float.MAX_VALUE; private boolean justTeleported = false; @@ -16,8 +16,8 @@ index cc9878f..f170ad0 100644 // For the PacketPlayOutBlockPlace hack :( Long lastPacket; -@@ -203,6 +204,18 @@ public class PlayerConnection implements PacketPlayInListener { - +@@ -214,6 +215,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + } // CraftBukkit start - fire PlayerMoveEvent Player player = this.getPlayer(); + // Spigot Start @@ -35,7 +35,7 @@ index cc9878f..f170ad0 100644 Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. Location to = player.getLocation().clone(); // Start off the To location as the Players current location. -@@ -231,7 +244,7 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -242,7 +255,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.lastPitch = to.getPitch(); // Skip the first time we do this @@ -45,5 +45,5 @@ index cc9878f..f170ad0 100644 this.server.getPluginManager().callEvent(event); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0051-Implement-respawn-API.patch b/CraftBukkit-Patches/0046-Implement-respawn-API.patch similarity index 83% rename from CraftBukkit-Patches/0051-Implement-respawn-API.patch rename to CraftBukkit-Patches/0046-Implement-respawn-API.patch index 600530d832..f9e88fd558 100644 --- a/CraftBukkit-Patches/0051-Implement-respawn-API.patch +++ b/CraftBukkit-Patches/0046-Implement-respawn-API.patch @@ -1,14 +1,14 @@ -From 08f8db2d7755e34ca34784fcafe639ee3f781963 Mon Sep 17 00:00:00 2001 +From c45455632dc675c3f43ba0f0b811e9479ddc9c40 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 6ac6520..1a9c381 100644 +index bf9dd99..494c0bc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1305,6 +1305,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1327,6 +1327,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getHandle().collidesWithEntities = collides; getHandle().k = collides; // First boolean of Entity } @@ -25,5 +25,5 @@ index 6ac6520..1a9c381 100644 public Player.Spigot spigot() -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0053-Arrow-Despawn-Rate.patch b/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch similarity index 76% rename from CraftBukkit-Patches/0053-Arrow-Despawn-Rate.patch rename to CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch index ac186bd838..b19f236716 100644 --- a/CraftBukkit-Patches/0053-Arrow-Despawn-Rate.patch +++ b/CraftBukkit-Patches/0047-Arrow-Despawn-Rate.patch @@ -1,22 +1,22 @@ -From a6c2721133c875399815dc33b31a119e0d5382f4 Mon Sep 17 00:00:00 2001 +From ac8b907b3f05c7f88346f5ed2d0fdbe0ab281d12 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 ac5d5d2..de8dda7 100644 +index ae00f60..7d1727d 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -156,7 +156,7 @@ public class EntityArrow extends Entity implements IProjectile { +@@ -155,7 +155,7 @@ public class EntityArrow extends Entity implements IProjectile { if (block == this.g && i == this.h) { - ++this.at; -- if (this.at == 1200) { -+ if (this.at >= world.spigotConfig.arrowDespawnRate) { // First int after shooter + ++this.ap; +- if (this.ap >= 1200) { ++ if (this.ap >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter this.die(); } - } else { + diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 6d31363..1814b4f 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -34,5 +34,5 @@ index 6d31363..1814b4f 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0047-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch b/CraftBukkit-Patches/0047-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch deleted file mode 100644 index d6132a45e4..0000000000 --- a/CraftBukkit-Patches/0047-Call-EntityChangeBlockEvent-for-Fire-Arrows-hitting-.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 4ba768774a4de3edd890f0f358adf4c513d559a7 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 - -Adds BUKKIT-4355 - -diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index 8cc7d5e..35bf1a3 100644 ---- a/src/main/java/net/minecraft/server/BlockTNT.java -+++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -54,7 +54,7 @@ public class BlockTNT extends Block { - - public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) { - if (entityhuman.bF() != null && entityhuman.bF().getItem() == Items.FLINT_AND_STEEL) { -- this.a(world, i, j, k, 1, entityhuman); -+ this.a(world, i, j, k, 1, (EntityLiving) entityhuman); // Spigot - Fix decompile error! - world.setAir(i, j, k); - entityhuman.bF().damage(1, entityhuman); - return true; -@@ -68,6 +68,11 @@ public class BlockTNT extends Block { - EntityArrow entityarrow = (EntityArrow) entity; - - if (entityarrow.isBurning()) { -+ // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityarrow, i, j, k, Blocks.AIR, 0).isCancelled()) { -+ return; -+ } -+ // CraftBukkit end - this.a(world, i, j, k, 1, entityarrow.shooter instanceof EntityLiving ? (EntityLiving) entityarrow.shooter : null); - world.setAir(i, j, k); - } --- -1.9.1 - diff --git a/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch b/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch new file mode 100644 index 0000000000..e75c00aeaf --- /dev/null +++ b/CraftBukkit-Patches/0048-Fix-packed-ice-generation.patch @@ -0,0 +1,38 @@ +From 99ee83952a261f744f8c689615e28c49e5853cbf Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sun, 1 Dec 2013 17:52:14 +1100 +Subject: [PATCH] Fix packed ice generation + + +diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java +index 38e9602..3d08a82 100644 +--- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java ++++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java +@@ -40,13 +40,13 @@ public class WorldGenPackedIce2 extends WorldGenerator { + Block block = world.getType(blockposition.a(i1, k, j1)).getBlock(); + + if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { +- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE); ++ world.setTypeUpdate(blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot + } + + if (k != 0 && l > 1) { + block = world.getType(blockposition.a(i1, -k, j1)).getBlock(); + if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) { +- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE); ++ world.setTypeUpdate(blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot + } + } + } +@@ -77,7 +77,7 @@ public class WorldGenPackedIce2 extends WorldGenerator { + Block block1 = world.getType(blockposition1).getBlock(); + + if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { +- this.a(world, blockposition1, Blocks.PACKED_ICE); ++ world.setTypeUpdate(blockposition1, Blocks.PACKED_ICE.getBlockData()); // Spigot + blockposition1 = blockposition1.down(); + --l1; + if (l1 <= 0) { +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0055-Watchdog-Thread.patch b/CraftBukkit-Patches/0049-Watchdog-Thread.patch similarity index 91% rename from CraftBukkit-Patches/0055-Watchdog-Thread.patch rename to CraftBukkit-Patches/0049-Watchdog-Thread.patch index de12002231..36beb9c88c 100644 --- a/CraftBukkit-Patches/0055-Watchdog-Thread.patch +++ b/CraftBukkit-Patches/0049-Watchdog-Thread.patch @@ -1,14 +1,27 @@ -From c6dabc5a4f93d00a08a7cdb8e3270342e4111b27 Mon Sep 17 00:00:00 2001 +From d4ad0adea49e54a330c38b8e44c10b9ce8fa1234 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 5 Aug 2014 17:20:19 +0100 Subject: [PATCH] Watchdog Thread. +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 390c6eb..240c909 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -225,7 +225,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + } + // CraftBukkit end + +- if (this.aQ() > 0L) { ++ if (false && this.aQ() > 0L) { // Spigot - disable + Thread thread = new Thread(new ThreadWatchdog(this)); + + thread.setName("Server Watchdog"); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index da69706..d596924 100644 +index a227340..c5a6bec 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -498,6 +498,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -537,6 +537,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.a(crashreport); } finally { try { @@ -16,7 +29,7 @@ index da69706..d596924 100644 this.stop(); this.isStopped = true; } catch (Throwable throwable1) { -@@ -595,6 +596,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -637,6 +638,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.methodProfiler.b(); this.methodProfiler.b(); @@ -155,7 +168,7 @@ index 0000000..429c258 + } +} diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 4a89e70..069111c 100644 +index 95bb141..c071421 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -196,4 +196,18 @@ public class SpigotConfig @@ -301,5 +314,5 @@ index 0000000..de08ad6 + } +} -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0056-Clear-Flower-Pot-on-Drop.patch b/CraftBukkit-Patches/0050-Clear-Flower-Pot-on-Drop.patch similarity index 67% rename from CraftBukkit-Patches/0056-Clear-Flower-Pot-on-Drop.patch rename to CraftBukkit-Patches/0050-Clear-Flower-Pot-on-Drop.patch index 4d01c23154..f23f63c79b 100644 --- a/CraftBukkit-Patches/0056-Clear-Flower-Pot-on-Drop.patch +++ b/CraftBukkit-Patches/0050-Clear-Flower-Pot-on-Drop.patch @@ -1,21 +1,21 @@ -From f65a56e851df25543ce7622d5484db9828661375 Mon Sep 17 00:00:00 2001 +From c58440804a708a12053e7d0938f6bd85f7bf4c10 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 3 Dec 2013 11:07:48 +1100 Subject: [PATCH] Clear Flower Pot on Drop diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java -index aa82a50..e468eb8 100644 +index d1275a3..0fdfdde 100644 --- a/src/main/java/net/minecraft/server/BlockFlowerPot.java +++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java @@ -90,6 +90,7 @@ public class BlockFlowerPot extends BlockContainer { - if (tileentityflowerpot != null && tileentityflowerpot.a() != null) { - this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b())); + if (tileentityflowerpot != null && tileentityflowerpot.b() != null) { + a(world, blockposition, new ItemStack(tileentityflowerpot.b(), 1, tileentityflowerpot.c())); + tileentityflowerpot.a( null, 0 ); // Spigot } - super.remove(world, i, j, k, block, l); + super.remove(world, blockposition, iblockdata); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0057-Fix-some-chunks-not-being-sent-to-the-client.patch b/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch similarity index 82% rename from CraftBukkit-Patches/0057-Fix-some-chunks-not-being-sent-to-the-client.patch rename to CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch index c1e82ea576..ddc771b3f6 100644 --- a/CraftBukkit-Patches/0057-Fix-some-chunks-not-being-sent-to-the-client.patch +++ b/CraftBukkit-Patches/0051-Fix-some-chunks-not-being-sent-to-the-client.patch @@ -1,18 +1,18 @@ -From 161cdb522267db951b26782afcb45782d21cf0b5 Mon Sep 17 00:00:00 2001 +From 0fa249558b94c997140a25a1236626c9e22f7340 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Mon, 2 Dec 2013 23:42:09 +0000 Subject: [PATCH] Fix some chunks not being sent to the client diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ab0af12..b1213f0 100644 +index 208ba6b..e664e55 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -961,7 +961,15 @@ public class Chunk { +@@ -1036,7 +1036,15 @@ public class Chunk { } public boolean isReady() { -- return this.m && this.done && this.lit; +- return this.p && this.done && this.lit; + // Spigot Start + /* + * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client. @@ -24,7 +24,7 @@ index ab0af12..b1213f0 100644 + // Spigot End } - public ChunkCoordIntPair l() { + public ChunkCoordIntPair j() { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0052-Fix-BrewingStands-Removing-NBT-Potions.patch b/CraftBukkit-Patches/0052-Fix-BrewingStands-Removing-NBT-Potions.patch deleted file mode 100644 index 5e3fe12484..0000000000 --- a/CraftBukkit-Patches/0052-Fix-BrewingStands-Removing-NBT-Potions.patch +++ /dev/null @@ -1,28 +0,0 @@ -From ec811040fba08b7084c23760094615bdf41b3e39 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 - - -diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java -index 6ce80db..9f49f43 100644 ---- a/src/main/java/net/minecraft/server/BlockBrewingStand.java -+++ b/src/main/java/net/minecraft/server/BlockBrewingStand.java -@@ -86,7 +86,13 @@ public class BlockBrewingStand extends BlockContainer { - entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); - entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F); - entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3); -- world.addEntity(entityitem); -+ // Spigot Start -+ if ( itemstack.hasTag() ) -+ { -+ entityitem.getItemStack().setTag( (NBTTagCompound) itemstack.getTag().clone() ); -+ } -+ // Spigot End -+ world.addEntity( entityitem ); - } - } - } --- -1.9.1 - diff --git a/CraftBukkit-Patches/0058-Fix-Broken-Async-Chat.patch b/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch similarity index 65% rename from CraftBukkit-Patches/0058-Fix-Broken-Async-Chat.patch rename to CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch index 65572b3167..76552de911 100644 --- a/CraftBukkit-Patches/0058-Fix-Broken-Async-Chat.patch +++ b/CraftBukkit-Patches/0052-Fix-Broken-Async-Chat.patch @@ -1,24 +1,25 @@ -From 791420e61002cf87a890188c250e438005feb39e Mon Sep 17 00:00:00 2001 +From 21fba8d7f5b9b5384f1168dd7d9bb4276de80c81 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 5 Dec 2013 13:55:53 +1100 Subject: [PATCH] Fix Broken Async Chat diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java -index 604a7af..d419f0f 100644 +index 8e1740d..cb614ef 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java -@@ -43,7 +43,25 @@ public class PacketPlayInChat extends Packet { +@@ -30,7 +30,26 @@ public class PacketPlayInChat implements Packet { + return this.a; } - // CraftBukkit end -- public void handle(PacketListener packetlistener) { +- public void a(PacketListener packetlistener) { + // Spigot Start + private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool( + new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() ); -+ public void handle(final PacketListener packetlistener) ++ @Override ++ public void a(final PacketListener packetlistener) + { -+ if ( a() ) ++ if ( !a.startsWith("/") ) + { + executors.submit( new Runnable() + { @@ -26,15 +27,15 @@ index 604a7af..d419f0f 100644 + @Override + public void run() + { -+ PacketPlayInChat.this.a( (PacketPlayInListener) packetlistener ); ++ PacketPlayInChat.this.a( (PacketListenerPlayIn) packetlistener ); + } + } ); + return; + } + // Spigot End - this.a((PacketPlayInListener) packetlistener); + this.a((PacketListenerPlayIn) packetlistener); } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0060-Orebfuscator.patch b/CraftBukkit-Patches/0053-Orebfuscator.patch similarity index 62% rename from CraftBukkit-Patches/0060-Orebfuscator.patch rename to CraftBukkit-Patches/0053-Orebfuscator.patch index 0766f2274a..d6bee79c71 100644 --- a/CraftBukkit-Patches/0060-Orebfuscator.patch +++ b/CraftBukkit-Patches/0053-Orebfuscator.patch @@ -1,135 +1,119 @@ -From 7a368a07559457241a612939e55e43459c4221c8 Mon Sep 17 00:00:00 2001 +From 75e2457256bf4e36cc2ce32af9a8b188bcf5d182 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 5576f15..df602bd 100644 +index 22dc42d..fd78677 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -83,6 +83,7 @@ public class EntityFallingBlock extends Entity { - } - - this.world.setAir(i, j, k); -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot - } - - if (this.onGround) { -@@ -98,6 +99,7 @@ public class EntityFallingBlock extends Entity { +@@ -60,6 +60,7 @@ public class EntityFallingBlock extends Entity { + blockposition = new BlockPosition(this); + if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { + this.world.setAir(blockposition); ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot + } else if (!this.world.isStatic) { + this.die(); + return; +@@ -84,6 +85,7 @@ public class EntityFallingBlock extends Entity { + return; } - this.world.setTypeAndData(i, j, k, this.id, this.data, 3); + this.world.setTypeAndData(blockposition, this.block, 3); ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot // CraftBukkit end -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot - - if (this.id instanceof BlockFalling) { - ((BlockFalling) this.id).a(this.world, i, j, k, this.data); + if (block instanceof BlockFalling) { + ((BlockFalling) block).a_(this.world, blockposition); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 56fa999..4502f68 100644 +index 5ce4985..735a7d4 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -203,6 +203,7 @@ public class Explosion { - j = chunkposition.y; - k = chunkposition.z; - block = this.world.getType(i, j, k); -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot +@@ -195,6 +195,7 @@ public class Explosion { + blockposition = (BlockPosition) iterator.next(); + Block block = this.world.getType(blockposition).getBlock(); + ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot if (flag) { - double d0 = (double) ((float) i + this.world.random.nextFloat()); - double d1 = (double) ((float) j + this.world.random.nextFloat()); + double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat()); + double d1 = (double) ((float) blockposition.getY() + this.world.random.nextFloat()); diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 613c1f1..7479600 100644 +index e24d3ae..e106a1f 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -28,6 +28,7 @@ public class PacketPlayOutMapChunk extends Packet { +@@ -18,6 +18,7 @@ public class PacketPlayOutMapChunk implements Packet { + this.b = chunk.locZ; + this.d = flag; + this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); ++ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world); + } - this.d = chunkmap.c; - this.c = chunkmap.b; -+ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, i, chunkmap.a, chunk.world); // Spigot - - try { - this.f = chunkmap.a; + public void a(PacketDataSerializer packetdataserializer) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -index bf3a139..30bf8a7 100644 +index 8af5e1f..9df0d53 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 +@@ -8,6 +8,7 @@ public class PacketPlayOutMapChunkBulk implements Packet { + private int[] b; + private ChunkMap[] c; + private boolean d; + private World world; // Spigot public PacketPlayOutMapChunkBulk() {} -@@ -44,6 +45,9 @@ public class PacketPlayOutMapChunkBulk extends Packet { - Chunk chunk = (Chunk) list.get(k); - ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff'); - -+ // Spigot start -+ world = chunk.world; -+ /* - if (buildBuffer.length < j + chunkmap.a.length) { - byte[] abyte = new byte[j + chunkmap.a.length]; - -@@ -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.a[k] = chunk.locX; - this.b[k] = chunk.locZ; -@@ -79,6 +85,22 @@ public class PacketPlayOutMapChunkBulk extends Packet { - if (this.buffer != null) { - return; +@@ -27,7 +28,8 @@ public class PacketPlayOutMapChunkBulk implements Packet { + this.b[j] = chunk.locZ; + this.c[j] = chunkmap; + } +- ++ ++ world = ((Chunk) list.get(0)).getWorld(); // Spigot + } + + public void a(PacketDataSerializer packetdataserializer) { +@@ -67,6 +69,7 @@ public class PacketPlayOutMapChunkBulk implements Packet { + } + + for (i = 0; i < this.a.length; ++i) { ++ world.spigotConfig.antiXrayInstance.obfuscate(this.a[i], this.b[i], this.c[i].b, this.c[i].a, world); // Spigot + packetdataserializer.writeBytes(this.c[i].a); } -+ // Spigot start -+ int finalBufferSize = 0; -+ // Obfuscate all sections -+ for (int i = 0; i < a.length; i++) { -+ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world); -+ finalBufferSize += inflatedBuffers[i].length; -+ } -+ -+ // Now it's time to efficiently copy the chunk to the build buffer -+ buildBuffer = new byte[finalBufferSize]; -+ int bufferLocation = 0; -+ for (int i = 0; i < a.length; i++) { -+ System.arraycopy(inflatedBuffers[i], 0, buildBuffer, bufferLocation, inflatedBuffers[i].length); -+ bufferLocation += inflatedBuffers[i].length; -+ } -+ // Spigot end - 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 7607155..b4461b9 100644 +index 3e24620..f0d915f 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -173,6 +173,7 @@ public class PlayerInteractManager { - this.o = i1; - } +@@ -197,6 +197,7 @@ public class PlayerInteractManager { } -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, i, j, k); // Spigot + } ++ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot } + public void a(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 3806f7f..c7c33b0 100644 +index fcb6557..e0a7160 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -237,9 +237,16 @@ public abstract class World implements IBlockAccess { - return this.getType(i, k, j); +@@ -445,6 +445,7 @@ public abstract class World implements IBlockAccess { + this.d(blockposition.up(), block); + this.d(blockposition.north(), block); + this.d(blockposition.south(), block); ++ spigotConfig.antiXrayInstance.updateNearbyBlocks(this, blockposition); // Spigot } -- public Block getType(int i, int j, int k) { + public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) { +@@ -658,9 +659,16 @@ public abstract class World implements IBlockAccess { + return this.worldProvider.p()[this.getLightLevel(blockposition)]; + } + +- public IBlockData getType(BlockPosition blockposition) { + // Spigot start -+ public Block getType(int i, int j, int k) ++ public IBlockData getType(BlockPosition blockposition) + { -+ return getType( i, j, k, true ); ++ return getType( blockposition, true ); + } -+ -+ public Block getType(int i, int j, int k, boolean useCaptured) { ++ ++ public IBlockData getType(BlockPosition blockposition, boolean useCaptured) { // CraftBukkit start - tree generation - if (captureTreeGeneration) { + if (captureTreeGeneration && useCaptured) { @@ -137,25 +121,18 @@ index 3806f7f..c7c33b0 100644 Iterator it = capturedBlockStates.iterator(); while (it.hasNext()) { BlockState previous = it.next(); -@@ -551,6 +558,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 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..fad22e2 +index 0000000..6f28cd8 --- /dev/null +++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -0,0 +1,227 @@ +@@ -0,0 +1,234 @@ +package org.spigotmc; + -+import net.minecraft.util.gnu.trove.set.TByteSet; -+import net.minecraft.util.gnu.trove.set.hash.TByteHashSet; ++import gnu.trove.set.TByteSet; ++import gnu.trove.set.hash.TByteHashSet; +import net.minecraft.server.Block; ++import net.minecraft.server.BlockPosition; +import net.minecraft.server.Blocks; +import net.minecraft.server.World; +import org.bukkit.craftbukkit.util.CraftMagicNumbers; @@ -199,12 +176,12 @@ index 0000000..fad22e2 + * Starts the timings handler, then updates all blocks within the set radius + * of the given coordinate, revealing them if they are hidden ores. + */ -+ public void updateNearbyBlocks(World world, int x, int y, int z) ++ public void updateNearbyBlocks(World world, BlockPosition position) + { + if ( world.spigotConfig.antiXray ) + { + update.startTiming(); -+ updateNearbyBlocks( world, x, y, z, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower ++ updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower + update.stopTiming(); + } + } @@ -249,7 +226,7 @@ index 0000000..fad22e2 + replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.NETHERRACK); + break; + case THE_END: -+ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.WHITESTONE); ++ replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.END_STONE); + break; + default: + replaceWithTypeId = (byte) CraftMagicNumbers.getId(Blocks.STONE); @@ -277,24 +254,27 @@ index 0000000..fad22e2 + } + // Grab the block ID in the buffer. + // TODO: extended IDs are not yet supported -+ int blockId = buffer[index] & 0xFF; ++ int blockId = (buffer[index << 1] & 0xFF) ++ | ((buffer[(index << 1) + 1] & 0xFF) << 8); ++ blockId >>>= 4; + // Check if the block should be obfuscated + if ( obfuscateBlocks[blockId] ) + { + // The world isn't loaded, bail out -+ if ( !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) ++ if ( !isLoaded( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) ) + { + index++; + continue; + } + // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate -+ if ( !hasTransparentBlockAdjacent( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) ++ if ( !hasTransparentBlockAdjacent( world, new BlockPosition( startX + x, ( i << 4 ) + y, startZ + z ), initialRadius ) ) + { ++ int newId = blockId; + switch ( world.spigotConfig.engineMode ) + { + case 1: + // Replace with replacement material -+ buffer[index] = replaceWithTypeId; ++ newId = replaceWithTypeId & 0xFF; + break; + case 2: + // Replace with random ore. @@ -302,9 +282,12 @@ index 0000000..fad22e2 + { + randomOre = 0; + } -+ buffer[index] = replacementOres[randomOre++]; ++ newId = replacementOres[randomOre++] & 0xFF; + break; + } ++ newId <<= 4; ++ buffer[index << 1] = (byte) (newId & 0xFF); ++ buffer[(index << 1) + 1] = (byte) ((newId >> 8) & 0xFF); + } + } + @@ -317,56 +300,56 @@ index 0000000..fad22e2 + } + } + -+ private void updateNearbyBlocks(World world, int x, int y, int z, int radius, boolean updateSelf) ++ private void updateNearbyBlocks(World world, BlockPosition position, int radius, boolean updateSelf) + { + // If the block in question is loaded -+ if ( world.isLoaded( x, y, z ) ) ++ if ( world.isLoaded( position ) ) + { + // Get block id -+ Block block = world.getType(x, y, z); ++ Block block = world.getType(position).getBlock(); + + // See if it needs update + if ( updateSelf && obfuscateBlocks[Block.getId( block )] ) + { + // Send the update -+ world.notify( x, y, z ); ++ world.notify( position ); + } + + // Check other blocks for updates + if ( radius > 0 ) + { -+ updateNearbyBlocks( world, x + 1, y, z, radius - 1, true ); -+ updateNearbyBlocks( world, x - 1, y, z, radius - 1, true ); -+ updateNearbyBlocks( world, x, y + 1, z, radius - 1, true ); -+ updateNearbyBlocks( world, x, y - 1, z, radius - 1, true ); -+ updateNearbyBlocks( world, x, y, z + 1, radius - 1, true ); -+ updateNearbyBlocks( world, x, y, z - 1, radius - 1, true ); ++ updateNearbyBlocks( world, position.east(), radius - 1, true ); ++ updateNearbyBlocks( world, position.west(), radius - 1, true ); ++ updateNearbyBlocks( world, position.up(), radius - 1, true ); ++ updateNearbyBlocks( world, position.down(), radius - 1, true ); ++ updateNearbyBlocks( world, position.south(), radius - 1, true ); ++ updateNearbyBlocks( world, position.north(), radius - 1, true ); + } + } + } + -+ private static boolean isLoaded(World world, int x, int y, int z, int radius) ++ private static boolean isLoaded(World world, BlockPosition position, int radius) + { -+ return world.isLoaded( x, y, z ) ++ return world.isLoaded( position ) + && ( radius == 0 || -+ ( isLoaded( world, x + 1, y, z, radius - 1 ) -+ && isLoaded( world, x - 1, y, z, radius - 1 ) -+ && isLoaded( world, x, y + 1, z, radius - 1 ) -+ && isLoaded( world, x, y - 1, z, radius - 1 ) -+ && isLoaded( world, x, y, z + 1, radius - 1 ) -+ && isLoaded( world, x, y, z - 1, radius - 1 ) ) ); ++ ( isLoaded( world, position.east(), radius - 1 ) ++ && isLoaded( world, position.west(), radius - 1 ) ++ && isLoaded( world, position.up(), radius - 1 ) ++ && isLoaded( world, position.down(), radius - 1 ) ++ && isLoaded( world, position.south(), radius - 1 ) ++ && isLoaded( world, position.north(), radius - 1 ) ) ); + } + -+ private static boolean hasTransparentBlockAdjacent(World world, int x, int y, int z, int radius) ++ private static boolean hasTransparentBlockAdjacent(World world, BlockPosition position, int radius) + { -+ return !isSolidBlock(world.getType(x, y, z, false)) /* isSolidBlock */ ++ return !isSolidBlock(world.getType(position, false).getBlock()) /* isSolidBlock */ + || ( radius > 0 -+ && ( hasTransparentBlockAdjacent( world, x + 1, y, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x - 1, y, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y + 1, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y - 1, z, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y, z + 1, radius - 1 ) -+ || hasTransparentBlockAdjacent( world, x, y, z - 1, radius - 1 ) ) ); ++ && ( hasTransparentBlockAdjacent( world, position.east(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.west(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.up(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.down(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.south(), radius - 1 ) ++ || hasTransparentBlockAdjacent( world, position.north(), radius - 1 ) ) ); + } + + private static boolean isSolidBlock(Block block) { @@ -375,7 +358,7 @@ index 0000000..fad22e2 + // rendering they can be seen through therefor we special + // case them so that the antixray doesn't show the fake + // blocks around them. -+ return block.r() && block != Blocks.MOB_SPAWNER; ++ return block.isOccluding() && block != Blocks.MOB_SPAWNER; + } +} diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -427,5 +410,5 @@ index 1814b4f..45b2aae 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0054-Fix-packed-ice-generation.patch b/CraftBukkit-Patches/0054-Fix-packed-ice-generation.patch deleted file mode 100644 index dff3ee0add..0000000000 --- a/CraftBukkit-Patches/0054-Fix-packed-ice-generation.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 1655f0ec885e96045d38ab18bcfcdfc13ed0510f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 1 Dec 2013 17:52:14 +1100 -Subject: [PATCH] Fix packed ice generation - - -diff --git a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -index c207a9c..ae1bf65 100644 ---- a/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -+++ b/src/main/java/net/minecraft/server/WorldGenPackedIce2.java -@@ -41,13 +41,13 @@ public class WorldGenPackedIce2 extends WorldGenerator { - Block block = world.getType(i + l1, j + j1, k + i2); - - if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -- this.setType(world, i + l1, j + j1, k + i2, Blocks.PACKED_ICE); -+ world.setTypeUpdate(i + l1, j + j1, k + i2, Blocks.PACKED_ICE); // Spigot - } - - if (j1 != 0 && k1 > 1) { - block = world.getType(i + l1, j - j1, k + i2); - if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { -- this.setType(world, i + l1, j - j1, k + i2, Blocks.PACKED_ICE); -+ world.setTypeUpdate(i + l1, j - j1, k + i2, Blocks.PACKED_ICE); // Spigot - } - } - } -@@ -78,7 +78,7 @@ public class WorldGenPackedIce2 extends WorldGenerator { - Block block1 = world.getType(i + j2, l1, k + k1); - - if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { -- this.setType(world, i + j2, l1, k + k1, Blocks.PACKED_ICE); -+ world.setTypeUpdate(i + j2, l1, k + k1, Blocks.PACKED_ICE); // Spigot - --l1; - --k2; - if (k2 <= 0) { --- -1.9.1 - diff --git a/CraftBukkit-Patches/0061-Optimize-DataWatcher.patch b/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch similarity index 73% rename from CraftBukkit-Patches/0061-Optimize-DataWatcher.patch rename to CraftBukkit-Patches/0054-Optimize-DataWatcher.patch index ea15c3e348..56e021737f 100644 --- a/CraftBukkit-Patches/0061-Optimize-DataWatcher.patch +++ b/CraftBukkit-Patches/0054-Optimize-DataWatcher.patch @@ -1,4 +1,4 @@ -From 3c41eceec0c93bb11b761bc6852337545d1de8ed Mon Sep 17 00:00:00 2001 +From af655ad8d3d0b4676e5ab4f6cd78c4f6e2f6bf6d Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 13 Dec 2013 11:45:47 +1100 Subject: [PATCH] Optimize DataWatcher @@ -6,21 +6,21 @@ Subject: [PATCH] Optimize DataWatcher Use primitive orientated collections, as well as more effective copies across collections. diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index 2d1da33..e368514 100644 +index e21e68d..966d737 100644 --- a/src/main/java/net/minecraft/server/DataWatcher.java +++ b/src/main/java/net/minecraft/server/DataWatcher.java @@ -14,8 +14,13 @@ public class DataWatcher { private final Entity a; private boolean b = true; -- private static final HashMap c = new HashMap(); -- private final Map d = new HashMap(); +- private static final Map c = Maps.newHashMap(); +- private final Map d = Maps.newHashMap(); + // Spigot Start -+ private static final net.minecraft.util.gnu.trove.map.TObjectIntMap classToId = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 ); -+ private final net.minecraft.util.gnu.trove.map.TIntObjectMap dataValues = new net.minecraft.util.gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 ); ++ private static final gnu.trove.map.TObjectIntMap classToId = new gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 ); ++ private final gnu.trove.map.TIntObjectMap dataValues = new gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 ); + // These exist as an attempt at backwards compatability for (broken) NMS plugins -+ private static final Map c = net.minecraft.util.gnu.trove.TDecorators.wrap( classToId ); -+ private final Map d = net.minecraft.util.gnu.trove.TDecorators.wrap( dataValues ); ++ private static final Map c = gnu.trove.TDecorators.wrap( classToId ); ++ private final Map d = gnu.trove.TDecorators.wrap( dataValues ); + // Spigot End private boolean e; private ReadWriteLock f = new ReentrantReadWriteLock(); @@ -29,7 +29,7 @@ index 2d1da33..e368514 100644 } public void a(int i, Object object) { -- Integer integer = (Integer) c.get(object.getClass()); +- Integer integer = (Integer) DataWatcher.c.get(object.getClass()); + int integer = classToId.get(object.getClass()); // Spigot - if (integer == null) { @@ -51,7 +51,7 @@ index 2d1da33..e368514 100644 this.b = false; } @@ -46,7 +51,7 @@ public class DataWatcher { - WatchableObject watchableobject = new WatchableObject(j, i, null); + WatchableObject watchableobject = new WatchableObject(j, i, (Object) null); this.f.writeLock().lock(); - this.d.put(Integer.valueOf(i), watchableobject); @@ -68,7 +68,7 @@ index 2d1da33..e368514 100644 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data"); -@@ -133,7 +138,7 @@ public class DataWatcher { +@@ -138,7 +143,7 @@ public class DataWatcher { if (this.e) { this.f.readLock().lock(); @@ -77,7 +77,7 @@ index 2d1da33..e368514 100644 while (iterator.hasNext()) { WatchableObject watchableobject = (WatchableObject) iterator.next(); -@@ -157,7 +162,7 @@ public class DataWatcher { +@@ -162,7 +167,7 @@ public class DataWatcher { public void a(PacketDataSerializer packetdataserializer) { this.f.readLock().lock(); @@ -86,12 +86,12 @@ index 2d1da33..e368514 100644 while (iterator.hasNext()) { WatchableObject watchableobject = (WatchableObject) iterator.next(); -@@ -170,18 +175,11 @@ public class DataWatcher { +@@ -175,18 +180,11 @@ public class DataWatcher { } public List c() { - ArrayList arraylist = null; -+ ArrayList arraylist = new ArrayList(); // Spigot ++ ArrayList arraylist = Lists.newArrayList(); // Spigot this.f.readLock().lock(); @@ -100,24 +100,25 @@ index 2d1da33..e368514 100644 - for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) { - watchableobject = (WatchableObject) iterator.next(); - if (arraylist == null) { -- arraylist = new ArrayList(); +- arraylist = Lists.newArrayList(); - } - } + arraylist.addAll(this.dataValues.valueCollection()); // Spigot this.f.readLock().unlock(); return arraylist; -@@ -295,12 +293,14 @@ public class DataWatcher { +@@ -309,13 +307,15 @@ public class DataWatcher { } static { -- c.put(Byte.class, Integer.valueOf(0)); -- c.put(Short.class, Integer.valueOf(1)); -- c.put(Integer.class, Integer.valueOf(2)); -- c.put(Float.class, Integer.valueOf(3)); -- c.put(String.class, Integer.valueOf(4)); -- c.put(ItemStack.class, Integer.valueOf(5)); -- c.put(ChunkCoordinates.class, Integer.valueOf(6)); +- DataWatcher.c.put(Byte.class, Integer.valueOf(0)); +- DataWatcher.c.put(Short.class, Integer.valueOf(1)); +- DataWatcher.c.put(Integer.class, Integer.valueOf(2)); +- DataWatcher.c.put(Float.class, Integer.valueOf(3)); +- DataWatcher.c.put(String.class, Integer.valueOf(4)); +- DataWatcher.c.put(ItemStack.class, Integer.valueOf(5)); +- DataWatcher.c.put(BlockPosition.class, Integer.valueOf(6)); +- DataWatcher.c.put(Vector3f.class, Integer.valueOf(7)); + // Spigot Start - remove valueOf + classToId.put(Byte.class, 0); + classToId.put(Short.class, 1); @@ -125,10 +126,11 @@ index 2d1da33..e368514 100644 + classToId.put(Float.class, 3); + classToId.put(String.class, 4); + classToId.put(ItemStack.class, 5); -+ classToId.put(ChunkCoordinates.class, 6); ++ classToId.put(BlockPosition.class, 6); ++ classToId.put(Vector3f.class, 7); + // Spigot End } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0062-Fire-PreLogin-Events-in-Offline-Mode.patch b/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch similarity index 79% rename from CraftBukkit-Patches/0062-Fire-PreLogin-Events-in-Offline-Mode.patch rename to CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch index e19a609999..4ee8209499 100644 --- a/CraftBukkit-Patches/0062-Fire-PreLogin-Events-in-Offline-Mode.patch +++ b/CraftBukkit-Patches/0055-Fire-PreLogin-Events-in-Offline-Mode.patch @@ -1,15 +1,15 @@ -From 696d751ff854fc7502dd482a471c84f15426b610 Mon Sep 17 00:00:00 2001 +From f86f19addeaf624be20e4bae0627444810221fee Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 18 Dec 2013 13:32:10 +1100 Subject: [PATCH] Fire PreLogin Events in Offline Mode diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 8f982f1..0755d36 100644 +index ba2b912..a59ea80 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -59,10 +59,23 @@ public class LoginListener implements PacketLoginInListener { - } +@@ -60,10 +60,23 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo + } + // Spigot start @@ -21,7 +21,7 @@ index 8f982f1..0755d36 100644 + } + // Spigot end + - public void c() { + public void b() { + // Spigot start - Moved to initUUID + /* if (!this.i.isComplete()) { @@ -31,45 +31,45 @@ index 8f982f1..0755d36 100644 + // Spigot end // CraftBukkit start - fire PlayerLoginEvent - EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, this.hostname); -@@ -97,7 +110,7 @@ public class LoginListener implements PacketLoginInListener { + EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname); +@@ -98,7 +111,7 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo this.g = EnumProtocolState.KEY; - this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.K().getPublic(), this.e), new GenericFutureListener[0]); + this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.P().getPublic(), this.e)); } else { - this.g = EnumProtocolState.READY_TO_ACCEPT; + (new ThreadPlayerLookupUUID(this, "User Authenticator #" + b.incrementAndGet())).start(); // Spigot } - } + } diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java -index 6b91be7..1b2620c 100644 +index bbceef0..8b93fd5 100644 --- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java +++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java -@@ -25,50 +25,19 @@ class ThreadPlayerLookupUUID extends Thread { - GameProfile gameprofile = LoginListener.a(this.a); +@@ -24,50 +24,19 @@ class ThreadPlayerLookupUUID extends Thread { + GameProfile gameprofile = LoginListener.b(this.a); try { + // Spigot Start -+ if ( !LoginListener.c( this.a ).getOnlineMode() ) ++ if ( !LoginListener.a( this.a ).getOnlineMode() ) + { + a.initUUID(); + fireLoginEvents(); + return; + } + // Spigot End - String s = (new BigInteger(MinecraftEncryption.a(LoginListener.b(this.a), LoginListener.c(this.a).K().getPublic(), LoginListener.d(this.a)))).toString(16); + String s = (new BigInteger(MinecraftEncryption.a(LoginListener.c(this.a), LoginListener.a(this.a).P().getPublic(), LoginListener.d(this.a)))).toString(16); - LoginListener.a(this.a, LoginListener.c(this.a).av().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s)); - if (LoginListener.a(this.a) != null) { + LoginListener.a(this.a, LoginListener.a(this.a).aB().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s)); + if (LoginListener.b(this.a) != null) { - // CraftBukkit start - fire PlayerPreLoginEvent -- if (!this.a.networkManager.isConnected()) { +- if (!this.a.networkManager.g()) { - return; - } - -- String playerName = LoginListener.a(this.a).getName(); +- String playerName = LoginListener.b(this.a).getName(); - java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); -- java.util.UUID uniqueId = LoginListener.a(this.a).getId(); -- final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server; +- java.util.UUID uniqueId = LoginListener.b(this.a).getId(); +- final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server; - - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); - server.getPluginManager().callEvent(asyncEvent); @@ -86,7 +86,7 @@ index 6b91be7..1b2620c 100644 - return event.getResult(); - }}; - -- LoginListener.c(this.a).processQueue.add(waitable); +- LoginListener.a(this.a).processQueue.add(waitable); - if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { - this.a.disconnect(event.getKickMessage()); - return; @@ -98,29 +98,29 @@ index 6b91be7..1b2620c 100644 - } - } - // CraftBukkit end -- -- LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId()); +- +- LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId()); - LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); + fireLoginEvents(); // Spigot - } else if (LoginListener.c(this.a).N()) { + } else if (LoginListener.a(this.a).S()) { LoginListener.e().warn("Failed to verify username but will let them in anyway!"); LoginListener.a(this.a, this.a.a(gameprofile)); @@ -93,4 +62,48 @@ class ThreadPlayerLookupUUID extends Thread { - // CraftBukkit end } + } + + private void fireLoginEvents() throws Exception + { + // CraftBukkit start - fire PlayerPreLoginEvent -+ if (!this.a.networkManager.isConnected()) { ++ if (!this.a.networkManager.g()) { + return; + } + -+ String playerName = LoginListener.a(this.a).getName(); ++ String playerName = LoginListener.b(this.a).getName(); + java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); -+ java.util.UUID uniqueId = LoginListener.a(this.a).getId(); -+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.c(this.a).server; ++ java.util.UUID uniqueId = LoginListener.b(this.a).getId(); ++ final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server; + + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); + server.getPluginManager().callEvent(asyncEvent); @@ -137,7 +137,7 @@ index 6b91be7..1b2620c 100644 + return event.getResult(); + }}; + -+ LoginListener.c(this.a).processQueue.add(waitable); ++ LoginListener.a(this.a).processQueue.add(waitable); + if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { + this.a.disconnect(event.getKickMessage()); + return; @@ -150,10 +150,10 @@ index 6b91be7..1b2620c 100644 + } + // CraftBukkit end + -+ LoginListener.e().info("UUID of player " + LoginListener.a(this.a).getName() + " is " + LoginListener.a(this.a).getId()); ++ LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId()); + LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0063-BungeeCord-Support.patch b/CraftBukkit-Patches/0056-BungeeCord-Support.patch similarity index 68% rename from CraftBukkit-Patches/0063-BungeeCord-Support.patch rename to CraftBukkit-Patches/0056-BungeeCord-Support.patch index 7a77b90a96..6507868c26 100644 --- a/CraftBukkit-Patches/0063-BungeeCord-Support.patch +++ b/CraftBukkit-Patches/0056-BungeeCord-Support.patch @@ -1,4 +1,4 @@ -From c75950d95f27b4ebf18e35008248b3506b83a42b Mon Sep 17 00:00:00 2001 +From ee8fda0b3febdea34a3d61d004269bdf7e718d15 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 1 Dec 2013 18:18:41 +1100 Subject: [PATCH] BungeeCord Support @@ -6,28 +6,20 @@ Subject: [PATCH] BungeeCord Support Provides support for IP forwarding via BungeeCord. diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index b98079c..ee24038 100644 +index e036bc6..c9a7839 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -1,14 +1,17 @@ - package net.minecraft.server; - -+import net.minecraft.util.com.mojang.authlib.properties.Property; // Spigot - import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; - - // CraftBukkit start - import java.net.InetAddress; - import java.util.HashMap; -+import net.minecraft.util.com.mojang.util.UUIDTypeAdapter; +@@ -6,7 +6,8 @@ import java.util.HashMap; // CraftBukkit end public class HandshakeListener implements PacketHandshakingInListener { - +- ++ + private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot // CraftBukkit start - add fields private static final HashMap throttleTracker = new HashMap(); private static int throttleCounter = 0; -@@ -73,6 +76,26 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -71,6 +72,26 @@ public class HandshakeListener implements PacketHandshakingInListener { this.b.close(chatcomponenttext); } else { this.b.a((PacketListener) (new LoginListener(this.a, this.b))); @@ -36,18 +28,18 @@ index b98079c..ee24038 100644 + String[] split = packethandshakinginsetprotocol.b.split("\00"); + if ( split.length == 3 || split.length == 4 ) { + packethandshakinginsetprotocol.b = split[0]; -+ b.n = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); -+ b.spoofedUUID = UUIDTypeAdapter.fromString( split[2] ); ++ b.j = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort()); ++ b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); + } else + { + chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!"); -+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); ++ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); + this.b.close(chatcomponenttext); + return; + } + if ( split.length == 4 ) + { -+ b.spoofedProfile = gson.fromJson(split[3], Property[].class); ++ b.spoofedProfile = gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class); + } + } + // Spigot End @@ -55,18 +47,10 @@ index b98079c..ee24038 100644 } break; diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 0755d36..e380a70 100644 +index a59ea80..df651d5 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -9,6 +9,7 @@ import javax.crypto.SecretKey; - - import net.minecraft.util.com.google.common.base.Charsets; - import net.minecraft.util.com.mojang.authlib.GameProfile; -+import net.minecraft.util.com.mojang.authlib.properties.Property; - import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; - import net.minecraft.util.org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; -@@ -62,9 +63,24 @@ public class LoginListener implements PacketLoginInListener { +@@ -63,9 +63,24 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo // Spigot start public void initUUID() { @@ -84,7 +68,7 @@ index 0755d36..e380a70 100644 + + if (networkManager.spoofedProfile != null) + { -+ for ( Property property : networkManager.spoofedProfile ) ++ for ( com.mojang.authlib.properties.Property property : networkManager.spoofedProfile ) + { + this.i.getProperties().put( property.getName(), property ); + } @@ -93,73 +77,65 @@ index 0755d36..e380a70 100644 // Spigot end diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 1b080c7..31d6008 100644 +index 33166a3..78d5949 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -6,6 +6,7 @@ import javax.crypto.SecretKey; - - import net.minecraft.util.com.google.common.collect.Queues; - import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder; -+import net.minecraft.util.com.mojang.authlib.properties.Property; - import net.minecraft.util.io.netty.channel.Channel; - import net.minecraft.util.io.netty.channel.ChannelFutureListener; - import net.minecraft.util.io.netty.channel.ChannelHandlerContext; -@@ -37,7 +38,11 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private final Queue k = Queues.newConcurrentLinkedQueue(); - private final Queue l = Queues.newConcurrentLinkedQueue(); - private Channel m; -- private SocketAddress n; +@@ -31,7 +31,11 @@ public class NetworkManager extends SimpleChannelInboundHandler { + private final EnumProtocolDirection g; + private final Queue h = Queues.newConcurrentLinkedQueue(); + private Channel i; +- private SocketAddress j; + // Spigot Start -+ public SocketAddress n; ++ public SocketAddress j; + public java.util.UUID spoofedUUID; -+ public Property[] spoofedProfile; ++ public com.mojang.authlib.properties.Property[] spoofedProfile; + // Spigot End - private PacketListener o; - private EnumProtocol p; - private IChatBaseComponent q; -@@ -207,4 +212,11 @@ public class NetworkManager extends SimpleChannelInboundHandler { + private PacketListener k; + private IChatBaseComponent l; + private boolean m; +@@ -239,4 +243,11 @@ public class NetworkManager extends SimpleChannelInboundHandler { static Channel a(NetworkManager networkmanager) { - return networkmanager.m; + return networkmanager.i; } + + // Spigot Start + public SocketAddress getRawAddress() + { -+ return this.m.remoteAddress(); ++ return this.i.remoteAddress(); + } + // Spigot End } diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -index 16d4765..39692ee 100644 +index 97920b0..0b86011 100644 --- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -13,7 +13,7 @@ public class PacketHandshakingInSetProtocol extends Packet { +@@ -11,7 +11,7 @@ public class PacketHandshakingInSetProtocol implements Packet { - public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws - this.a = packetdataserializer.a(); + public void a(PacketDataSerializer packetdataserializer) { + this.a = packetdataserializer.e(); - this.b = packetdataserializer.c(255); + this.b = packetdataserializer.c(Short.MAX_VALUE); // Spigot this.c = packetdataserializer.readUnsignedShort(); - this.d = EnumProtocol.a(packetdataserializer.a()); + this.d = EnumProtocol.a(packetdataserializer.e()); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6341b2b..01a6d66 100644 +index fe4121f..1d3d00f 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -350,7 +350,7 @@ public abstract class PlayerList { +@@ -342,7 +342,7 @@ public abstract class PlayerList { - EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, new PlayerInteractManager(this.server.getWorldServer(0))); + EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), gameprofile, new PlayerInteractManager(server.getWorldServer(0))); Player player = entity.getBukkitEntity(); - PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress()); + PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); String s; - if (this.j.isBanned(gameprofile) && !this.j.get(gameprofile).hasExpired()) { + if (getProfileBans().isBanned(gameprofile) && !getProfileBans().get(gameprofile).hasExpired()) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f8e2f0f..5a08283 100644 +index 0741d7b..69fa301 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -678,7 +678,13 @@ public final class CraftServer implements Server { +@@ -559,7 +559,13 @@ public final class CraftServer implements Server { @Override public long getConnectionThrottle() { @@ -175,10 +151,10 @@ index f8e2f0f..5a08283 100644 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 1a9c381..3eafd75 100644 +index 494c0bc..37b8287 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1294,6 +1294,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1316,6 +1316,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { { @Override @@ -192,7 +168,7 @@ index 1a9c381..3eafd75 100644 { return getHandle().collidesWithEntities; diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 069111c..7a0cb86 100644 +index c071421..47ab82f 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -210,4 +210,14 @@ public class SpigotConfig @@ -211,5 +187,5 @@ index 069111c..7a0cb86 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0064-Allow-Disabling-Zombie-Villager-Aggression.patch b/CraftBukkit-Patches/0057-Allow-Disabling-Zombie-Villager-Aggression.patch similarity index 61% rename from CraftBukkit-Patches/0064-Allow-Disabling-Zombie-Villager-Aggression.patch rename to CraftBukkit-Patches/0057-Allow-Disabling-Zombie-Villager-Aggression.patch index f78a23f4dc..47f003007b 100644 --- a/CraftBukkit-Patches/0064-Allow-Disabling-Zombie-Villager-Aggression.patch +++ b/CraftBukkit-Patches/0057-Allow-Disabling-Zombie-Villager-Aggression.patch @@ -1,4 +1,4 @@ -From 08426b497043f1ea5ef4ac6cd72bd794bb094ea2 Mon Sep 17 00:00:00 2001 +From 3f1a783d85a5c607779bfabcb092a2d4fdf207a7 Mon Sep 17 00:00:00 2001 From: Dylan Xaldin Date: Thu, 12 Dec 2013 18:05:03 -0600 Subject: [PATCH] Allow Disabling Zombie Villager Aggression @@ -6,25 +6,22 @@ Subject: [PATCH] Allow Disabling Zombie Villager Aggression Ability to configure if Zombies will be aggressive towards Villagers. diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 7d8cb93..f732579 100644 +index 378ab11..d50ddd4 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -30,7 +30,7 @@ public class EntityZombie extends EntityMonster { - this.getNavigation().b(true); - this.goalSelector.a(0, new PathfinderGoalFloat(this)); - this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false)); +@@ -39,12 +39,12 @@ public class EntityZombie extends EntityMonster { + } + + protected void n() { - this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); -+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) { this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); } // Spigot - this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); ++ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true)); // Spigot + this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, 1.0D, true)); this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false)); - this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); -@@ -38,7 +38,7 @@ public class EntityZombie extends EntityMonster { - this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); - this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true)); - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true)); -- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false)); -+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) { this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false)); } // Spigot - this.a(0.6F, 1.8F); + this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[] { EntityPigZombie.class})); + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true)); +- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); ++ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, false)); // Spigot + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class, true)); } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -44,5 +41,5 @@ index 45b2aae..b8e144d 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0065-Configurable-Amount-of-Netty-Threads.patch b/CraftBukkit-Patches/0058-Configurable-Amount-of-Netty-Threads.patch similarity index 55% rename from CraftBukkit-Patches/0065-Configurable-Amount-of-Netty-Threads.patch rename to CraftBukkit-Patches/0058-Configurable-Amount-of-Netty-Threads.patch index 7438bad9a8..c5823418f2 100644 --- a/CraftBukkit-Patches/0065-Configurable-Amount-of-Netty-Threads.patch +++ b/CraftBukkit-Patches/0058-Configurable-Amount-of-Netty-Threads.patch @@ -1,4 +1,4 @@ -From ae1d659c9359aa12f0a530e372a58cfb22a3fbcc Mon Sep 17 00:00:00 2001 +From c017a37c50c0b7924730665019c8916b39acc055 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 13 Dec 2013 11:58:58 +1100 Subject: [PATCH] Configurable Amount of Netty Threads @@ -6,38 +6,38 @@ Subject: [PATCH] Configurable Amount of Netty Threads This brings back the option that the Spigot version of netty saw. By default Netty will try and use cores*2 threads, however if running multiple servers on the same machine, this can be too many threads. Additionally some people have 16 core servers. If 32 Netty threads are allowed in this setup, then the lock contention, and thus blocking between threads becomes much greater, leading to decreased performance. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d596924..38d7890 100644 +index c5a6bec..471e6d1 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -54,7 +54,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - private final List n = new ArrayList(); - private final ICommandHandler o; +@@ -61,7 +61,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + private final List o = Lists.newArrayList(); + private final ICommandHandler p; public final MethodProfiler methodProfiler = new MethodProfiler(); -- private final ServerConnection p; -+ private ServerConnection p; // Spigot - private final ServerPing q = new ServerPing(); - private final Random r = new Random(); +- private final ServerConnection q; ++ private ServerConnection q; // Spigot + private final ServerPing r = new ServerPing(); + private final Random s = new Random(); private String serverIp; -@@ -113,7 +113,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - j = this; +@@ -123,7 +123,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.d = proxy; - // this.universe = file1; // CraftBukkit -- this.p = new ServerConnection(this); -+ // this.p = new ServerConnection(this); // Spigot - this.o = new CommandDispatcher(); - // this.convertable = new WorldLoaderServer(file1); // CraftBukkit - moved to DedicatedServer.init - this.T = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()); -@@ -1260,7 +1260,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + MinecraftServer.k = this; + // this.universe = file; // CraftBukkit +- this.q = new ServerConnection(this); ++ // this.q = new ServerConnection(this); // Spigot + this.Z = new UserCache(this, file1); + this.p = this.h(); + // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init +@@ -1333,7 +1333,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } // Spigot End - public ServerConnection ai() { -- return this.p; -+ return ( this.p ) == null ? this.p = new ServerConnection( this ) : this.p; // Spigot + public ServerConnection ao() { +- return this.q; ++ return this.q == null ? this.q = new ServerConnection(this) : this.q; // Spigot } - public boolean ak() { + public boolean aq() { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 7a0cb86..59ba766 100644 +index 47ab82f..865a17f 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -220,4 +220,11 @@ public class SpigotConfig @@ -53,5 +53,5 @@ index 7a0cb86..59ba766 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0066-Prevent-Mineshaft-Saving.patch b/CraftBukkit-Patches/0059-Prevent-Mineshaft-Saving.patch similarity index 72% rename from CraftBukkit-Patches/0066-Prevent-Mineshaft-Saving.patch rename to CraftBukkit-Patches/0059-Prevent-Mineshaft-Saving.patch index a10501ba43..ef201747b9 100644 --- a/CraftBukkit-Patches/0066-Prevent-Mineshaft-Saving.patch +++ b/CraftBukkit-Patches/0059-Prevent-Mineshaft-Saving.patch @@ -1,22 +1,22 @@ -From a5c94cb10d115a07f16fd2c4d1af8bd71a1e5746 Mon Sep 17 00:00:00 2001 +From e58a21889e5c6a0ba5ab15714d0d3c045827496f Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 13 Dec 2013 15:21:02 +1100 Subject: [PATCH] Prevent Mineshaft Saving diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 4d336d8..f835b01 100644 +index ecab5d1..dde9929 100644 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -179,7 +179,7 @@ public abstract class StructureGenerator extends WorldGenBase { +@@ -172,7 +172,7 @@ public abstract class StructureGenerator extends WorldGenBase { private void a(World world) { - if (this.e == null) { + if (this.d == null) { // Spigot Start - if ( world.spigotConfig.saveStructureInfo ) + if ( world.spigotConfig.saveStructureInfo && !this.a().equals( "Mineshaft" ) ) { - this.e = (PersistentStructure) world.a(PersistentStructure.class, this.a()); + this.d = (PersistentStructure) world.a(PersistentStructure.class, this.a()); } else -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0059-Remove-OS-X-Special-Chars-from-Signs.patch b/CraftBukkit-Patches/0059-Remove-OS-X-Special-Chars-from-Signs.patch deleted file mode 100644 index d6ccc02109..0000000000 --- a/CraftBukkit-Patches/0059-Remove-OS-X-Special-Chars-from-Signs.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 08607a925a2eace0f790defd40b31ef977efda43 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 8 Dec 2013 16:52:42 +1100 -Subject: [PATCH] Remove OS X Special Chars from Signs - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 234817a..c833842 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1584,6 +1584,7 @@ public class PlayerConnection implements PacketPlayInListener { - - for (j = 0; j < 4; ++j) { - boolean flag = true; -+ packetplayinupdatesign.f()[j] = packetplayinupdatesign.f()[j].replaceAll( "\uF700", "" ).replaceAll( "\uF701", "" ); // Spigot - Mac OSX sends weird chars - - if (packetplayinupdatesign.f()[j].length() > 15) { - flag = false; --- -1.9.1 - diff --git a/CraftBukkit-Patches/0067-Log-Cause-of-Unexpected-Exceptions.patch b/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch similarity index 62% rename from CraftBukkit-Patches/0067-Log-Cause-of-Unexpected-Exceptions.patch rename to CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch index 7531230ff1..497475fba5 100644 --- a/CraftBukkit-Patches/0067-Log-Cause-of-Unexpected-Exceptions.patch +++ b/CraftBukkit-Patches/0060-Log-Cause-of-Unexpected-Exceptions.patch @@ -1,26 +1,26 @@ -From 958e9267747d6b33c67291637a556990da6dead4 Mon Sep 17 00:00:00 2001 +From 3300cd586685815d7a61e813efc6357f972e4ec4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 18 Dec 2013 13:39:14 +1100 Subject: [PATCH] Log Cause of Unexpected Exceptions diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 38d7890..6a31aaa 100644 +index 471e6d1..bd79bea 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -479,6 +479,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -518,6 +518,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } } catch (Throwable throwable) { - i.error("Encountered an unexpected exception", throwable); + MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable); + // Spigot Start + if ( throwable.getCause() != null ) + { -+ i.error( "\tCause of unexpected exception was", throwable.getCause() ); ++ MinecraftServer.LOGGER.error( "\tCause of unexpected exception was", throwable.getCause() ); + } + // Spigot End CrashReport crashreport = null; if (throwable instanceof ReportedException) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0068-Particle-API.patch b/CraftBukkit-Patches/0061-Particle-API.patch similarity index 69% rename from CraftBukkit-Patches/0068-Particle-API.patch rename to CraftBukkit-Patches/0061-Particle-API.patch index 2bc4811901..837e572219 100644 --- a/CraftBukkit-Patches/0068-Particle-API.patch +++ b/CraftBukkit-Patches/0061-Particle-API.patch @@ -1,4 +1,4 @@ -From d211691429a2f1c0c395f8b517cf3c1e22d6490c Mon Sep 17 00:00:00 2001 +From 46651bf2dc09eff03441027909a51561b2e6a1be Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Fri, 20 Dec 2013 21:36:06 +0000 Subject: [PATCH] Particle API @@ -18,10 +18,10 @@ index 7de0de5..7eca388 100644 datavalue = 0; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 28aa997..53a5d37 100644 +index 84c52d4..260aece 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -810,28 +810,18 @@ public class CraftWorld implements World { +@@ -811,28 +811,18 @@ public class CraftWorld implements World { Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); } @@ -42,7 +42,7 @@ index 28aa997..53a5d37 100644 - Validate.notNull(effect, "Effect cannot be null"); - Validate.notNull(location.getWorld(), "World cannot be null"); - int packetData = effect.getId(); -- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data, false); +- PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), data, false); - int distance; - radius *= radius; - @@ -59,7 +59,7 @@ index 28aa997..53a5d37 100644 } public T spawn(Location location, Class clazz) throws IllegalArgumentException { -@@ -1321,6 +1311,56 @@ public class CraftWorld implements World { +@@ -1331,6 +1321,70 @@ public class CraftWorld implements World { // Spigot start private final Spigot spigot = new Spigot() { @@ -73,20 +73,34 @@ index 28aa997..53a5d37 100644 + if ( effect.getType() != Effect.Type.PARTICLE ) + { + int packetData = effect.getId(); -+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); ++ packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ() ), id, false ); + } else + { -+ StringBuilder particleFullName = new StringBuilder(); -+ particleFullName.append( effect.getName() ); -+ if ( effect.getData() != null && ( effect.getData().equals( org.bukkit.Material.class ) || effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ) ++ net.minecraft.server.EnumParticle particle = null; ++ int[] extra = null; ++ for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) + { -+ particleFullName.append( '_' ).append( id ); ++ if ( effect.getName().startsWith( p.b().replace("_", "") ) ) ++ { ++ particle = p; ++ if ( effect.getData() != null ) ++ { ++ if ( effect.getData().equals( org.bukkit.Material.class ) ) ++ { ++ extra = new int[]{ id }; ++ } else ++ { ++ extra = new int[]{ (id << 4) | data }; ++ } ++ } ++ break; ++ } + } -+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ++ if ( extra == null ) + { -+ particleFullName.append( '_' ).append( data ); ++ extra = new int[0]; + } -+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount ); ++ packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra ); + } + int distance; + radius *= radius; @@ -117,10 +131,10 @@ index 28aa997..53a5d37 100644 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 3eafd75..6960a29 100644 +index 37b8287..fb1347e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1320,6 +1320,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1342,6 +1342,63 @@ public class CraftPlayer extends CraftHumanEntity implements Player { server.getServer().getPlayerList().moveToWorld( getHandle(), 0, false ); } } @@ -135,20 +149,34 @@ index 3eafd75..6960a29 100644 + if ( effect.getType() != Effect.Type.PARTICLE ) + { + int packetData = effect.getId(); -+ packet = new PacketPlayOutWorldEvent( packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, false ); ++ packet = new PacketPlayOutWorldEvent( packetData, new BlockPosition(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 ) ) ) ++ net.minecraft.server.EnumParticle particle = null; ++ int[] extra = null; ++ for ( net.minecraft.server.EnumParticle p : net.minecraft.server.EnumParticle.values() ) + { -+ particleFullName.append( '_' ).append( id ); ++ if ( effect.getName().startsWith( p.b().replace("_", "") ) ) ++ { ++ particle = p; ++ if ( effect.getData() != null ) ++ { ++ if ( effect.getData().equals( org.bukkit.Material.class ) ) ++ { ++ extra = new int[]{ id }; ++ } else ++ { ++ extra = new int[]{ (id << 4) | data }; ++ } ++ } ++ break; ++ } + } -+ if ( effect.getData() != null && effect.getData().equals( org.bukkit.material.MaterialData.class ) ) ++ if ( extra == null ) + { -+ particleFullName.append( '_' ).append( data ); ++ extra = new int[0]; + } -+ packet = new PacketPlayOutWorldParticles( particleFullName.toString(), (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount ); ++ packet = new PacketPlayOutWorldParticles( particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, particleCount, extra ); + } + int distance; + radius *= radius; @@ -171,5 +199,5 @@ index 3eafd75..6960a29 100644 public Player.Spigot spigot() -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0070-Save-ticks-lived-to-nbttag.patch b/CraftBukkit-Patches/0062-Save-ticks-lived-to-nbttag.patch similarity index 74% rename from CraftBukkit-Patches/0070-Save-ticks-lived-to-nbttag.patch rename to CraftBukkit-Patches/0062-Save-ticks-lived-to-nbttag.patch index 931a923dcd..c9af5bced4 100644 --- a/CraftBukkit-Patches/0070-Save-ticks-lived-to-nbttag.patch +++ b/CraftBukkit-Patches/0062-Save-ticks-lived-to-nbttag.patch @@ -1,22 +1,22 @@ -From ce948a25b00c462c1e7385bec95b970e979d016e Mon Sep 17 00:00:00 2001 +From f643aa65e716444ff37db596870b58f9d5d41efe Mon Sep 17 00:00:00 2001 From: DerFlash Date: Tue, 9 Jul 2013 00:11:12 +0200 Subject: [PATCH] Save ticks lived to nbttag diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 85d7665..134e06b 100644 +index afa789f..1755da2 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1123,6 +1123,7 @@ public abstract class Entity { +@@ -1199,6 +1199,7 @@ public abstract class Entity implements ICommandListener { nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits()); nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL); + nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived); // CraftBukkit end - this.b(nbttagcompound); - if (this.vehicle != null) { -@@ -1191,6 +1192,8 @@ public abstract class Entity { + if (this.getCustomName() != null && this.getCustomName().length() > 0) { + nbttagcompound.setString("CustomName", this.getCustomName()); +@@ -1286,6 +1287,8 @@ public abstract class Entity implements ICommandListener { if (this instanceof EntityLiving) { EntityLiving entity = (EntityLiving) this; @@ -26,5 +26,5 @@ index 85d7665..134e06b 100644 if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) { EntityInsentient entityinsentient = (EntityInsentient) entity; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch b/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch new file mode 100644 index 0000000000..e1db6cd40a --- /dev/null +++ b/CraftBukkit-Patches/0063-More-Efficient-GetCubes.patch @@ -0,0 +1,94 @@ +From 5d158e48d9e66e2b9342d9459591075864e45196 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 e0a7160..69e0e78 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1037,33 +1037,60 @@ public abstract class World implements IBlockAccess { + int i1 = MathHelper.floor(axisalignedbb.c); + int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); + +- for (int k1 = i; k1 < j; ++k1) { +- for (int l1 = i1; l1 < j1; ++l1) { +- if (this.isLoaded(new BlockPosition(k1, 64, l1))) { +- for (int i2 = k - 1; i2 < l; ++i2) { +- BlockPosition blockposition = new BlockPosition(k1, i2, l1); +- boolean flag = entity.aS(); +- boolean flag1 = this.a(this.af(), entity); +- +- if (flag && flag1) { +- entity.h(false); +- } else if (!flag && !flag1) { +- entity.h(true); +- } ++ // Spigot start ++ int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 ); ++ for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ ) ++ { ++ int cx = chunkx << 4; ++ for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ ) ++ { ++ if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) ++ { ++ continue; ++ } ++ int cz = chunkz << 4; ++ Chunk chunk = this.getChunkAt( chunkx, chunkz ); ++ // Compute ranges within chunk ++ int xstart = ( i < cx ) ? cx : i; ++ int xend = ( j < ( cx + 16 ) ) ? j : ( cx + 16 ); ++ int zstart = ( i1 < cz ) ? cz : i1; ++ int zend = ( j1 < ( cz + 16 ) ) ? j1 : ( cz + 16 ); ++ // Loop through blocks within chunk ++ for ( int x = xstart; x < xend; x++ ) ++ { ++ for ( int z = zstart; z < zend; z++ ) ++ { ++ for ( int y = ystart; y < l; y++ ) ++ { ++ BlockPosition blockposition = new BlockPosition( x, y, z ); ++ boolean flag = entity.aS(); ++ boolean flag1 = this.a(this.af(), entity); ++ ++ if (flag && flag1) { ++ entity.h(false); ++ } else if (!flag && !flag1) { ++ entity.h(true); ++ } + +- IBlockData iblockdata; ++ IBlockData iblockdata; + +- if (!this.af().a(blockposition) && flag1) { +- iblockdata = Blocks.STONE.getBlockData(); +- } else { +- iblockdata = this.getType(blockposition); ++ IBlockData block; ++ if (!this.af().a(blockposition) && flag1) { ++ block = Blocks.STONE.getBlockData(); ++ } else ++ { ++ block = chunk.getBlockData( blockposition ); ++ } ++ if ( block != null ) ++ { ++ block.getBlock().a(this, blockposition, block, axisalignedbb, arraylist, entity); ++ } + } +- +- iblockdata.getBlock().a(this, blockposition, iblockdata, axisalignedbb, arraylist, entity); + } + } + } + } ++ // Spigot end + + double d0 = 0.25D; + List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0)); +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0072-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch b/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch similarity index 81% rename from CraftBukkit-Patches/0072-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch rename to CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch index 2883a67070..166ccda5dd 100644 --- a/CraftBukkit-Patches/0072-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch +++ b/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch @@ -1,14 +1,14 @@ -From ca384413bc2987e13473c641bdc22681b2e1f033 Mon Sep 17 00:00:00 2001 +From f636b5da615846f11fff67c168a28a5ef34a6b9a Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Feb 2014 16:55:46 +0000 Subject: [PATCH] Add Option to Nerf Mobs from Spawner's diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 134e06b..f1bad28 100644 +index 1755da2..fd7c615 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -119,6 +119,7 @@ public abstract class Entity { +@@ -118,6 +118,7 @@ public abstract class Entity implements ICommandListener { public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = 0; @@ -17,12 +17,12 @@ index 134e06b..f1bad28 100644 // Spigot end diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index a812656..f6c4788 100644 +index a8801f1..02eed74 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -400,6 +400,12 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -450,6 +450,12 @@ public abstract class EntityInsentient extends EntityLiving { this.world.methodProfiler.a("checkDespawn"); - this.w(); + this.D(); this.world.methodProfiler.b(); + // Spigot Start + if ( this.fromMobSpawner ) @@ -31,14 +31,14 @@ index a812656..f6c4788 100644 + } + // Spigot End this.world.methodProfiler.a("sensing"); - this.bq.a(); + this.bi.a(); this.world.methodProfiler.b(); diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index e39d533..2276905 100644 +index 13c7d58..4ff4ece 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -136,6 +136,12 @@ public abstract class MobSpawnerAbstract { - SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); +@@ -139,6 +139,12 @@ public abstract class MobSpawnerAbstract { + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); if (!event.isCancelled()) { entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // Spigot Start @@ -50,10 +50,10 @@ index e39d533..2276905 100644 } // CraftBukkit end } -@@ -181,6 +187,12 @@ public abstract class MobSpawnerAbstract { - SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); +@@ -184,6 +190,12 @@ public abstract class MobSpawnerAbstract { + SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ()); if (!event.isCancelled()) { - this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit + // Spigot Start + if ( entity.world.spigotConfig.nerfSpawnerMobs ) + { @@ -80,5 +80,5 @@ index b8e144d..d7766bb 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0073-Warn-if-PermGen-may-be-insufficient.patch b/CraftBukkit-Patches/0065-Warn-if-PermGen-may-be-insufficient.patch similarity index 96% rename from CraftBukkit-Patches/0073-Warn-if-PermGen-may-be-insufficient.patch rename to CraftBukkit-Patches/0065-Warn-if-PermGen-may-be-insufficient.patch index 76ab1b120f..1fc279c48c 100644 --- a/CraftBukkit-Patches/0073-Warn-if-PermGen-may-be-insufficient.patch +++ b/CraftBukkit-Patches/0065-Warn-if-PermGen-may-be-insufficient.patch @@ -1,4 +1,4 @@ -From cdb840202750bdd696263e71b1cee775fc3736e4 Mon Sep 17 00:00:00 2001 +From ba3cb8a97f86170714630163965e420dd7e3dee9 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 23 Dec 2013 14:07:41 +1100 Subject: [PATCH] Warn if PermGen may be insufficient @@ -32,5 +32,5 @@ index 8d127fb..008e037 100644 MinecraftServer.main(options); } catch (Throwable t) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0074-Disable-Connected-Check-on-setScoreboard.patch b/CraftBukkit-Patches/0066-Disable-Connected-Check-on-setScoreboard.patch similarity index 85% rename from CraftBukkit-Patches/0074-Disable-Connected-Check-on-setScoreboard.patch rename to CraftBukkit-Patches/0066-Disable-Connected-Check-on-setScoreboard.patch index df0b3ecaf0..f66febdd16 100644 --- a/CraftBukkit-Patches/0074-Disable-Connected-Check-on-setScoreboard.patch +++ b/CraftBukkit-Patches/0066-Disable-Connected-Check-on-setScoreboard.patch @@ -1,14 +1,14 @@ -From f3438244059f37f481e98cda5d03ed0137a13764 Mon Sep 17 00:00:00 2001 +From 3492d9f210df06c7fcfa72c04ada822eed1972e5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 23 Dec 2013 15:57:57 +1100 Subject: [PATCH] Disable Connected Check on setScoreboard diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6960a29..5a39069 100644 +index fb1347e..a00d630 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1221,7 +1221,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1239,7 +1239,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { throw new IllegalStateException("Cannot set scoreboard yet"); } if (playerConnection.isDisconnected()) { @@ -18,5 +18,5 @@ index 6960a29..5a39069 100644 this.server.getScoreboardManager().setPlayerBoard(this, scoreboard); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0075-Add-Late-Bind-Option.patch b/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch similarity index 66% rename from CraftBukkit-Patches/0075-Add-Late-Bind-Option.patch rename to CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch index 7a9d1ef31c..bb311ba0f3 100644 --- a/CraftBukkit-Patches/0075-Add-Late-Bind-Option.patch +++ b/CraftBukkit-Patches/0067-Add-Late-Bind-Option.patch @@ -1,4 +1,4 @@ -From a2e57722c92a97ca75229b0e32b2eb663b5fa0d0 Mon Sep 17 00:00:00 2001 +From 9178c98cc3278727839867387c8b3feebe8e4295 Mon Sep 17 00:00:00 2001 From: slide23 Date: Fri, 20 Dec 2013 20:15:33 -0600 Subject: [PATCH] Add Late Bind Option @@ -6,44 +6,45 @@ Subject: [PATCH] Add Late Bind Option Add late-bind config option to delay binding until loading is done. diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 58e68da..6ba9c8c 100644 +index 240c909..ced9efa 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -127,6 +127,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer this.a(MinecraftEncryption.b()); - i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L()); + DedicatedServer.LOGGER.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.Q()); + if (!org.spigotmc.SpigotConfig.lateBind) { try { - this.ai().a(inetaddress, this.L()); + this.ao().a(inetaddress, this.Q()); } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable @@ -135,6 +136,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - i.warn("Perhaps a server is already running on that port?"); + DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); return false; } + } // Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit -@@ -224,6 +226,16 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -225,6 +227,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } // CraftBukkit end + if (org.spigotmc.SpigotConfig.lateBind) { + try { -+ this.ai().a(inetaddress, this.L()); ++ this.ao().a(inetaddress, this.Q()); + } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable -+ i.warn("**** FAILED TO BIND TO PORT!"); -+ i.warn("The exception was: {}", new Object[] { ioexception.toString()}); -+ i.warn("Perhaps a server is already running on that port?"); ++ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); ++ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); ++ DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); + return false; + } + } - return true; - } - } ++ + if (false && this.aQ() > 0L) { // Spigot - disable + Thread thread = new Thread(new ThreadWatchdog(this)); + diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 59ba766..bfe4ec4 100644 +index 865a17f..f3187f8 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -227,4 +227,9 @@ public class SpigotConfig @@ -57,5 +58,5 @@ index 59ba766..bfe4ec4 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0076-Allow-statistics-to-be-disabled-forced.patch b/CraftBukkit-Patches/0068-Allow-statistics-to-be-disabled-forced.patch similarity index 87% rename from CraftBukkit-Patches/0076-Allow-statistics-to-be-disabled-forced.patch rename to CraftBukkit-Patches/0068-Allow-statistics-to-be-disabled-forced.patch index e7699ac191..20d9114c7f 100644 --- a/CraftBukkit-Patches/0076-Allow-statistics-to-be-disabled-forced.patch +++ b/CraftBukkit-Patches/0068-Allow-statistics-to-be-disabled-forced.patch @@ -1,17 +1,17 @@ -From a7a791b523e19b7dedb4cb67e0c833254d33b4ed Mon Sep 17 00:00:00 2001 +From ec81ebb55338e6e7de1dfad123a28235c8926adf Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Tue, 7 Jan 2014 15:56:26 +0000 Subject: [PATCH] Allow statistics to be disabled/forced diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java -index 57a501f..cea31ae 100644 +index 4561825..ff35b43 100644 --- a/src/main/java/net/minecraft/server/ServerStatisticManager.java +++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java -@@ -32,6 +32,14 @@ public class ServerStatisticManager extends StatisticManager { - public ServerStatisticManager(MinecraftServer minecraftserver, File file1) { +@@ -31,6 +31,14 @@ public class ServerStatisticManager extends StatisticManager { + public ServerStatisticManager(MinecraftServer minecraftserver, File file) { this.c = minecraftserver; - this.d = file1; + this.d = file; + // Spigot start + for ( String name : org.spigotmc.SpigotConfig.forcedStats.keySet() ) + { @@ -31,7 +31,7 @@ index 57a501f..cea31ae 100644 try { FileUtils.writeStringToFile(this.d, a(this.a)); } catch (IOException ioexception) { -@@ -56,6 +65,7 @@ public class ServerStatisticManager extends StatisticManager { +@@ -57,6 +66,7 @@ public class ServerStatisticManager extends StatisticManager { } public void setStatistic(EntityHuman entityhuman, Statistic statistic, int i) { @@ -39,15 +39,22 @@ index 57a501f..cea31ae 100644 int j = statistic.d() ? this.getStatisticValue(statistic) : 0; super.setStatistic(entityhuman, statistic, i); +@@ -210,4 +220,4 @@ public class ServerStatisticManager extends StatisticManager { + return this.g; + } + +-} ++} +\ 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 bfe4ec4..47ab784 100644 +index f3187f8..9566cfa 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -10,10 +10,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; -+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; ++import gnu.trove.map.hash.TObjectIntHashMap; import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -89,5 +96,5 @@ index bfe4ec4..47ab784 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0069-Fix-Biome-Decoration-Crashes.patch b/CraftBukkit-Patches/0069-Fix-Biome-Decoration-Crashes.patch deleted file mode 100644 index e09acf5724..0000000000 --- a/CraftBukkit-Patches/0069-Fix-Biome-Decoration-Crashes.patch +++ /dev/null @@ -1,111 +0,0 @@ -From e773d55683c38db68d20b815fe794e30794c5294 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 5 Jan 2014 09:35:01 +1100 -Subject: [PATCH] Fix Biome Decoration Crashes - -We don't really know what affect this will have on the terrain generation, but its better than crashing and not having terrain generate at all! - -diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java -index c5701f6..064a125 100644 ---- a/src/main/java/net/minecraft/server/BiomeDecorator.java -+++ b/src/main/java/net/minecraft/server/BiomeDecorator.java -@@ -147,7 +147,7 @@ public class BiomeDecorator { - for (j = 0; j < this.z; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - WorldGenerator worldgenerator = biomebase.b(this.b); - - worldgenerator.generate(this.a, this.b, k, i1, l); -@@ -156,7 +156,7 @@ public class BiomeDecorator { - for (j = 0; j < this.A; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - (new WorldGenDeadBush(Blocks.DEAD_BUSH)).generate(this.a, this.b, k, i1, l); - } - -@@ -164,7 +164,7 @@ public class BiomeDecorator { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; - -- for (i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { -+ for (i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); i1 > 0 && this.a.isEmpty(k, i1 - 1, l); --i1) { // Spigot - ; - } - -@@ -182,7 +182,7 @@ public class BiomeDecorator { - if (this.b.nextInt(8) == 0) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.r.generate(this.a, this.b, k, i1, l); - } - } -@@ -190,42 +190,42 @@ public class BiomeDecorator { - if (this.b.nextInt(4) == 0) { - j = this.c + this.b.nextInt(16) + 8; - k = this.d + this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot - this.q.generate(this.a, this.b, j, l, k); - } - - if (this.b.nextInt(8) == 0) { - j = this.c + this.b.nextInt(16) + 8; - k = this.d + this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot - this.r.generate(this.a, this.b, j, l, k); - } - - for (j = 0; j < this.C; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.t.generate(this.a, this.b, k, i1, l); - } - - for (j = 0; j < 10; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.t.generate(this.a, this.b, k, i1, l); - } - - if (this.b.nextInt(32) == 0) { - j = this.c + this.b.nextInt(16) + 8; - k = this.d + this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(j, k) * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(j, k) * 2); // Spigot - (new WorldGenPumpkin()).generate(this.a, this.b, j, l, k); - } - - for (j = 0; j < this.D; ++j) { - k = this.c + this.b.nextInt(16) + 8; - l = this.d + this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(k, l) * 2); // Spigot - this.u.generate(this.a, this.b, k, i1, l); - } - -@@ -276,4 +276,11 @@ public class BiomeDecorator { - this.a(1, this.n, 0, 16); - this.b(1, this.o, 16, 16); - } -+ -+ // Spigot Start -+ private int getHighestBlockYAt(int x, int z) -+ { -+ return Math.max( 1, this.a.getHighestBlockYAt( x, z ) ); -+ } -+ // Spigot End - } --- -1.9.1 - diff --git a/CraftBukkit-Patches/0078-Fix-ItemStack-Unbreakable-Code.patch b/CraftBukkit-Patches/0069-Fix-ItemStack-Unbreakable-Code.patch similarity index 65% rename from CraftBukkit-Patches/0078-Fix-ItemStack-Unbreakable-Code.patch rename to CraftBukkit-Patches/0069-Fix-ItemStack-Unbreakable-Code.patch index 0c0a173732..a794d044d1 100644 --- a/CraftBukkit-Patches/0078-Fix-ItemStack-Unbreakable-Code.patch +++ b/CraftBukkit-Patches/0069-Fix-ItemStack-Unbreakable-Code.patch @@ -1,18 +1,18 @@ -From 6223c0d12d2aa4091dc208df10b02a860078dbf0 Mon Sep 17 00:00:00 2001 +From 5ca384fbadcd22850b93749fdac40df57fd75b54 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 10 Jan 2014 15:15:50 +1100 Subject: [PATCH] Fix ItemStack Unbreakable Code diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index a2ab06a..7d2d401 100644 +index 204ae01..a00c3f4 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -228,7 +228,13 @@ public final class ItemStack { +@@ -252,7 +252,13 @@ public final class ItemStack { } - public boolean g() { -- return this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable"); + public boolean e() { +- return this.item == null ? false : (this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable")); + // Spigot Start + if ( this.item.getMaxDurability() <= 0 ) + { @@ -24,5 +24,5 @@ index a2ab06a..7d2d401 100644 public boolean usesData() { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0079-Try-and-Debug-Crash-Reports-Crashing.patch b/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch similarity index 77% rename from CraftBukkit-Patches/0079-Try-and-Debug-Crash-Reports-Crashing.patch rename to CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch index 2b645098e6..e3bc7b727d 100644 --- a/CraftBukkit-Patches/0079-Try-and-Debug-Crash-Reports-Crashing.patch +++ b/CraftBukkit-Patches/0070-Try-and-Debug-Crash-Reports-Crashing.patch @@ -1,20 +1,20 @@ -From 989e873c1c02b1b3a8566c9d5b61812bc8277d58 Mon Sep 17 00:00:00 2001 +From 4a3318d2891f8a8b28fc9dae6714ab0495291016 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 12 Jan 2014 20:56:41 +1100 Subject: [PATCH] Try and Debug Crash Reports Crashing diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6a31aaa..28471d6 100644 +index bd79bea..b686a49 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -664,7 +664,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -717,7 +717,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs worldserver.doTick(); worldserver.timings.doTick.stopTiming(); // Spigot - } catch (Throwable throwable) { + } catch (Throwable throwable1) { + // Spigot Start + try { - crashreport = CrashReport.a(throwable, "Exception ticking world"); + crashreport = CrashReport.a(throwable1, "Exception ticking world"); + } catch (Throwable t){ + throw new RuntimeException("Error generating crash report", t); + } @@ -22,13 +22,13 @@ index 6a31aaa..28471d6 100644 worldserver.a(crashreport); throw new ReportedException(crashreport); } -@@ -674,7 +680,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -727,7 +733,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs worldserver.tickEntities(); worldserver.timings.tickEntities.stopTiming(); // Spigot - } catch (Throwable throwable1) { + } catch (Throwable throwable2) { + // Spigot Start + try { - crashreport = CrashReport.a(throwable1, "Exception ticking world entities"); + crashreport = CrashReport.a(throwable2, "Exception ticking world entities"); + } catch (Throwable t){ + throw new RuntimeException("Error generating crash report", t); + } @@ -37,5 +37,5 @@ index 6a31aaa..28471d6 100644 throw new ReportedException(crashreport); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0071-More-Efficient-GetCubes.patch b/CraftBukkit-Patches/0071-More-Efficient-GetCubes.patch deleted file mode 100644 index 4cb4ef235c..0000000000 --- a/CraftBukkit-Patches/0071-More-Efficient-GetCubes.patch +++ /dev/null @@ -1,68 +0,0 @@ -From fab1432cc005200e3b0310969985bc7da82c6d10 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 c7c33b0..66db74d 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1139,23 +1139,42 @@ public abstract class World implements IBlockAccess { - int i1 = MathHelper.floor(axisalignedbb.c); - int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); - -- for (int k1 = i; k1 < j; ++k1) { -- for (int l1 = i1; l1 < j1; ++l1) { -- if (this.isLoaded(k1, 64, l1)) { -- for (int i2 = k - 1; i2 < l; ++i2) { -- Block block; -- -- 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++ ) -+ { -+ int cx = chunkx << 4; -+ for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ ) -+ { -+ if ( !this.isChunkLoaded( chunkx, chunkz ) ) -+ { -+ continue; -+ } -+ int cz = chunkz << 4; -+ Chunk chunk = this.getChunkAt( chunkx, chunkz ); -+ // Compute ranges within chunk -+ int xstart = ( i < cx ) ? cx : i; -+ int xend = ( j < ( cx + 16 ) ) ? j : ( cx + 16 ); -+ int zstart = ( i1 < cz ) ? cz : i1; -+ int zend = ( j1 < ( cz + 16 ) ) ? j1 : ( cz + 16 ); -+ // Loop through blocks within chunk -+ for ( int x = xstart; x < xend; x++ ) -+ { -+ for ( int z = zstart; z < zend; z++ ) -+ { -+ for ( int y = ystart; y < l; y++ ) -+ { -+ Block block = chunk.getType(x - cx, y, z - cz ); -+ if ( block != null ) -+ { -+ block.a( this, x, y, z, axisalignedbb, this.L, entity ); -+ } - } -- -- block.a(this, k1, i2, l1, axisalignedbb, this.L, entity); - } - } - } - } -+ // Spigot end - - double d0 = 0.25D; - List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0)); --- -1.9.1 - diff --git a/CraftBukkit-Patches/0080-Replace-AutoSave-Mechanism.patch b/CraftBukkit-Patches/0071-Replace-AutoSave-Mechanism.patch similarity index 86% rename from CraftBukkit-Patches/0080-Replace-AutoSave-Mechanism.patch rename to CraftBukkit-Patches/0071-Replace-AutoSave-Mechanism.patch index 6e40daa9ec..c7e33c4382 100644 --- a/CraftBukkit-Patches/0080-Replace-AutoSave-Mechanism.patch +++ b/CraftBukkit-Patches/0071-Replace-AutoSave-Mechanism.patch @@ -1,4 +1,4 @@ -From dc7ce44f000f973825590134b7c03b3fe7e33440 Mon Sep 17 00:00:00 2001 +From 2a40e42c5a2306b047bc3b6d913aac81f51210a2 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 12 Jan 2014 21:07:18 +1100 Subject: [PATCH] Replace AutoSave Mechanism @@ -6,13 +6,13 @@ Subject: [PATCH] Replace AutoSave Mechanism The problem here is that MinecraftServer.save(..), will attempt to sleep whilst all pending chunks are written to disk, however due to various and complicated bugs, it will wait for an incorrect amount of chunks, which may cause it to sleep for an overly long amount of time. Instead we will mimic the save-all command in its behaviour, which is both safe and performant. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 28471d6..8ff8d9f 100644 +index b686a49..5c7a9c6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -583,7 +583,16 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -625,7 +625,16 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); - this.u.savePlayers(); + this.v.savePlayers(); - this.saveChunks(true); + // Spigot Start + // We replace this with saving each individual world as this.saveChunks(...) is broken, @@ -28,5 +28,5 @@ index 28471d6..8ff8d9f 100644 SpigotTimings.worldSaveTimer.stopTiming(); // Spigot } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0082-Support-vanilla-s-direction-tag-on-fireballs.patch b/CraftBukkit-Patches/0072-Support-vanilla-s-direction-tag-on-fireballs.patch similarity index 85% rename from CraftBukkit-Patches/0082-Support-vanilla-s-direction-tag-on-fireballs.patch rename to CraftBukkit-Patches/0072-Support-vanilla-s-direction-tag-on-fireballs.patch index f0b12c7ddd..accfc2da25 100644 --- a/CraftBukkit-Patches/0082-Support-vanilla-s-direction-tag-on-fireballs.patch +++ b/CraftBukkit-Patches/0072-Support-vanilla-s-direction-tag-on-fireballs.patch @@ -1,14 +1,14 @@ -From dfedeeceb83c15c73c6295765a0a1c80d76798df Mon Sep 17 00:00:00 2001 +From d5275a1b06907c466dfc778a7f0f216d2e0a7254 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 18 Jan 2014 14:27:03 +0000 Subject: [PATCH] Support vanilla's direction tag on fireballs diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java -index 02d90aa..663714d 100644 +index 31af702..6f2b506 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java -@@ -199,6 +199,8 @@ public abstract class EntityFireball extends Entity { +@@ -200,6 +200,8 @@ public abstract class EntityFireball extends Entity { nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0)); // CraftBukkit - Fix direction being mismapped to invalid variables nbttagcompound.set("power", this.a(new double[] { this.dirX, this.dirY, this.dirZ})); @@ -17,7 +17,7 @@ index 02d90aa..663714d 100644 } public void a(NBTTagCompound nbttagcompound) { -@@ -215,6 +217,13 @@ public abstract class EntityFireball extends Entity { +@@ -221,6 +223,13 @@ public abstract class EntityFireball extends Entity { this.dirY = nbttaglist.d(1); this.dirZ = nbttaglist.d(2); // CraftBukkit end @@ -32,5 +32,5 @@ index 02d90aa..663714d 100644 this.die(); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0083-Support-non-prefixed-URLs.patch b/CraftBukkit-Patches/0073-Support-non-prefixed-URLs.patch similarity index 88% rename from CraftBukkit-Patches/0083-Support-non-prefixed-URLs.patch rename to CraftBukkit-Patches/0073-Support-non-prefixed-URLs.patch index 7a9faabbc8..7f4600c4e5 100644 --- a/CraftBukkit-Patches/0083-Support-non-prefixed-URLs.patch +++ b/CraftBukkit-Patches/0073-Support-non-prefixed-URLs.patch @@ -1,11 +1,11 @@ -From c025c5caed701fead870e2b1b71c8960156fff67 Mon Sep 17 00:00:00 2001 +From e59ebaf9c574922bc89e5a7edc25e32a5515af63 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 18 Jan 2014 19:32:42 +0000 Subject: [PATCH] Support non-prefixed URLs diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java -index 256f053..6491b10 100644 +index b7b9c81..42f074b 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java @@ -19,7 +19,7 @@ import com.google.common.collect.ImmutableMap.Builder; @@ -17,8 +17,8 @@ index 256f053..6491b10 100644 static { Builder builder = ImmutableMap.builder(); -@@ -85,6 +85,9 @@ public final class CraftChatMessage { - currentChatComponent = null; +@@ -89,6 +89,9 @@ public final class CraftChatMessage { + } break; case 3: + if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) { @@ -27,7 +27,7 @@ index 256f053..6491b10 100644 modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match)); appendNewComponent(matcher.end(groupId)); modifier.setChatClickable((ChatClickable) null); -@@ -96,7 +99,7 @@ public final class CraftChatMessage { +@@ -100,7 +103,7 @@ public final class CraftChatMessage { appendNewComponent(message.length()); } @@ -37,5 +37,5 @@ index 256f053..6491b10 100644 private void appendNewComponent(int index) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0084-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch b/CraftBukkit-Patches/0074-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch similarity index 71% rename from CraftBukkit-Patches/0084-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch rename to CraftBukkit-Patches/0074-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch index 58df7cc11b..603ea3550c 100644 --- a/CraftBukkit-Patches/0084-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch +++ b/CraftBukkit-Patches/0074-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch @@ -1,33 +1,33 @@ -From 589841bcd0393917f91f7f3754aa21f02d624ee2 Mon Sep 17 00:00:00 2001 +From 7516ef8151a06ceb3384927015bed5197eda10ed Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 20 Jan 2014 13:44:07 +1100 Subject: [PATCH] Catch stalling on corrupted map data / NBT arrays. diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java -index 3eeed3e..78a1b9a 100644 +index 7525469..7a293eb 100644 --- a/src/main/java/net/minecraft/server/NBTTagByteArray.java +++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java -@@ -22,6 +22,7 @@ public class NBTTagByteArray extends NBTBase { +@@ -21,6 +21,7 @@ public class NBTTagByteArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { + void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { int j = datainput.readInt(); -+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); ++ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); nbtreadlimiter.a((long) (8 * j)); this.data = new byte[j]; diff --git a/src/main/java/net/minecraft/server/NBTTagIntArray.java b/src/main/java/net/minecraft/server/NBTTagIntArray.java -index c7cea7f..099e16a 100644 +index f331ef3..17b0c3d 100644 --- a/src/main/java/net/minecraft/server/NBTTagIntArray.java +++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java @@ -25,6 +25,7 @@ public class NBTTagIntArray extends NBTBase { - void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { + void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException { int j = datainput.readInt(); -+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); ++ com.google.common.base.Preconditions.checkArgument( j < 1 << 24); nbtreadlimiter.a((long) (32 * j)); this.data = new int[j]; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0085-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch b/CraftBukkit-Patches/0075-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch similarity index 70% rename from CraftBukkit-Patches/0085-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch rename to CraftBukkit-Patches/0075-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch index 7b1e02b02a..60a121fbbe 100644 --- a/CraftBukkit-Patches/0085-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch +++ b/CraftBukkit-Patches/0075-Allow-toggling-of-ZombiePigmen-spawning-in-portal-bl.patch @@ -1,22 +1,22 @@ -From 8918932f19329e049f824f9d2a227b2b11632be2 Mon Sep 17 00:00:00 2001 +From ce7f8fb7367be24f48b4c73d53a0b816baeb1db2 Mon Sep 17 00:00:00 2001 From: Dmck2b Date: Mon, 20 Jan 2014 20:18:23 +0000 Subject: [PATCH] Allow toggling of ZombiePigmen spawning in portal blocks diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java -index bec5aa8..222e3ac 100644 +index 7565dfb..368d67c 100644 --- a/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java -@@ -15,7 +15,7 @@ public class BlockPortal extends BlockHalfTransparent { +@@ -16,7 +16,7 @@ public class BlockPortal extends BlockHalfTransparent { - public void a(World world, int i, int j, int k, Random random) { - super.a(world, i, j, k, random); -- if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) { -+ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) { // Spigot - int l; + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + super.b(world, blockposition, iblockdata, random); +- if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) { ++ if (world.spigotConfig.enableZombiePigmenPortalSpawns && world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.getDifficulty().a()) { // Spigot + int i = blockposition.getY(); - for (l = j; !World.a((IBlockAccess) world, i, l, k) && l > 0; --l) { + BlockPosition blockposition1; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index d7766bb..5c1d59c 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -34,5 +34,5 @@ index d7766bb..5c1d59c 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0086-Highly-Optimized-Tick-Loop.patch b/CraftBukkit-Patches/0076-Highly-Optimized-Tick-Loop.patch similarity index 72% rename from CraftBukkit-Patches/0086-Highly-Optimized-Tick-Loop.patch rename to CraftBukkit-Patches/0076-Highly-Optimized-Tick-Loop.patch index e48bc24d72..831c2006fd 100644 --- a/CraftBukkit-Patches/0086-Highly-Optimized-Tick-Loop.patch +++ b/CraftBukkit-Patches/0076-Highly-Optimized-Tick-Loop.patch @@ -1,14 +1,14 @@ -From 8672c31667188f55f2ea3c1bb79eaf53be53fdf0 Mon Sep 17 00:00:00 2001 +From 4deaf7e75e99e1038f7a93d09274226dacf52fcc Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 25 Jan 2014 14:08:35 +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 8ff8d9f..4c9c3a8 100644 +index 5c7a9c6..7749d9f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -107,6 +107,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -118,6 +118,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; // CraftBukkit end @@ -19,9 +19,9 @@ index 8ff8d9f..4c9c3a8 100644 + public final double[] recentTps = new double[ 3 ]; + // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet - this.X = new UserCache(this, a); -@@ -432,6 +438,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + this.d = proxy; +@@ -471,6 +477,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.isRunning = false; } @@ -35,27 +35,27 @@ index 8ff8d9f..4c9c3a8 100644 public void run() { try { if (this.init()) { -@@ -442,38 +455,34 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - this.q.setServerInfo(new ServerPingServerData("1.7.10", 5)); - this.a(this.q); +@@ -481,38 +494,34 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.r.setServerInfo(new ServerPingServerData("1.8", 47)); + this.a(this.r); + // Spigot start + Arrays.fill( recentTps, 20 ); + long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; while (this.isRunning) { -- long k = ar(); -- long l = k - i; +- long j = ax(); +- long k = j - this.ab; - -- if (l > 2000L && i - this.P >= 15000L) { -- if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages -- MinecraftServer.i.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.P = i; +- if (k > 2000L && this.ab - this.R >= 15000L) { +- if (server.getWarnOnOverload()) // CraftBukkit +- MinecraftServer.LOGGER.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(k), Long.valueOf(k / 50L)}); +- k = 2000L; +- this.R = this.ab; - } - -- if (l < 0L) { -- MinecraftServer.i.warn("Time ran backwards! Did the system time change?"); -- l = 0L; +- if (k < 0L) { +- MinecraftServer.LOGGER.warn("Time ran backwards! Did the system time change?"); +- k = 0L; + curTime = System.nanoTime(); + wait = TICK_TIME - (curTime - lastTick) - catchupTime; + if (wait > 0) { @@ -66,16 +66,16 @@ index 8ff8d9f..4c9c3a8 100644 + catchupTime = Math.min(1000000000, Math.abs(wait)); } -- j += l; -- i = k; +- i += k; +- this.ab = j; - if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit -- this.u(); -- j = 0L; +- this.y(); +- i = 0L; - } else { -- while (j > 50L) { +- while (i > 50L) { - MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit -- j -= 50L; -- this.u(); +- i -= 50L; +- this.y(); - } + if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + { @@ -87,16 +87,16 @@ index 8ff8d9f..4c9c3a8 100644 } + lastTick = curTime; -- Thread.sleep(Math.max(1L, 50L - j)); -+ this.u(); - this.O = true; +- Thread.sleep(Math.max(1L, 50L - i)); ++ this.y(); + this.Q = true; } + // Spigot end } else { this.a((CrashReport) null); } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 47ab784..2bc1a32 100644 +index 9566cfa..345a49c 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -261,4 +261,9 @@ public class SpigotConfig @@ -111,7 +111,7 @@ index 47ab784..2bc1a32 100644 } diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java new file mode 100644 -index 0000000..2b8343d +index 0000000..be2e31d --- /dev/null +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java @@ -0,0 +1,45 @@ @@ -119,7 +119,7 @@ index 0000000..2b8343d + +import com.google.common.base.Joiner; +import net.minecraft.server.MinecraftServer; -+import net.minecraft.util.com.google.common.collect.Iterables; ++import com.google.common.collect.Iterables; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; @@ -161,5 +161,5 @@ index 0000000..2b8343d + } +} -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0087-Add-Spigot-Links.patch b/CraftBukkit-Patches/0077-Add-Spigot-Links.patch similarity index 97% rename from CraftBukkit-Patches/0087-Add-Spigot-Links.patch rename to CraftBukkit-Patches/0077-Add-Spigot-Links.patch index 6ad3bc1fd1..9751bb750f 100644 --- a/CraftBukkit-Patches/0087-Add-Spigot-Links.patch +++ b/CraftBukkit-Patches/0077-Add-Spigot-Links.patch @@ -1,4 +1,4 @@ -From f757f86bb893ec98ba752215c7d86503888ee3f1 Mon Sep 17 00:00:00 2001 +From 2757957ab4f50400475cbd19145b9b6fd40a974e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 23 Jan 2014 13:17:35 +1100 Subject: [PATCH] Add Spigot Links @@ -75,5 +75,5 @@ index 0a5d414..d6bcf5c 100644 command-block-overrides: [] aliases: -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0077-Fix-anvil-collisions.patch b/CraftBukkit-Patches/0077-Fix-anvil-collisions.patch deleted file mode 100644 index 369a887b8c..0000000000 --- a/CraftBukkit-Patches/0077-Fix-anvil-collisions.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 192c8529f2843ae0d149fb5f576892dedc3d61d2 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 9 Jan 2014 14:19:12 +0000 -Subject: [PATCH] Fix anvil collisions - - -diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java -index 9e1ce2f..1fa14c5 100644 ---- a/src/main/java/net/minecraft/server/BlockAnvil.java -+++ b/src/main/java/net/minecraft/server/BlockAnvil.java -@@ -11,6 +11,15 @@ public class BlockAnvil extends BlockFalling { - this.a(CreativeModeTab.c); - } - -+ // Spigot start -+ @Override -+ public AxisAlignedBB a( World world, int i, int j, int k ) -+ { -+ updateShape( world, i, j, k ); -+ return super.a( world, i, j, k ); -+ } -+ // Spigot end -+ - public boolean d() { - return false; - } --- -1.9.1 - diff --git a/CraftBukkit-Patches/0088-Configurable-Ping-Sample-Size.patch b/CraftBukkit-Patches/0078-Configurable-Ping-Sample-Size.patch similarity index 89% rename from CraftBukkit-Patches/0088-Configurable-Ping-Sample-Size.patch rename to CraftBukkit-Patches/0078-Configurable-Ping-Sample-Size.patch index 50cf1a8015..5535a60e42 100644 --- a/CraftBukkit-Patches/0088-Configurable-Ping-Sample-Size.patch +++ b/CraftBukkit-Patches/0078-Configurable-Ping-Sample-Size.patch @@ -1,14 +1,14 @@ -From f47dede2b93add1689c2a5f1485463f108baf5e0 Mon Sep 17 00:00:00 2001 +From c11f7939c995beea9ecbae1ed4c4dba437e31474 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 26 Jan 2014 21:48:34 +1100 Subject: [PATCH] Configurable Ping Sample Size diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index cd06305..6423aec 100644 +index 22749e7..8327d0c 100644 --- a/src/main/java/net/minecraft/server/PacketStatusListener.java +++ b/src/main/java/net/minecraft/server/PacketStatusListener.java -@@ -110,6 +110,13 @@ public class PacketStatusListener implements PacketStatusInListener { +@@ -100,6 +100,13 @@ public class PacketStatusListener implements PacketStatusInListener { } ServerPingPlayerSample playerSample = new ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); @@ -23,7 +23,7 @@ index cd06305..6423aec 100644 ServerPing ping = new ServerPing(); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 2bc1a32..4ae5640 100644 +index 345a49c..a0d88ec 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -266,4 +266,11 @@ public class SpigotConfig @@ -39,5 +39,5 @@ index 2bc1a32..4ae5640 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0089-Add-Optional-Tick-Shuffling.patch b/CraftBukkit-Patches/0079-Add-Optional-Tick-Shuffling.patch similarity index 81% rename from CraftBukkit-Patches/0089-Add-Optional-Tick-Shuffling.patch rename to CraftBukkit-Patches/0079-Add-Optional-Tick-Shuffling.patch index 4e616d8587..442a74bdff 100644 --- a/CraftBukkit-Patches/0089-Add-Optional-Tick-Shuffling.patch +++ b/CraftBukkit-Patches/0079-Add-Optional-Tick-Shuffling.patch @@ -1,4 +1,4 @@ -From bb3bcc39952d1d44d50321201256c03b657c3184 Mon Sep 17 00:00:00 2001 +From 0fff2861e9df1d5ab914b98475c98e8ac12e6de1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 27 Jan 2014 08:39:26 +1100 Subject: [PATCH] Add Optional Tick Shuffling @@ -6,25 +6,25 @@ Subject: [PATCH] Add Optional Tick Shuffling This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order. diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index c2194af..1d7b814 100644 +index 6508fdf..6c6ffa7 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -53,6 +53,13 @@ public class ServerConnection { - List list = this.f; +@@ -57,6 +57,13 @@ public class ServerConnection { + List list = this.g; - synchronized (this.f) { + synchronized (this.g) { + // Spigot Start + // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order + if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 ) + { -+ Collections.shuffle( this.f ); ++ Collections.shuffle( this.g ); + } + // Spigot End - Iterator iterator = this.f.iterator(); + Iterator iterator = this.g.iterator(); while (iterator.hasNext()) { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 4ae5640..153fb4f 100644 +index a0d88ec..f19d415 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -273,4 +273,10 @@ public class SpigotConfig @@ -39,5 +39,5 @@ index 4ae5640..153fb4f 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0090-Allow-Configuring-Chunks-per-Packet.patch b/CraftBukkit-Patches/0080-Allow-Configuring-Chunks-per-Packet.patch similarity index 79% rename from CraftBukkit-Patches/0090-Allow-Configuring-Chunks-per-Packet.patch rename to CraftBukkit-Patches/0080-Allow-Configuring-Chunks-per-Packet.patch index 903af3a92b..5e0c790aec 100644 --- a/CraftBukkit-Patches/0090-Allow-Configuring-Chunks-per-Packet.patch +++ b/CraftBukkit-Patches/0080-Allow-Configuring-Chunks-per-Packet.patch @@ -1,24 +1,24 @@ -From 7aba6388fe2d5d9978d89ff92bd7ff6e913c359f Mon Sep 17 00:00:00 2001 +From bc1a7637538a13c614c833c079e2cbf296231994 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 28 Jan 2014 20:35:35 +1100 Subject: [PATCH] Allow Configuring Chunks per Packet diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 46aa10e..7eb66ea 100644 +index 4e0db00..6665502 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -214,7 +214,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -220,7 +220,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { Chunk chunk; -- while (iterator1.hasNext() && arraylist.size() < PacketPlayOutMapChunkBulk.c()) { +- while (iterator1.hasNext() && arraylist.size() < 10) { + while (iterator1.hasNext() && arraylist.size() < this.world.spigotConfig.maxBulkChunk) { // Spigot ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next(); if (chunkcoordintpair != null) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 5c1d59c..744e1be 100644 +index 5c1d59c..93ab1c1 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -266,4 +266,11 @@ public class SpigotWorldConfig @@ -29,10 +29,10 @@ index 5c1d59c..744e1be 100644 + public int maxBulkChunk; + private void bulkChunkCount() + { -+ maxBulkChunk = getInt( "max-bulk-chunks", 5 ); ++ maxBulkChunk = getInt( "max-bulk-chunks", 10 ); + log( "Sending up to " + maxBulkChunk + " chunks per packet" ); + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0081-Block-data-values-that-crash-the-client.patch b/CraftBukkit-Patches/0081-Block-data-values-that-crash-the-client.patch deleted file mode 100644 index 4c780d98c1..0000000000 --- a/CraftBukkit-Patches/0081-Block-data-values-that-crash-the-client.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 997afb5aad670c728af441e671881a5d72a76a3c Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Wed, 15 Jan 2014 21:52:47 +0000 -Subject: [PATCH] Block data values that crash the client - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b1213f0..cbcc9e9 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -143,7 +143,7 @@ public class Chunk { - } - - this.sections[l1].setTypeId(l, j1 & 15, i1, block); -- this.sections[l1].setData(l, j1 & 15, i1, abyte[k1]); -+ this.sections[l1].setData(l, j1 & 15, i1, checkData( block, abyte[k1] ) ); - } - } - } -@@ -426,6 +426,17 @@ public class Chunk { - } - } - -+ // Spigot start - prevent invalid data values -+ public static int checkData( Block block, int data ) -+ { -+ if (block == Blocks.DOUBLE_PLANT ) -+ { -+ return data < 6 || data >= 8 ? data : 0; -+ } -+ return data; -+ } -+ // Spigot end -+ - public boolean a(int i, int j, int k, Block block, int l) { - int i1 = k << 4 | i; - -@@ -480,7 +491,7 @@ public class Chunk { - if (chunksection.getTypeId(i, j & 15, k) != block) { - return false; - } else { -- chunksection.setData(i, j & 15, k, l); -+ chunksection.setData(i, j & 15, k, checkData( block, l ) ); - if (flag) { - this.initLighting(); - } else { -@@ -545,8 +556,9 @@ public class Chunk { - return false; - } else { - this.n = true; -- chunksection.setData(i, j & 15, k, l); -- if (chunksection.getTypeId(i, j & 15, k) instanceof IContainer) { -+ Block block = chunksection.getTypeId( i, j & 15, k ); -+ chunksection.setData(i, j & 15, k, checkData( block, l ) ); -+ if (block instanceof IContainer) { - TileEntity tileentity = this.e(i, j, k); - - if (tileentity != null) { --- -1.9.1 - diff --git a/CraftBukkit-Patches/0091-Implement-Locale-Getter-for-Players.patch b/CraftBukkit-Patches/0081-Implement-Locale-Getter-for-Players.patch similarity index 79% rename from CraftBukkit-Patches/0091-Implement-Locale-Getter-for-Players.patch rename to CraftBukkit-Patches/0081-Implement-Locale-Getter-for-Players.patch index accf36fe09..76f582357e 100644 --- a/CraftBukkit-Patches/0091-Implement-Locale-Getter-for-Players.patch +++ b/CraftBukkit-Patches/0081-Implement-Locale-Getter-for-Players.patch @@ -1,27 +1,27 @@ -From 942c17e940e5eaf6d2e2e27cece7206848a1842d Mon Sep 17 00:00:00 2001 +From 513e8be75d433d8efcb799148b4ced24e5a933fc Mon Sep 17 00:00:00 2001 From: Smove Date: Sat, 1 Feb 2014 18:12:16 +1100 Subject: [PATCH] Implement Locale Getter for Players diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 7eb66ea..a48a1c0 100644 +index 5578300..67230f6 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -30,7 +30,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +@@ -27,7 +27,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class EntityPlayer extends EntityHuman implements ICrafting { - private static final Logger bL = LogManager.getLogger(); + private static final Logger bF = LogManager.getLogger(); - private String locale = "en_US"; + public String locale = "en_US"; // Spigot public PlayerConnection playerConnection; public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5a39069..3ef8662 100644 +index a00d630..9d609c2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1363,6 +1363,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1399,6 +1399,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getHandle().playerConnection.sendPacket( packet ); } } @@ -35,5 +35,5 @@ index 5a39069..3ef8662 100644 public Player.Spigot spigot() -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0092-Cap-Entity-Collisions.patch b/CraftBukkit-Patches/0082-Cap-Entity-Collisions.patch similarity index 71% rename from CraftBukkit-Patches/0092-Cap-Entity-Collisions.patch rename to CraftBukkit-Patches/0082-Cap-Entity-Collisions.patch index 1ab9449f66..c09dc64054 100644 --- a/CraftBukkit-Patches/0092-Cap-Entity-Collisions.patch +++ b/CraftBukkit-Patches/0082-Cap-Entity-Collisions.patch @@ -1,4 +1,4 @@ -From 319e6906198df64c15fa207fe467615d63f650fc Mon Sep 17 00:00:00 2001 +From 228ece2e9442e9f318bbfc5fc33262d1f0192f3a Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 31 Jan 2014 11:18:34 -0500 Subject: [PATCH] Cap Entity Collisions @@ -7,50 +7,50 @@ Limit a single entity to colliding a max of configurable times per tick. This will alleviate issues where living entities are hoarded in 1x1 pens. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f1bad28..b258f15 100644 +index fd7c615..d6c8be8 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1012,6 +1012,7 @@ public abstract class Entity { +@@ -1060,6 +1060,7 @@ public abstract class Entity implements ICommandListener { - public void b_(EntityHuman entityhuman) {} + public void d(EntityHuman entityhuman) {} + int numCollisions = 0; // Spigot public void collide(Entity entity) { if (entity.passenger != this && entity.vehicle != this) { - double d0 = entity.locX - this.locX; + if (!entity.T && !this.T) { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 859e91f..546b952 100644 +index 6358f5e..9604034 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1597,7 +1597,9 @@ public abstract class EntityLiving extends Entity { - List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); +@@ -1617,7 +1617,9 @@ public abstract class EntityLiving extends Entity { + List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); - if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition + if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition + numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot for (int i = 0; i < list.size(); ++i) { + if (numCollisions > world.spigotConfig.maxCollisionsPerEntity) { break; } // Spigot Entity entity = (Entity) list.get(i); - + // TODO better check now? -@@ -1608,9 +1610,12 @@ public abstract class EntityLiving extends Entity { +@@ -1628,9 +1630,12 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end - if (entity.S()) { + if (entity.ae()) { + entity.numCollisions++; // Spigot + numCollisions++; // Spigot - this.o(entity); + this.s(entity); } } + numCollisions = 0; // Spigot } - } + } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 744e1be..9745982 100644 +index 93ab1c1..71f772c 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -273,4 +273,11 @@ public class SpigotWorldConfig - maxBulkChunk = getInt( "max-bulk-chunks", 5 ); + maxBulkChunk = getInt( "max-bulk-chunks", 10 ); log( "Sending up to " + maxBulkChunk + " chunks per packet" ); } + @@ -62,5 +62,5 @@ index 744e1be..9745982 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0093-Fix-dispensing-bone-meal-not-having-the-correct-data.patch b/CraftBukkit-Patches/0083-Fix-dispensing-bone-meal-not-having-the-correct-data.patch similarity index 72% rename from CraftBukkit-Patches/0093-Fix-dispensing-bone-meal-not-having-the-correct-data.patch rename to CraftBukkit-Patches/0083-Fix-dispensing-bone-meal-not-having-the-correct-data.patch index e070700129..75cec0de5f 100644 --- a/CraftBukkit-Patches/0093-Fix-dispensing-bone-meal-not-having-the-correct-data.patch +++ b/CraftBukkit-Patches/0083-Fix-dispensing-bone-meal-not-having-the-correct-data.patch @@ -1,22 +1,22 @@ -From 537e781342c1a9ec60a1f9ee291f1cf5f4c817ba Mon Sep 17 00:00:00 2001 +From 0abdde40f3c86120fdece2f96f4abee4b5e283de Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Thu, 6 Feb 2014 21:59:20 +0000 Subject: [PATCH] Fix dispensing bone meal not having the correct data value diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java -index b547bc9..c06e9a1 100644 +index 1fb976c..b0ecb35 100644 --- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java +++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java -@@ -21,7 +21,7 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem { - +@@ -18,7 +18,7 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem { + // CraftBukkit start - org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); - CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); // Spigot BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); if (!BlockDispenser.eventFired) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0094-Spam-Filter-Exclusions.patch b/CraftBukkit-Patches/0084-Spam-Filter-Exclusions.patch similarity index 85% rename from CraftBukkit-Patches/0094-Spam-Filter-Exclusions.patch rename to CraftBukkit-Patches/0084-Spam-Filter-Exclusions.patch index 34129876a6..c24d1049a3 100644 --- a/CraftBukkit-Patches/0094-Spam-Filter-Exclusions.patch +++ b/CraftBukkit-Patches/0084-Spam-Filter-Exclusions.patch @@ -1,18 +1,18 @@ -From 0ed3b8b7b11122fe6edf9d5600de9f08767b75b4 Mon Sep 17 00:00:00 2001 +From faa2df863c36e6606e4aed1cd60e379bc85e9832 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 8 Feb 2014 08:13:40 +0000 Subject: [PATCH] Spam Filter Exclusions diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index c833842..daa524f 100644 +index 310ab0c..393831b 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -850,9 +850,19 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -940,9 +940,20 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false); } -+ // Spigot - spam exclusions ++ // Spigot start - spam exclusions + boolean counted = true; + for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions ) + { @@ -22,15 +22,16 @@ index c833842..daa524f 100644 + break; + } + } ++ // Spigot end // CraftBukkit start - replaced with thread safe throttle // this.chatThrottle += 20; - if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { - if (packetplayinchat.a()) { ++ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { // Spigot + if (!isSync) { Waitable waitable = new Waitable() { @Override diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 153fb4f..ff86680 100644 +index f19d415..8419c28 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -6,6 +6,7 @@ import java.io.IOException; @@ -56,5 +57,5 @@ index 153fb4f..ff86680 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0095-Add-Option-to-Silence-CommandBlock-Console.patch b/CraftBukkit-Patches/0085-Add-Option-to-Silence-CommandBlock-Console.patch similarity index 63% rename from CraftBukkit-Patches/0095-Add-Option-to-Silence-CommandBlock-Console.patch rename to CraftBukkit-Patches/0085-Add-Option-to-Silence-CommandBlock-Console.patch index 3c8c3b507a..1157c2be5f 100644 --- a/CraftBukkit-Patches/0095-Add-Option-to-Silence-CommandBlock-Console.patch +++ b/CraftBukkit-Patches/0085-Add-Option-to-Silence-CommandBlock-Console.patch @@ -1,24 +1,24 @@ -From df77a41831311f46365b93a445ee1e520c604c8f Mon Sep 17 00:00:00 2001 +From ff04acbb4f541280b03153bddcb4bae9b9ca00bb Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 9 Feb 2014 14:39:01 +1100 Subject: [PATCH] Add Option to Silence CommandBlock Console diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 0644276..84bcca1 100644 +index c6032b2..8bd58c9 100644 --- a/src/main/java/net/minecraft/server/CommandDispatcher.java +++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -83,7 +83,7 @@ public class CommandDispatcher extends CommandHandler implements ICommandDispatc +@@ -95,7 +95,7 @@ public class CommandDispatcher extends CommandHandler implements ICommandDispatc } } -- if (icommandlistener != MinecraftServer.getServer()) { -+ if (icommandlistener != MinecraftServer.getServer() && !org.spigotmc.SpigotConfig.silentCommandBlocks) { // Spigot - MinecraftServer.getServer().sendMessage(chatmessage); +- if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands")) { ++ if (icommandlistener != minecraftserver && minecraftserver.worldServer[0].getGameRules().getBoolean("logAdminCommands") && !org.spigotmc.SpigotConfig.silentCommandBlocks) { // Spigot + minecraftserver.sendMessage(chatmessage); } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index ff86680..731f24d 100644 +index 8419c28..f58208e 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -289,4 +289,10 @@ public class SpigotConfig @@ -33,5 +33,5 @@ index ff86680..731f24d 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0096-Add-support-for-fetching-hidden-players.patch b/CraftBukkit-Patches/0086-Add-support-for-fetching-hidden-players.patch similarity index 84% rename from CraftBukkit-Patches/0096-Add-support-for-fetching-hidden-players.patch rename to CraftBukkit-Patches/0086-Add-support-for-fetching-hidden-players.patch index 5fdc486e22..a054a2d327 100644 --- a/CraftBukkit-Patches/0096-Add-support-for-fetching-hidden-players.patch +++ b/CraftBukkit-Patches/0086-Add-support-for-fetching-hidden-players.patch @@ -1,14 +1,14 @@ -From 9e1e593e8fe8186bbe9d6110dc64eae2894dde0a Mon Sep 17 00:00:00 2001 +From 3d4c9a1f3677f920489c6ca6d2c44d614127846d Mon Sep 17 00:00:00 2001 From: Tux Date: Sun, 9 Feb 2014 14:03:03 -0500 Subject: [PATCH] Add support for fetching hidden players diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3ef8662..5011579 100644 +index 9d609c2..0836137 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1369,6 +1369,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1405,6 +1405,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { { return getHandle().locale; } @@ -28,5 +28,5 @@ index 3ef8662..5011579 100644 public Player.Spigot spigot() -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0097-Allow-Disabling-Creative-Item-Filter.patch b/CraftBukkit-Patches/0087-Allow-Disabling-Creative-Item-Filter.patch similarity index 75% rename from CraftBukkit-Patches/0097-Allow-Disabling-Creative-Item-Filter.patch rename to CraftBukkit-Patches/0087-Allow-Disabling-Creative-Item-Filter.patch index d6acb97486..b4e7ab593a 100644 --- a/CraftBukkit-Patches/0097-Allow-Disabling-Creative-Item-Filter.patch +++ b/CraftBukkit-Patches/0087-Allow-Disabling-Creative-Item-Filter.patch @@ -1,24 +1,24 @@ -From bbf61acf65ddf03cee535f7b8c93ad4aaf2425e7 Mon Sep 17 00:00:00 2001 +From 5313d1395974a2023bbb576effcbd669df0c77d0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 12 Feb 2014 18:18:01 +1100 Subject: [PATCH] Allow Disabling Creative Item Filter diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index daa524f..a0157af 100644 +index 393831b..54fba6d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1499,7 +1499,7 @@ public class PlayerConnection implements PacketPlayInListener { - ItemStack itemstack = packetplayinsetcreativeslot.getItemStack(); - boolean flag1 = packetplayinsetcreativeslot.c() >= 1 && packetplayinsetcreativeslot.c() < 36 + PlayerInventory.getHotbarSize(); +@@ -1664,7 +1664,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + + boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); // CraftBukkit - Add invalidItems check - boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem())); + boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; - - // CraftBukkit start - Call click event + + diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 731f24d..05c2e43 100644 +index f58208e..86c45c6 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -295,4 +295,10 @@ public class SpigotConfig @@ -33,5 +33,5 @@ index 731f24d..05c2e43 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0098-Cap-Channel-Registrations.patch b/CraftBukkit-Patches/0088-Cap-Channel-Registrations.patch similarity index 68% rename from CraftBukkit-Patches/0098-Cap-Channel-Registrations.patch rename to CraftBukkit-Patches/0088-Cap-Channel-Registrations.patch index 7ae5274dde..ab3334d0e6 100644 --- a/CraftBukkit-Patches/0098-Cap-Channel-Registrations.patch +++ b/CraftBukkit-Patches/0088-Cap-Channel-Registrations.patch @@ -1,21 +1,21 @@ -From 9912527e1b90db40ea53844785f3ce8d832d046c Mon Sep 17 00:00:00 2001 +From bedff1820ef18d59fee61734f72d99c05f8c93b5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 12 Feb 2014 20:02:58 +1100 Subject: [PATCH] Cap Channel Registrations diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5011579..27d3715 100644 +index 0836137..75061e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1052,6 +1052,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1059,6 +1059,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void addChannel(String channel) { -+ com.google.common.base.Preconditions.checkState( channels.size() < 128, "Too many channels registered" ); // Spigot ++ com.google.common.base.Preconditions.checkState( channels.size() < 128, "Too many channels registered" ); // Spigot if (channels.add(channel)) { server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel)); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0089-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch b/CraftBukkit-Patches/0089-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch new file mode 100644 index 0000000000..db9f2b967b --- /dev/null +++ b/CraftBukkit-Patches/0089-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch @@ -0,0 +1,80 @@ +From c51b2f9d4cbae39ba2f25d49b663cabc184b6f95 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Wed, 12 Feb 2014 20:44:14 +0000 +Subject: [PATCH] Allow vanilla commands to be the main version of a command + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 69fa301..5ca8cc8 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -315,8 +315,11 @@ public final class CraftServer implements Server { + } + + if (type == PluginLoadOrder.POSTWORLD) { ++ // Spigot start - Allow vanilla commands to be forced to be the main command ++ setVanillaCommands(true); + commandMap.setFallbackCommands(); +- setVanillaCommands(); ++ setVanillaCommands(false); ++ // Spigot end + commandMap.registerServerAliases(); + loadCustomPermissions(); + DefaultPermissions.registerCorePermissions(); +@@ -328,10 +331,19 @@ public final class CraftServer implements Server { + pluginManager.disablePlugins(); + } + +- private void setVanillaCommands() { ++ private void setVanillaCommands(boolean first) { // Spigot + Map commands = new CommandDispatcher().getCommands(); + for (ICommand cmd : commands.values()) { +- commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null)))); ++ // Spigot start ++ VanillaCommandWrapper wrapper = new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null))); ++ if (org.spigotmc.SpigotConfig.replaceCommands.contains( wrapper.getName() ) ) { ++ if (first) { ++ commandMap.register("minecraft", wrapper); ++ } ++ } else if (!first) { ++ commandMap.register("minecraft", wrapper); ++ } ++ // Spigot end + } + } + +diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java +index 86c45c6..4932990 100644 +--- a/src/main/java/org/spigotmc/SpigotConfig.java ++++ b/src/main/java/org/spigotmc/SpigotConfig.java +@@ -8,8 +8,10 @@ import java.lang.reflect.Method; + import java.lang.reflect.Modifier; + import java.util.Arrays; + import java.util.HashMap; ++import java.util.HashSet; + import java.util.List; + import java.util.Map; ++import java.util.Set; + import java.util.logging.Level; + import gnu.trove.map.hash.TObjectIntHashMap; + import net.minecraft.server.MinecraftServer; +@@ -301,4 +303,16 @@ public class SpigotConfig + { + filterCreativeItems = getBoolean( "settings.filter-creative-items", true ); + } ++ ++ public static Set replaceCommands; ++ private static void replaceCommands() ++ { ++ if ( config.contains( "replace-commands" ) ) ++ { ++ set( "commands.replace-commands", config.getStringList( "replace-commands" ) ); ++ config.set( "replace-commands", null ); ++ } ++ replaceCommands = new HashSet( (List) getList( "commands.replace-commands", ++ Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) ); ++ } + } +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0100-Unfinalize-the-isDisconnected-method-by-bukkit.patch b/CraftBukkit-Patches/0090-Unfinalize-the-isDisconnected-method-by-bukkit.patch similarity index 79% rename from CraftBukkit-Patches/0100-Unfinalize-the-isDisconnected-method-by-bukkit.patch rename to CraftBukkit-Patches/0090-Unfinalize-the-isDisconnected-method-by-bukkit.patch index 36b8f1e47d..58d37368eb 100644 --- a/CraftBukkit-Patches/0100-Unfinalize-the-isDisconnected-method-by-bukkit.patch +++ b/CraftBukkit-Patches/0090-Unfinalize-the-isDisconnected-method-by-bukkit.patch @@ -1,4 +1,4 @@ -From e98bb2261ecbe553d9e246ca9ebcbb659ac07140 Mon Sep 17 00:00:00 2001 +From 69fb81ace8ff782f6dd7038b9a9a7487121881d4 Mon Sep 17 00:00:00 2001 From: hcherndon Date: Sat, 15 Feb 2014 01:51:20 -0600 Subject: [PATCH] Unfinalize the isDisconnected() method by bukkit. @@ -6,10 +6,10 @@ Subject: [PATCH] Unfinalize the isDisconnected() method by bukkit. This would literally mean the world to me. You have no idea how much this method being final is fucking me over right now. (Working with NPC's and what not.) diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index a0157af..096ac2d 100644 +index 237ff57..ce3f04d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1885,7 +1885,7 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -2021,7 +2021,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } // CraftBukkit start - Add "isDisconnected" method @@ -17,7 +17,7 @@ index a0157af..096ac2d 100644 + public boolean isDisconnected() { return !this.player.joining && !NetworkManager.a(this.networkManager).config().isAutoRead(); } - // CraftBukkit end + } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0101-Implement-Silenceable-Lightning-API.patch b/CraftBukkit-Patches/0091-Implement-Silenceable-Lightning-API.patch similarity index 74% rename from CraftBukkit-Patches/0101-Implement-Silenceable-Lightning-API.patch rename to CraftBukkit-Patches/0091-Implement-Silenceable-Lightning-API.patch index 0be790299b..796c686817 100644 --- a/CraftBukkit-Patches/0101-Implement-Silenceable-Lightning-API.patch +++ b/CraftBukkit-Patches/0091-Implement-Silenceable-Lightning-API.patch @@ -1,11 +1,11 @@ -From 6182a213539516f890da8bf03125138801557cbb Mon Sep 17 00:00:00 2001 +From 56976846cfa4a3138592077288f3592572a50b08 Mon Sep 17 00:00:00 2001 From: drXor Date: Sun, 23 Feb 2014 16:16:59 -0400 Subject: [PATCH] Implement Silenceable Lightning API diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index 66402a0..0671659 100644 +index 5bda5d3..1bbce9b 100644 --- a/src/main/java/net/minecraft/server/EntityLightning.java +++ b/src/main/java/net/minecraft/server/EntityLightning.java @@ -13,6 +13,8 @@ public class EntityLightning extends EntityWeather { @@ -17,30 +17,32 @@ index 66402a0..0671659 100644 public EntityLightning(World world, double d0, double d1, double d2) { this(world, d0, d1, d2, false); } -@@ -60,9 +62,17 @@ public class EntityLightning extends EntityWeather { +@@ -53,12 +55,19 @@ public class EntityLightning extends EntityWeather { + } + } } - } ++ } + // Spigot start + public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect, boolean isSilent) + { + this( world, d0, d1, d2, isEffect ); + this.isSilent = isSilent; -+ } + } + // Spigot end -+ - public void h() { - super.h(); + + public void s_() { + super.s_(); - if (this.lifeTicks == 2) { + if (!isSilent && this.lifeTicks == 2) { // Spigot // CraftBukkit start - Use relative location for far away sounds //this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); float pitch = 0.8F + this.random.nextFloat() * 0.2F; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 53a5d37..92f7188 100644 +index 260aece..19c606e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1361,6 +1361,22 @@ public class CraftWorld implements World { +@@ -1385,6 +1385,22 @@ public class CraftWorld implements World { { CraftWorld.this.playEffect( location, effect, 0 ); } @@ -64,42 +66,21 @@ index 53a5d37..92f7188 100644 public Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -index 64e346d..be4f10f 100644 +index 243e8e5..0bacc83 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -@@ -1,7 +1,9 @@ - package org.bukkit.craftbukkit.entity; - - import net.minecraft.server.EntityLightning; -+ - import org.bukkit.craftbukkit.CraftServer; -+import org.bukkit.entity.Arrow; - import org.bukkit.entity.EntityType; - import org.bukkit.entity.LightningStrike; - -@@ -27,4 +29,22 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike - public EntityType getType() { - return EntityType.LIGHTNING; - } -+ -+ // Spigot start -+ private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() -+ { -+ +@@ -31,6 +31,11 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike + // Spigot start + private final LightningStrike.Spigot spigot = new LightningStrike.Spigot() { + + @Override + public boolean isSilent() + { + return getHandle().isSilent; + } -+ -+ }; -+ -+ public LightningStrike.Spigot spigot() -+ { -+ return this.spigot; -+ } -+ // Spigot end - } + }; + + @Override -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0102-Use-one-PermissibleBase-for-all-Command-Blocks.patch b/CraftBukkit-Patches/0092-Use-one-PermissibleBase-for-all-Command-Blocks.patch similarity index 94% rename from CraftBukkit-Patches/0102-Use-one-PermissibleBase-for-all-Command-Blocks.patch rename to CraftBukkit-Patches/0092-Use-one-PermissibleBase-for-all-Command-Blocks.patch index f07e02300d..87dfd0ed0f 100644 --- a/CraftBukkit-Patches/0102-Use-one-PermissibleBase-for-all-Command-Blocks.patch +++ b/CraftBukkit-Patches/0092-Use-one-PermissibleBase-for-all-Command-Blocks.patch @@ -1,4 +1,4 @@ -From 747e4746b5b9d3655eb0a87bd0a3654997ca3e3f Mon Sep 17 00:00:00 2001 +From 5a6071e6f1967baad96fe370e5497a1bcac43ac9 Mon Sep 17 00:00:00 2001 From: FrozenBrain Date: Sun, 2 Mar 2014 21:13:46 +0100 Subject: [PATCH] Use one PermissibleBase for all Command Blocks @@ -29,5 +29,5 @@ index 1314c74..b339cf3 100644 public boolean isPermissionSet(String name) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0103-Prevent-hoppers-from-loading-chunks.patch b/CraftBukkit-Patches/0093-Prevent-hoppers-from-loading-chunks.patch similarity index 50% rename from CraftBukkit-Patches/0103-Prevent-hoppers-from-loading-chunks.patch rename to CraftBukkit-Patches/0093-Prevent-hoppers-from-loading-chunks.patch index 0854795f15..ab2b44e205 100644 --- a/CraftBukkit-Patches/0103-Prevent-hoppers-from-loading-chunks.patch +++ b/CraftBukkit-Patches/0093-Prevent-hoppers-from-loading-chunks.patch @@ -1,21 +1,21 @@ -From ac404ee520ce2042d0563a6fd0357ab78d1ccf4c Mon Sep 17 00:00:00 2001 +From 4e6040427ecb0cf9ab498d403e6d731972310a22 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Wed, 5 Mar 2014 20:27:27 +0000 Subject: [PATCH] Prevent hoppers from loading chunks diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index d77708b..ace3617 100644 +index f4dc9c7..280d64f 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -542,6 +542,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { - int i = MathHelper.floor(d0); +@@ -555,6 +555,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); -+ if ( !world.isLoaded( i, j, k ) ) return null; // Spigot - TileEntity tileentity = world.getTileEntity(i, j, k); + BlockPosition blockposition = new BlockPosition(i, j, k); ++ if ( !world.isLoaded( blockposition ) ) return null; // Spigot + TileEntity tileentity = world.getTileEntity(new BlockPosition(i, j, k)); - if (tileentity != null && tileentity instanceof IInventory) { + if (tileentity instanceof IInventory) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0104-Guard-Entity-List.patch b/CraftBukkit-Patches/0094-Guard-Entity-List.patch similarity index 73% rename from CraftBukkit-Patches/0104-Guard-Entity-List.patch rename to CraftBukkit-Patches/0094-Guard-Entity-List.patch index 7d113d111d..6932927434 100644 --- a/CraftBukkit-Patches/0104-Guard-Entity-List.patch +++ b/CraftBukkit-Patches/0094-Guard-Entity-List.patch @@ -1,20 +1,20 @@ -From 49361f99a370986b4721d342df127d43b9fdd0d9 Mon Sep 17 00:00:00 2001 +From 37911f5c7eacd81e8c81158a396fe8f6f154ada9 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 10 Mar 2014 09:03:28 +1100 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 66db74d..d5d5f9d 100644 +index a35ec3f..703b919 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -31,7 +31,32 @@ import org.bukkit.event.weather.ThunderChangeEvent; +@@ -33,7 +33,32 @@ import org.bukkit.event.weather.ThunderChangeEvent; public abstract class World implements IBlockAccess { - public boolean d; -- public List entityList = new ArrayList(); + protected boolean e; +- public final List entityList = Lists.newArrayList(); + // Spigot start - guard entity list from removals -+ public List entityList = new ArrayList() ++ public List entityList = new java.util.ArrayList() + { + @Override + public Object remove(int index) @@ -39,18 +39,18 @@ index 66db74d..d5d5f9d 100644 + } + }; + // Spigot end - protected List f = new ArrayList(); - public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet - private List a = new ArrayList(); -@@ -81,6 +106,7 @@ public abstract class World implements IBlockAccess { - int[] I; + protected final List g = Lists.newArrayList(); + public final List h = Lists.newArrayList(); + public final List tileEntityList = Lists.newArrayList(); +@@ -88,6 +113,7 @@ public abstract class World implements IBlockAccess { + private int tickPosition; // Spigot start + private boolean guardEntityList; - protected final net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap chunkTickList; + protected final gnu.trove.map.hash.TLongShortHashMap chunkTickList; protected float growthOdds = 100; protected float modifiedOdds = 100; -@@ -1346,6 +1372,7 @@ public abstract class World implements IBlockAccess { +@@ -1280,6 +1306,7 @@ public abstract class World implements IBlockAccess { org.spigotmc.ActivationRange.activateEntities(this); // Spigot timings.entityTick.startTiming(); // Spigot @@ -58,7 +58,7 @@ index 66db74d..d5d5f9d 100644 // CraftBukkit start - Use field for loop variable for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { entity = (Entity) this.entityList.get(this.tickPosition); -@@ -1381,12 +1408,15 @@ public abstract class World implements IBlockAccess { +@@ -1316,12 +1343,15 @@ public abstract class World implements IBlockAccess { this.getChunkAt(j, k).b(entity); } @@ -75,5 +75,5 @@ index 66db74d..d5d5f9d 100644 timings.entityTick.stopTiming(); // Spigot this.methodProfiler.c("blockEntities"); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0095-Fix-ConcurrentModificationException-while-being-idle.patch b/CraftBukkit-Patches/0095-Fix-ConcurrentModificationException-while-being-idle.patch new file mode 100644 index 0000000000..4782b1e6a4 --- /dev/null +++ b/CraftBukkit-Patches/0095-Fix-ConcurrentModificationException-while-being-idle.patch @@ -0,0 +1,30 @@ +From 6a4a46f7eaa9666f3ac0bcd72ddffab97d43ae48 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Tue, 14 Jan 2014 20:11:25 +0000 +Subject: [PATCH] Fix ConcurrentModificationException while being idle kicked + in a vehicle + + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 59a2c58..763ea9d 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1031,6 +1031,7 @@ public abstract class World implements IBlockAccess { + this.everyoneSleeping(); + } + ++ if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking + int i = entity.ae; + int j = entity.ag; + +@@ -1047,6 +1048,7 @@ public abstract class World implements IBlockAccess { + this.entityList.remove(index); + } + // CraftBukkit end ++ } // Spigot + this.b(entity); + } + +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0106-Cancellable-WitherSkull-potion-effect.patch b/CraftBukkit-Patches/0096-Cancellable-WitherSkull-potion-effect.patch similarity index 67% rename from CraftBukkit-Patches/0106-Cancellable-WitherSkull-potion-effect.patch rename to CraftBukkit-Patches/0096-Cancellable-WitherSkull-potion-effect.patch index 9fbf1366b9..0fb0485ff6 100644 --- a/CraftBukkit-Patches/0106-Cancellable-WitherSkull-potion-effect.patch +++ b/CraftBukkit-Patches/0096-Cancellable-WitherSkull-potion-effect.patch @@ -1,24 +1,28 @@ -From 485cde64ee6e886850bbd26abf9f0605cc8b4061 Mon Sep 17 00:00:00 2001 +From b90a8671d89d40f9d99598465225b1efdfc43d63 Mon Sep 17 00:00:00 2001 From: drXor Date: Tue, 25 Feb 2014 15:15:26 -0400 Subject: [PATCH] Cancellable WitherSkull potion effect diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java -index b797f8a..144ed17 100644 +index a4df9a1..b809e1b 100644 --- a/src/main/java/net/minecraft/server/EntityWitherSkull.java +++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java -@@ -35,15 +35,19 @@ public class EntityWitherSkull extends EntityFireball { +@@ -35,8 +35,11 @@ public class EntityWitherSkull extends EntityFireball { protected void a(MovingObjectPosition movingobjectposition) { if (!this.world.isStatic) { if (movingobjectposition.entity != null) { + // Spigot start + boolean didDamage = false; if (this.shooter != null) { -- if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F) && !movingobjectposition.entity.isAlive()) { +- if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F)) { + didDamage = movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F); -+ if (didDamage && !movingobjectposition.entity.isAlive()) { - this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit ++ if (didDamage) { + if (!movingobjectposition.entity.isAlive()) { + this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit + } else { +@@ -44,10 +47,11 @@ public class EntityWitherSkull extends EntityFireball { + } } } else { - movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5.0F); @@ -30,7 +34,7 @@ index b797f8a..144ed17 100644 + // Spigot end byte b0 = 0; - if (this.world.difficulty == EnumDifficulty.NORMAL) { + if (this.world.getDifficulty() == EnumDifficulty.NORMAL) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0107-Descriptive-kick-reasons-instead-of-Nope.patch b/CraftBukkit-Patches/0097-Descriptive-kick-reasons-instead-of-Nope.patch similarity index 62% rename from CraftBukkit-Patches/0107-Descriptive-kick-reasons-instead-of-Nope.patch rename to CraftBukkit-Patches/0097-Descriptive-kick-reasons-instead-of-Nope.patch index aa02b7451a..7bb52cbf2b 100644 --- a/CraftBukkit-Patches/0107-Descriptive-kick-reasons-instead-of-Nope.patch +++ b/CraftBukkit-Patches/0097-Descriptive-kick-reasons-instead-of-Nope.patch @@ -1,53 +1,53 @@ -From e6b78d72459f1affd0f92c832fa46ad249fd9879 Mon Sep 17 00:00:00 2001 +From 43257f49aed689a59e7d09a4f64f7dc7220a4848 Mon Sep 17 00:00:00 2001 From: drXor Date: Sat, 15 Mar 2014 01:30:05 -0400 Subject: [PATCH] Descriptive kick reasons instead of Nope! diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b258f15..56b5980 100644 +index 8c7ec1d..f5a204d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -219,7 +219,7 @@ public abstract class Entity { - if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY)) { +@@ -207,7 +207,7 @@ public abstract class Entity implements ICommandListener { + if (f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) { if (this instanceof EntityPlayer) { - this.world.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw"); + this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw"); - ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); + ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)"); //Spigot "Nope" -> Descriptive reason } f = 0; } -@@ -232,7 +232,7 @@ public abstract class Entity { - if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY)) { +@@ -220,7 +220,7 @@ public abstract class Entity implements ICommandListener { + if (f1 == Float.POSITIVE_INFINITY || f1 == Float.NEGATIVE_INFINITY) { if (this instanceof EntityPlayer) { - this.world.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch"); + this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch"); - ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); + ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)"); //Spigot "Nope" -> Descriptive reason } f1 = 0; } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 096ac2d..38ed1bf 100644 +index c95471c..fab3a4e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -185,7 +185,7 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -191,7 +191,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit start - Check for NaN - if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z) || Double.isNaN(packetplayinflying.stance)) { + if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z)) { c.warn(player.getName() + " was caught trying to crash the server with an invalid position."); - getPlayer().kickPlayer("Nope!"); + getPlayer().kickPlayer("NaN in position (Hacking?)"); //Spigot "Nope" -> Descriptive reason return; } // CraftBukkit end -@@ -779,7 +779,7 @@ public class PlayerConnection implements PacketPlayInListener { - this.player.v(); +@@ -863,7 +863,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + this.player.z(); } else { - c.warn(this.player.getName() + " tried to set an invalid carried item"); + PlayerConnection.c.warn(this.player.getName() + " tried to set an invalid carried item"); - this.disconnect("Nope!"); // CraftBukkit + this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0111-Configurable-dragon-death-and-wither-spawn-sounds.patch b/CraftBukkit-Patches/0098-Configurable-dragon-death-and-wither-spawn-sounds.patch similarity index 90% rename from CraftBukkit-Patches/0111-Configurable-dragon-death-and-wither-spawn-sounds.patch rename to CraftBukkit-Patches/0098-Configurable-dragon-death-and-wither-spawn-sounds.patch index 0e8b36e2f5..98aed9b92b 100644 --- a/CraftBukkit-Patches/0111-Configurable-dragon-death-and-wither-spawn-sounds.patch +++ b/CraftBukkit-Patches/0098-Configurable-dragon-death-and-wither-spawn-sounds.patch @@ -1,14 +1,14 @@ -From a73a46b6f3f437d91ca26ebc9a42889226cc4ee4 Mon Sep 17 00:00:00 2001 +From 55611483f28cccdf49a6bf95094d697d47020f0b Mon Sep 17 00:00:00 2001 From: drXor Date: Sat, 29 Mar 2014 13:44:25 -0400 Subject: [PATCH] Configurable dragon death and wither spawn sounds diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 78023c4..5d761aa 100644 +index 51686c4..ec94142 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -551,6 +551,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo +@@ -572,6 +572,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo double deltaX = this.locX - player.locX; double deltaZ = this.locZ - player.locZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; @@ -17,10 +17,10 @@ index 78023c4..5d761aa 100644 double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 75b3ca3..434616d 100644 +index d21c0e9..8ed2b4b 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -180,6 +180,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { +@@ -183,6 +183,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { double deltaX = this.locX - player.locX; double deltaZ = this.locZ - player.locZ; double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; @@ -29,7 +29,7 @@ index 75b3ca3..434616d 100644 double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.locX + (deltaX / deltaLength) * viewDistance; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 9745982..3e6b1e6 100644 +index 71f772c..7904926 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -280,4 +280,16 @@ public class SpigotWorldConfig @@ -50,5 +50,5 @@ index 9745982..3e6b1e6 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0099-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch b/CraftBukkit-Patches/0099-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch deleted file mode 100644 index 174212ccb9..0000000000 --- a/CraftBukkit-Patches/0099-Allow-vanilla-commands-to-be-the-main-version-of-a-c.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 3482e0fb65523c96a612e0c2a57a67ca76bf241c Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Wed, 12 Feb 2014 20:44:14 +0000 -Subject: [PATCH] Allow vanilla commands to be the main version of a command - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5a08283..a235ce8 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -120,6 +120,7 @@ import org.bukkit.command.CommandSender; - import org.bukkit.command.ConsoleCommandSender; - import org.bukkit.command.PluginCommand; - import org.bukkit.command.SimpleCommandMap; -+import org.bukkit.command.defaults.VanillaCommand; - import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.file.YamlConfiguration; - import org.bukkit.configuration.serialization.ConfigurationSerialization; -@@ -395,8 +396,11 @@ public final class CraftServer implements Server { - } - - if (type == PluginLoadOrder.POSTWORLD) { -+ // Spigot start - Allow vanilla commands to be forced to be the main command -+ setVanillaCommands(true); - commandMap.setFallbackCommands(); -- setVanillaCommands(); -+ setVanillaCommands(false); -+ // Spigot end - commandMap.registerServerAliases(); - loadCustomPermissions(); - DefaultPermissions.registerCorePermissions(); -@@ -408,51 +412,64 @@ public final class CraftServer implements Server { - pluginManager.disablePlugins(); - } - -- private void setVanillaCommands() { -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandAchievement(), "/achievement give [player]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandBan(), "/ban [reason]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandBanIp(), "/ban-ip ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandBanList(), "/banlist [ips]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandClear(), "/clear [item] [metadata]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGamemodeDefault(), "/defaultgamemode ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandDeop(), "/deop ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandDifficulty(), "/difficulty ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandEffect(), "/effect [seconds] [amplifier]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandEnchant(), "/enchant [enchantment level]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGamemode(), "/gamemode [player]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGamerule(), "/gamerule [true|false]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandGive(), "/give [amount] [metadata] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandHelp(), "/help [page|commandname]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandIdleTimeout(), "/setidletimeout ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandKick(), "/kick [reason]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandKill(), "/kill [playername]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandList(), "/list")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandMe(), "/me ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandOp(), "/op ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandPardon(), "/pardon ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandPardonIP(), "/pardon-ip ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandPlaySound(), "/playsound [x] [y] [z] [volume] [pitch] [minimumVolume]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSay(), "/say ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandScoreboard(), "/scoreboard")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSeed(), "/seed")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSetBlock(), "/setblock [datavalue] [oldblockHandling] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSetWorldSpawn(), "/setworldspawn [x] [y] [z]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSpawnpoint(), "/spawnpoint [x] [y] [z]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSpreadPlayers(), "/spreadplayers [spreadDistance] [maxRange] [respectTeams] ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandSummon(), "/summon [x] [y] [z] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTp(), "/tp [player] \n/tp [player] ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTell(), "/tell ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTellRaw(), "/tellraw ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTestFor(), "/testfor [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTestForBlock(), "/testforblock [datavalue] [dataTag]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandTime(), "/time set \n/time add ")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandToggleDownfall(), "/toggledownfall")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandWeather(), "/weather [duration in seconds]")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandWhitelist(), "/whitelist (add|remove) \n/whitelist (on|off|list|reload)")); -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandXp(), "/xp [player]\n/xp L [player]")); -+ // Spigot start -+ private void tryRegister(VanillaCommandWrapper commandWrapper, boolean first) { -+ if (org.spigotmc.SpigotConfig.replaceCommands.contains( commandWrapper.getName() ) ) { -+ if (first) { -+ commandMap.register( "minecraft", commandWrapper ); -+ } -+ } else if (!first) { -+ commandMap.register( "minecraft", commandWrapper ); -+ } -+ } -+ -+ private void setVanillaCommands(boolean first) -+ { -+ tryRegister( new VanillaCommandWrapper( new CommandAchievement(), "/achievement give [player]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandBan(), "/ban [reason]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandBanIp(), "/ban-ip " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandBanList(), "/banlist [ips]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandClear(), "/clear [item] [metadata]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGamemodeDefault(), "/defaultgamemode " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandDeop(), "/deop " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandDifficulty(), "/difficulty " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandEffect(), "/effect [seconds] [amplifier]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandEnchant(), "/enchant [enchantment level]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGamemode(), "/gamemode [player]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGamerule(), "/gamerule [true|false]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandGive(), "/give [amount] [metadata] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandHelp(), "/help [page|commandname]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandIdleTimeout(), "/setidletimeout " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandKick(), "/kick [reason]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandKill(), "/kill [playername]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandList(), "/list" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandMe(), "/me " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandOp(), "/op " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandPardon(), "/pardon " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandPardonIP(), "/pardon-ip " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandPlaySound(), "/playsound [x] [y] [z] [volume] [pitch] [minimumVolume]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSay(), "/say " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandScoreboard(), "/scoreboard" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSeed(), "/seed" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSetBlock(), "/setblock [datavalue] [oldblockHandling] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSetWorldSpawn(), "/setworldspawn [x] [y] [z]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSpawnpoint(), "/spawnpoint [x] [y] [z]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSpreadPlayers(), "/spreadplayers [spreadDistance] [maxRange] [respectTeams] " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandSummon(), "/summon [x] [y] [z] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTp(), "/tp [player] \n/tp [player] " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTell(), "/tell " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTellRaw(), "/tellraw " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTestFor(), "/testfor [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTestForBlock(), "/testforblock [datavalue] [dataTag]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandTime(), "/time set \n/time add " ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandToggleDownfall(), "/toggledownfall" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandWeather(), "/weather [duration in seconds]" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandWhitelist(), "/whitelist (add|remove) \n/whitelist (on|off|list|reload)" ), first ); -+ tryRegister( new VanillaCommandWrapper( new CommandXp(), "/xp [player]\n/xp L [player]" ), first ); - // This is what is in the lang file, I swear. -- commandMap.register("minecraft", new VanillaCommandWrapper(new CommandNetstat(), "/list")); -+ tryRegister( new VanillaCommandWrapper(new CommandNetstat(), "/list"), first ); - } -+ // Spigot end - - private void loadPlugin(Plugin plugin) { - try { -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 05c2e43..a299317 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -8,8 +8,10 @@ import java.lang.reflect.Method; - import java.lang.reflect.Modifier; - import java.util.Arrays; - import java.util.HashMap; -+import java.util.HashSet; - import java.util.List; - import java.util.Map; -+import java.util.Set; - import java.util.logging.Level; - import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; - import net.minecraft.server.MinecraftServer; -@@ -301,4 +303,16 @@ public class SpigotConfig - { - filterCreativeItems = getBoolean( "settings.filter-creative-items", true ); - } -+ -+ public static Set replaceCommands; -+ private static void replaceCommands() -+ { -+ if ( config.contains( "replace-commands" ) ) -+ { -+ set( "commands.replace-commands", config.getStringList( "replace-commands" ) ); -+ config.set( "replace-commands", null ); -+ } -+ replaceCommands = new HashSet( (List) getList( "commands.replace-commands", -+ Arrays.asList( "setblock", "summon", "testforblock", "tellraw" ) ) ); -+ } - } --- -1.9.1 - diff --git a/CraftBukkit-Patches/0112-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch b/CraftBukkit-Patches/0099-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch similarity index 77% rename from CraftBukkit-Patches/0112-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch rename to CraftBukkit-Patches/0099-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch index f7081d12f1..6014bf398d 100644 --- a/CraftBukkit-Patches/0112-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch +++ b/CraftBukkit-Patches/0099-Display-Spigot-in-client-crashes-server-lists-and-Mo.patch @@ -1,4 +1,4 @@ -From b01c8787280b4c2c5e1695f795ca235edce456e6 Mon Sep 17 00:00:00 2001 +From 6f6b223300fb88e340b47798a34d3c9ba75307ea Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Fri, 11 Apr 2014 11:16:34 +0100 Subject: [PATCH] Display 'Spigot' in client crashes, server lists and Mojang @@ -6,10 +6,10 @@ Subject: [PATCH] Display 'Spigot' in client crashes, server lists and Mojang diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4c9c3a8..c62d9fe 100644 +index 36fdaf7..bbe16d8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -979,7 +979,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -1041,7 +1041,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } public String getServerModName() { @@ -19,5 +19,5 @@ index 4c9c3a8..c62d9fe 100644 public CrashReport b(CrashReport crashreport) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0114-Treat-Bungee-as-Online-Mode.patch b/CraftBukkit-Patches/0100-Treat-Bungee-as-Online-Mode.patch similarity index 86% rename from CraftBukkit-Patches/0114-Treat-Bungee-as-Online-Mode.patch rename to CraftBukkit-Patches/0100-Treat-Bungee-as-Online-Mode.patch index 20981719c6..6e603600d2 100644 --- a/CraftBukkit-Patches/0114-Treat-Bungee-as-Online-Mode.patch +++ b/CraftBukkit-Patches/0100-Treat-Bungee-as-Online-Mode.patch @@ -1,14 +1,14 @@ -From 519f5ee2659106caba75fc3f386e4e2e32e9f332 Mon Sep 17 00:00:00 2001 +From ff10a02d2f664890316780aefc6520a6e2f92fb7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 12 Apr 2014 21:23:58 +1000 Subject: [PATCH] Treat Bungee as Online Mode diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index ce66cca..56fb152 100644 +index 33d0702..3b50d40 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -@@ -56,7 +56,7 @@ public class NameReferencingFileConverter { +@@ -53,7 +53,7 @@ public class NameReferencingFileConverter { private static void a(MinecraftServer minecraftserver, Collection collection, ProfileLookupCallback profilelookupcallback) { String[] astring = (String[]) Iterators.toArray(Iterators.filter(collection.iterator(), new PredicateEmptyList()), String.class); @@ -18,5 +18,5 @@ index ce66cca..56fb152 100644 } else { String[] astring1 = astring; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0117-Add-Conversion-Message.patch b/CraftBukkit-Patches/0101-Add-Conversion-Message.patch similarity index 75% rename from CraftBukkit-Patches/0117-Add-Conversion-Message.patch rename to CraftBukkit-Patches/0101-Add-Conversion-Message.patch index 5c172fd966..51508f9083 100644 --- a/CraftBukkit-Patches/0117-Add-Conversion-Message.patch +++ b/CraftBukkit-Patches/0101-Add-Conversion-Message.patch @@ -1,21 +1,21 @@ -From bd8ac022bdd66afe820f63617d2b5958c212e5ce Mon Sep 17 00:00:00 2001 +From 8332685a8facc80964331f1c52a0fe9b16d8ac47 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 12 Apr 2014 23:30:44 +1000 Subject: [PATCH] Add Conversion Message diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 6ba9c8c..12e8b14 100644 +index ced9efa..80755dd 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -413,6 +413,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -453,6 +453,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - protected boolean aE() { + protected boolean aP() { + server.getLogger().info( "**** Beginning UUID conversion, this may take A LONG time ****"); // Spigot, let the user know whats up! boolean flag = false; int i; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0118-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch b/CraftBukkit-Patches/0102-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch similarity index 91% rename from CraftBukkit-Patches/0118-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch rename to CraftBukkit-Patches/0102-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch index f283f5f901..558398b397 100644 --- a/CraftBukkit-Patches/0118-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch +++ b/CraftBukkit-Patches/0102-Properly-cancel-fishing-event.-Fixes-BUKKIT-5396.patch @@ -1,4 +1,4 @@ -From 35fe247887b1066a084be680e51856200721d1d6 Mon Sep 17 00:00:00 2001 +From 587db9330f1c1e66d94b156e62a0cd8b7a7f803b Mon Sep 17 00:00:00 2001 From: "gjmcferrin@gmail.com" Date: Mon, 10 Feb 2014 10:05:11 -0500 Subject: [PATCH] Properly cancel fishing event. Fixes BUKKIT-5396 @@ -10,7 +10,7 @@ cleared. This ensures that the player's hooked entity value is set to null so that the next attempt will result in the proper state being called. diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java -index 2f34151..9ededf3 100644 +index 423a776..c14d261 100644 --- a/src/main/java/net/minecraft/server/ItemFishingRod.java +++ b/src/main/java/net/minecraft/server/ItemFishingRod.java @@ -23,6 +23,7 @@ public class ItemFishingRod extends Item { @@ -22,5 +22,5 @@ index 2f34151..9ededf3 100644 } // CraftBukkit end -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0119-Print-Stack-on-InternalException.patch b/CraftBukkit-Patches/0103-Print-Stack-on-InternalException.patch similarity index 55% rename from CraftBukkit-Patches/0119-Print-Stack-on-InternalException.patch rename to CraftBukkit-Patches/0103-Print-Stack-on-InternalException.patch index 5df463214c..55fde35738 100644 --- a/CraftBukkit-Patches/0119-Print-Stack-on-InternalException.patch +++ b/CraftBukkit-Patches/0103-Print-Stack-on-InternalException.patch @@ -1,21 +1,21 @@ -From b51100b179843c93596983f53787c0d4a1f84ddd Mon Sep 17 00:00:00 2001 +From b444f12d518544ceb1c3255b5270c93a0d38c85b Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 13 Apr 2014 09:00:59 +1000 Subject: [PATCH] Print Stack on InternalException diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 04af15c..9939652 100644 +index 78d5949..65b66cd 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -98,6 +98,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { - } - - this.close(chatmessage); +@@ -71,6 +71,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { + NetworkManager.f.debug("Disconnecting " + this.getSocketAddress(), throwable); + this.close(new ChatMessage("disconnect.genericReason", new Object[] { "Internal Exception: " + throwable})); + if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot } protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0120-Use-Offline-Player-Data-Once-if-Required.patch b/CraftBukkit-Patches/0104-Use-Offline-Player-Data-Once-if-Required.patch similarity index 62% rename from CraftBukkit-Patches/0120-Use-Offline-Player-Data-Once-if-Required.patch rename to CraftBukkit-Patches/0104-Use-Offline-Player-Data-Once-if-Required.patch index 3538381fc4..85081ba663 100644 --- a/CraftBukkit-Patches/0120-Use-Offline-Player-Data-Once-if-Required.patch +++ b/CraftBukkit-Patches/0104-Use-Offline-Player-Data-Once-if-Required.patch @@ -1,4 +1,4 @@ -From 793e8163060e5f9319d7b1126159c739d59dd54c Mon Sep 17 00:00:00 2001 +From 3d56405cbfce415bc673eac3e1b857381e3f5597 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 13 Apr 2014 14:41:23 +1000 Subject: [PATCH] Use Offline Player Data Once if Required. @@ -6,19 +6,19 @@ Subject: [PATCH] Use Offline Player Data Once if Required. If we are online mode and the only copy of player data we can find is the player's offline mode data, we will attempt a once off conversion by reading this data and then renaming the file so it won't be used again. diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 93ff8d3..efdcad7 100644 +index 6fa10cc..ee79cbd 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -196,10 +196,28 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { +@@ -200,10 +200,28 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { try { - File file1 = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat"); + File file = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat"); + // Spigot Start + boolean usingWrongFile = false; -+ if ( !file1.exists() ) ++ if ( !file.exists() ) + { -+ file1 = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); -+ if ( file1.exists() ) ++ file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); ++ if ( file.exists() ) + { + usingWrongFile = true; + org.bukkit.Bukkit.getServer().getLogger().warning( "Using offline mode UUID file for player " + entityhuman.getName() + " as it is the only copy we can find." ); @@ -26,18 +26,18 @@ index 93ff8d3..efdcad7 100644 + } + // Spigot End - if (file1.exists() && file1.isFile()) { - nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1))); + if (file.exists() && file.isFile()) { + nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file))); } + // Spigot Start + if ( usingWrongFile ) + { -+ file1.renameTo( new File( file1.getPath() + ".offline-read" ) ); ++ file.renameTo( new File( file.getPath() + ".offline-read" ) ); + } + // Spigot End } catch (Exception exception) { - a.warn("Failed to load player data for " + entityhuman.getName()); + WorldNBTStorage.a.warn("Failed to load player data for " + entityhuman.getName()); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0105-Fix-ConcurrentModificationException-while-being-idle.patch b/CraftBukkit-Patches/0105-Fix-ConcurrentModificationException-while-being-idle.patch deleted file mode 100644 index d9659cabe1..0000000000 --- a/CraftBukkit-Patches/0105-Fix-ConcurrentModificationException-while-being-idle.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 5710f95fbc5d66e22cd1054c6ffb22f5551e8cbf Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Tue, 14 Jan 2014 20:11:25 +0000 -Subject: [PATCH] Fix ConcurrentModificationException while being idle kicked - in a vehicle - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d5d5f9d..554023a 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1131,23 +1131,24 @@ public abstract class World implements IBlockAccess { - this.players.remove(entity); - this.everyoneSleeping(); - } -- -- int i = entity.ah; -- int j = entity.aj; -- -- if (entity.ag && this.isChunkLoaded(i, j)) { -- this.getChunkAt(i, j).b(entity); -- } -- -- // CraftBukkit start - Decrement loop variable field if we've already ticked this entity -- int index = this.entityList.indexOf(entity); -- if (index != -1) { -- if (index <= this.tickPosition) { -- this.tickPosition--; -+ // Spigot start -+ if (!guardEntityList) { // It will get removed after the tick if we are ticking -+ int i = entity.ah; -+ int j = entity.aj; -+ if (entity.ag && this.isChunkLoaded(i, j)) { -+ this.getChunkAt(i, j).b(entity); - } -- this.entityList.remove(index); -+ // CraftBukkit start - Decrement loop variable field if we've already ticked this entity -+ int index = this.entityList.indexOf(entity); -+ if (index != -1) { -+ if (index <= this.tickPosition) { -+ this.tickPosition--; -+ } -+ this.entityList.remove(index); -+ } -+ // CraftBukkit end - } -- // CraftBukkit end -+ // Spigot end - - this.b(entity); - } --- -1.9.1 - diff --git a/CraftBukkit-Patches/0121-Use-Provided-Case-for-Non-Existent-Offline-Players.patch b/CraftBukkit-Patches/0105-Use-Provided-Case-for-Non-Existent-Offline-Players.patch similarity index 74% rename from CraftBukkit-Patches/0121-Use-Provided-Case-for-Non-Existent-Offline-Players.patch rename to CraftBukkit-Patches/0105-Use-Provided-Case-for-Non-Existent-Offline-Players.patch index 0a9b04f5d5..7a9339fd04 100644 --- a/CraftBukkit-Patches/0121-Use-Provided-Case-for-Non-Existent-Offline-Players.patch +++ b/CraftBukkit-Patches/0105-Use-Provided-Case-for-Non-Existent-Offline-Players.patch @@ -1,16 +1,16 @@ -From 4f74b1d2901a50080c62871d2639c200a09272c3 Mon Sep 17 00:00:00 2001 +From 651006abcab13c8db6294b1936c319a1de892f11 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 14 Apr 2014 09:46:20 +1000 Subject: [PATCH] Use Provided Case for Non Existent Offline Players diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index a283204..bbbcc86 100644 +index edbf02f..6781a64 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -126,7 +126,7 @@ public class UserCache { - this.e.addFirst(gameprofile); - } +@@ -113,7 +113,7 @@ public class UserCache { + this.e.remove(gameprofile); + this.e.addFirst(gameprofile); } else { - gameprofile = a(this.f, s1); + gameprofile = a(this.f, s); // Spigot - use correct case for offline players @@ -18,5 +18,5 @@ index a283204..bbbcc86 100644 this.a(gameprofile); usercacheentry = (UserCacheEntry) this.c.get(s1); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0122-Check-for-blank-OfflinePlayer-Names.patch b/CraftBukkit-Patches/0106-Check-for-blank-OfflinePlayer-Names.patch similarity index 83% rename from CraftBukkit-Patches/0122-Check-for-blank-OfflinePlayer-Names.patch rename to CraftBukkit-Patches/0106-Check-for-blank-OfflinePlayer-Names.patch index 0c2fe588c1..dcc035309a 100644 --- a/CraftBukkit-Patches/0122-Check-for-blank-OfflinePlayer-Names.patch +++ b/CraftBukkit-Patches/0106-Check-for-blank-OfflinePlayer-Names.patch @@ -1,14 +1,14 @@ -From 0f3fa19dd4019cc9ecc18fae0ed3e769c17b4497 Mon Sep 17 00:00:00 2001 +From cd752d58e05020f044eb515dda5a6b2a10420e0f Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 14 Apr 2014 17:21:24 +1000 Subject: [PATCH] Check for blank OfflinePlayer Names diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a235ce8..a403509 100644 +index 5ca8cc8..ebe7abc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1392,6 +1392,7 @@ public final class CraftServer implements Server { +@@ -1269,6 +1269,7 @@ public final class CraftServer implements Server { @Deprecated public OfflinePlayer getOfflinePlayer(String name) { Validate.notNull(name, "Name cannot be null"); @@ -17,5 +17,5 @@ index a235ce8..a403509 100644 // If the name given cannot ever be a valid username give a dummy return, for scoreboard plugins if (!validUserPattern.matcher(name).matches()) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0123-Fix-Player-Banning.patch b/CraftBukkit-Patches/0107-Fix-Player-Banning.patch similarity index 91% rename from CraftBukkit-Patches/0123-Fix-Player-Banning.patch rename to CraftBukkit-Patches/0107-Fix-Player-Banning.patch index 96884c7ba7..85d0de85c1 100644 --- a/CraftBukkit-Patches/0123-Fix-Player-Banning.patch +++ b/CraftBukkit-Patches/0107-Fix-Player-Banning.patch @@ -1,4 +1,4 @@ -From 2bc9e829ba7938b9e8104c13f43f1657a1fe7513 Mon Sep 17 00:00:00 2001 +From 48893047d057daf4146813db0af4c8bb67cccb75 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 15 Apr 2014 10:32:48 +1000 Subject: [PATCH] Fix Player Banning @@ -6,10 +6,10 @@ Subject: [PATCH] Fix Player Banning This issue stems from the fact that Bukkit's API only allows a UUID to be banned, but Minecraft requires both a UUID and name. To fix this we modify the code to require a UUID or a name, or both. The correct fix would be expanding the API to be able to provide a name, however this would require plugin changes. diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -index 2943244..84f889a 100644 +index 1cd7f9c..a5803cc 100644 --- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java +++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -29,20 +29,29 @@ public class GameProfileBanEntry extends ExpirableListEntry { +@@ -28,20 +28,29 @@ public class GameProfileBanEntry extends ExpirableListEntry { } private static GameProfile b(JsonObject jsonobject) { @@ -45,5 +45,5 @@ index 2943244..84f889a 100644 } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0108-Check-for-manually-prefixed-commands-or-commands-tha.patch b/CraftBukkit-Patches/0108-Check-for-manually-prefixed-commands-or-commands-tha.patch deleted file mode 100644 index 06315878d5..0000000000 --- a/CraftBukkit-Patches/0108-Check-for-manually-prefixed-commands-or-commands-tha.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b6507b27adeaf9bfdd200dcbe04438f90f6d3776 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 23 Mar 2014 01:12:10 +0000 -Subject: [PATCH] Check for manually prefixed commands or commands that don't - need a prefix for calling vanilla commands with command blocks - - -diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index 0cd512d..278832c 100644 ---- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -110,6 +110,14 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { - } - } - -+ // Spigot start - check for manually prefixed command or commands that don't need a prefix -+ org.bukkit.command.Command commandBlockCommand = commandMap.getCommand(args[0]); -+ if (commandBlockCommand instanceof VanillaCommandWrapper) { -+ this.b = ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommandBlock(this, this.e); -+ return; -+ } -+ // Spigot end -+ - // Make sure this is a valid command - if (commandMap.getCommand(args[0]) == null) { - this.b = 0; --- -1.9.1 - diff --git a/CraftBukkit-Patches/0124-Fix-ban-expire-dates.patch b/CraftBukkit-Patches/0108-Fix-ban-expire-dates.patch similarity index 80% rename from CraftBukkit-Patches/0124-Fix-ban-expire-dates.patch rename to CraftBukkit-Patches/0108-Fix-ban-expire-dates.patch index 191e0256ca..260588c053 100644 --- a/CraftBukkit-Patches/0124-Fix-ban-expire-dates.patch +++ b/CraftBukkit-Patches/0108-Fix-ban-expire-dates.patch @@ -1,14 +1,14 @@ -From c5a05b56df22f368ac4994db0f6b0feb907658e2 Mon Sep 17 00:00:00 2001 +From 19813149ba27b60a1ab4a2a459d4f2d7d5d02126 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 16 Apr 2014 10:09:56 +1000 Subject: [PATCH] Fix ban expire dates. diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -index 84f889a..7a7bf83 100644 +index a5803cc..444f26b 100644 --- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java +++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java -@@ -13,7 +13,7 @@ public class GameProfileBanEntry extends ExpirableListEntry { +@@ -12,7 +12,7 @@ public class GameProfileBanEntry extends ExpirableListEntry { } public GameProfileBanEntry(GameProfile gameprofile, Date date, String s, Date date1, String s1) { @@ -18,5 +18,5 @@ index 84f889a..7a7bf83 100644 public GameProfileBanEntry(JsonObject jsonobject) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0109-Cap-window-names-to-prevent-client-disconnects.patch b/CraftBukkit-Patches/0109-Cap-window-names-to-prevent-client-disconnects.patch deleted file mode 100644 index 98c8fb8be9..0000000000 --- a/CraftBukkit-Patches/0109-Cap-window-names-to-prevent-client-disconnects.patch +++ /dev/null @@ -1,21 +0,0 @@ -From a0716f6300f2f86e9d18582bcab33c9218b954f8 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 23 Mar 2014 10:53:48 +0000 -Subject: [PATCH] Cap window names to prevent client disconnects - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -index f6d7b2b..860592d 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -@@ -14,6 +14,7 @@ public class PacketPlayOutOpenWindow extends Packet { - public PacketPlayOutOpenWindow() {} - - public PacketPlayOutOpenWindow(int i, int j, String s, int k, boolean flag) { -+ if (s.length() > 32) s = s.substring( 0, 32 ); // Spigot - Cap window name to prevent client disconnects - this.a = i; - this.b = j; - this.c = s; --- -1.9.1 - diff --git a/CraftBukkit-Patches/0125-Correct-Ban-Expiration.patch b/CraftBukkit-Patches/0109-Correct-Ban-Expiration.patch similarity index 84% rename from CraftBukkit-Patches/0125-Correct-Ban-Expiration.patch rename to CraftBukkit-Patches/0109-Correct-Ban-Expiration.patch index 68b6cb72c1..a99c2514fc 100644 --- a/CraftBukkit-Patches/0125-Correct-Ban-Expiration.patch +++ b/CraftBukkit-Patches/0109-Correct-Ban-Expiration.patch @@ -1,14 +1,14 @@ -From b632b4d054ddb91f93c0e3fed2ba344cc7d70749 Mon Sep 17 00:00:00 2001 +From 211fb6e77d91f4731f2bc4ccb0a548fd60c7adf8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 16 Apr 2014 11:14:38 +1000 Subject: [PATCH] Correct Ban Expiration diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index e2d3ccd..4b8835d 100644 +index 1d3d00f..c9ef1d6 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -362,7 +362,7 @@ public abstract class PlayerList { +@@ -354,7 +354,7 @@ public abstract class PlayerList { } // return s; @@ -18,5 +18,5 @@ index e2d3ccd..4b8835d 100644 // return "You are not white-listed on this server!"; event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0110-Convert-Horses-owner-to-UUID.patch b/CraftBukkit-Patches/0110-Convert-Horses-owner-to-UUID.patch new file mode 100644 index 0000000000..70f2db245a --- /dev/null +++ b/CraftBukkit-Patches/0110-Convert-Horses-owner-to-UUID.patch @@ -0,0 +1,31 @@ +From a6ff065f1b511ac3c4af5e6b87e069671024aa6a Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 16 Apr 2014 01:40:30 -0400 +Subject: [PATCH] Convert Horses owner to UUID + + +diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java +index b3ad7e7..50e9292 100644 +--- a/src/main/java/net/minecraft/server/EntityHorse.java ++++ b/src/main/java/net/minecraft/server/EntityHorse.java +@@ -1010,6 +1010,17 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { + s = nbttagcompound.getString("OwnerUUID"); + } else { + String s1 = nbttagcompound.getString("Owner"); ++ // Spigot start ++ if ( s1 == null || s1.isEmpty() ) ++ { ++ if (nbttagcompound.hasKey("OwnerName")) { ++ String owner = nbttagcompound.getString("OwnerName"); ++ if (owner != null && !owner.isEmpty()) { ++ s1 = owner; ++ } ++ } ++ } ++ // Spigot end + + s = NameReferencingFileConverter.a(s1); + } +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0110-Enable-Improved-Ping-Sending.patch b/CraftBukkit-Patches/0110-Enable-Improved-Ping-Sending.patch deleted file mode 100644 index 5a30d44a82..0000000000 --- a/CraftBukkit-Patches/0110-Enable-Improved-Ping-Sending.patch +++ /dev/null @@ -1,65 +0,0 @@ -From b78526dd306aa75104b289713e38e6830b07689a 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 a48a1c0..413af68 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -62,6 +62,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public boolean keepLevel = false; - public double maxHealthCache; - public boolean joining = true; -+ public int lastPing = -1; // Spigot - // CraftBukkit end - // Spigot start - public boolean collidesWithEntities = true; -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 01a6d66..e2d3ccd 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -793,6 +793,8 @@ public abstract class PlayerList { - // CraftBukkit end - } - -+ private int currentPing = 0; -+ - public void tick() { - if (++this.t > 600) { - this.t = 0; -@@ -805,6 +807,30 @@ public abstract class PlayerList { - this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, entityplayer.ping)); - } - // CraftBukkit end */ -+ // Spigot start -+ try -+ { -+ if ( !players.isEmpty() ) -+ { -+ currentPing = ( currentPing + 1 ) % this.players.size(); -+ EntityPlayer player = (EntityPlayer) this.players.get( currentPing ); -+ if ( player.lastPing == -1 || Math.abs( player.ping - player.lastPing ) > 20 ) -+ { -+ Packet packet = new PacketPlayOutPlayerInfo( player.listName, true, player.ping ); -+ for ( EntityPlayer splayer : (List) this.players ) -+ { -+ if ( splayer.getBukkitEntity().canSee( player.getBukkitEntity() ) ) -+ { -+ splayer.playerConnection.sendPacket( packet ); -+ } -+ } -+ player.lastPing = player.ping; -+ } -+ } -+ } catch ( Exception e ) { -+ // Better safe than sorry :) -+ } -+ // Spigot end - } - - public void sendAll(Packet packet) { --- -1.9.1 - diff --git a/CraftBukkit-Patches/0127-Expand-team-API-to-allow-arbitrary-strings.patch b/CraftBukkit-Patches/0111-Expand-team-API-to-allow-arbitrary-strings.patch similarity index 75% rename from CraftBukkit-Patches/0127-Expand-team-API-to-allow-arbitrary-strings.patch rename to CraftBukkit-Patches/0111-Expand-team-API-to-allow-arbitrary-strings.patch index a5c6ca0dce..5f3f7818d3 100644 --- a/CraftBukkit-Patches/0127-Expand-team-API-to-allow-arbitrary-strings.patch +++ b/CraftBukkit-Patches/0111-Expand-team-API-to-allow-arbitrary-strings.patch @@ -1,11 +1,11 @@ -From ae38dfbe303eecc6f2bd8c7b564055a285538be3 Mon Sep 17 00:00:00 2001 +From df4e9d4de428744c6d4813512e5e1b784ddc7231 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 17 Apr 2014 19:22:22 +1000 Subject: [PATCH] Expand team API to allow arbitrary strings. diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -index 8a640d3..a1864a5 100644 +index e38d109..a1864a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java @@ -102,6 +102,19 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -83,6 +83,33 @@ index 8a640d3..a1864a5 100644 } @Override +@@ -142,26 +177,4 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { + scoreboard.teams.remove(team.getName()); + setUnregistered(); + } +- +- // Spigot start +- @Override +- public Set getEntries() throws IllegalStateException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- +- @Override +- public void addEntry(String entry) throws IllegalStateException, IllegalArgumentException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- +- @Override +- public boolean removeEntry(String entry) throws IllegalStateException, IllegalArgumentException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- +- @Override +- public boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException { +- throw new UnsupportedOperationException("Not supported yet."); +- } +- // Spigot end + } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0128-Add-Score.isScoreSet-Z-API.patch b/CraftBukkit-Patches/0112-Add-Score.isScoreSet-Z-API.patch similarity index 71% rename from CraftBukkit-Patches/0128-Add-Score.isScoreSet-Z-API.patch rename to CraftBukkit-Patches/0112-Add-Score.isScoreSet-Z-API.patch index 6bc73c4302..68411365f7 100644 --- a/CraftBukkit-Patches/0128-Add-Score.isScoreSet-Z-API.patch +++ b/CraftBukkit-Patches/0112-Add-Score.isScoreSet-Z-API.patch @@ -1,4 +1,4 @@ -From 303d0d3c7ae9f5c287311ae30d370f42f1c0c7f2 Mon Sep 17 00:00:00 2001 +From 6cd095c137af6266b2cb60b03d75a5c6bad9adf8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 17 Apr 2014 19:35:53 +1000 Subject: [PATCH] Add Score.isScoreSet()Z API. @@ -6,7 +6,7 @@ Subject: [PATCH] Add Score.isScoreSet()Z API. Also fix generics on CraftScore.getScore()I. diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -index 7095f6d..b265616 100644 +index c7d3657..05f72df 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java @@ -41,7 +41,7 @@ final class CraftScore implements Score { @@ -18,22 +18,20 @@ index 7095f6d..b265616 100644 ScoreboardScore score = scores.get(objective.getHandle()); if (score != null) { // Lazy return score.getScore(); -@@ -55,6 +55,15 @@ final class CraftScore implements Score { - objective.checkState().board.getPlayerScoreForObjective(entry, objective.getHandle()).setScore(score); +@@ -60,9 +60,11 @@ final class CraftScore implements Score { } -+ // Spigot start + // Spigot start +- @Override + @Override -+ public boolean isScoreSet() throws IllegalStateException { + public boolean isScoreSet() throws IllegalStateException { +- throw new UnsupportedOperationException("Not supported yet."); + Scoreboard board = objective.checkState().board; + + return board.getPlayers().contains(entry) && board.getPlayerObjectives(entry).containsKey(objective.getHandle()); -+ } -+ // Spigot end -+ - public CraftScoreboard getScoreboard() { - return objective.getScoreboard(); } + // Spigot end + } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0129-Log-null-TileEntity-Owner.patch b/CraftBukkit-Patches/0113-Log-null-TileEntity-Owner.patch similarity index 73% rename from CraftBukkit-Patches/0129-Log-null-TileEntity-Owner.patch rename to CraftBukkit-Patches/0113-Log-null-TileEntity-Owner.patch index 40eddc0c64..cfb30ede1f 100644 --- a/CraftBukkit-Patches/0129-Log-null-TileEntity-Owner.patch +++ b/CraftBukkit-Patches/0113-Log-null-TileEntity-Owner.patch @@ -1,22 +1,22 @@ -From f087f08da35e91e5def285585eddaf53c3cd0a63 Mon Sep 17 00:00:00 2001 +From a55984409e30e7da590cf2e1a53fcbba4588074b Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 20 Apr 2014 11:16:54 +1000 Subject: [PATCH] Log null TileEntity Owner diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index befe9a9..ccea0b3 100644 +index a93ad27..80c7937 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -177,7 +177,14 @@ public class TileEntity { +@@ -189,7 +189,14 @@ public abstract class TileEntity { // CraftBukkit start - add method public InventoryHolder getOwner() { -- org.bukkit.block.BlockState state = world.getWorld().getBlockAt(x, y, z).getState(); +- org.bukkit.block.BlockState state = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(); + // Spigot start -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(x, y, z); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); + if (block == null) { -+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), x, y, z}); ++ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), position.getX(), position.getY(), position.getZ()}); + return null; + } + // Spigot end @@ -25,5 +25,5 @@ index befe9a9..ccea0b3 100644 return null; } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0113-Old-New-Version-Support.patch b/CraftBukkit-Patches/0113-Old-New-Version-Support.patch deleted file mode 100644 index e6d5b48b6e..0000000000 --- a/CraftBukkit-Patches/0113-Old-New-Version-Support.patch +++ /dev/null @@ -1,246 +0,0 @@ -From 0fe1567167265a10d162dfacea540c3900f364f9 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 15:11:15 +1000 -Subject: [PATCH] Old / New Version Support. - -This adds support for newer / older Minecraft versions. -At present it supports protocol versions 4 and 5 (1.7.2-1.7.8). - -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index ee24038..09fdb88 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -26,6 +26,12 @@ public class HandshakeListener implements PacketHandshakingInListener { - } - - public void a(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) { -+ // Spigot start -+ if ( NetworkManager.SUPPORTED_VERSIONS.contains( packethandshakinginsetprotocol.d() ) ) -+ { -+ NetworkManager.a( this.b ).attr( NetworkManager.protocolVersion ).set( packethandshakinginsetprotocol.d() ); -+ } -+ // Spigot end - switch (ProtocolOrdinalWrapper.a[packethandshakinginsetprotocol.c().ordinal()]) { - case 1: - this.b.a(EnumProtocol.LOGIN); -@@ -70,7 +76,7 @@ public class HandshakeListener implements PacketHandshakingInListener { - chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); - this.b.close(chatcomponenttext); -- } else if (packethandshakinginsetprotocol.d() < 5) { -+ } else if (packethandshakinginsetprotocol.d() < 4) { - chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedClientMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); - this.b.close(chatcomponenttext); -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 31d6008..04af15c 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -22,6 +22,9 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - import org.apache.logging.log4j.Marker; - import org.apache.logging.log4j.MarkerManager; -+// Spigot start -+import com.google.common.collect.ImmutableSet; -+// Spigot end - - public class NetworkManager extends SimpleChannelInboundHandler { - -@@ -47,6 +50,20 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private EnumProtocol p; - private IChatBaseComponent q; - private boolean r; -+ // Spigot Start -+ public static final AttributeKey protocolVersion = new AttributeKey("protocol_version"); -+ public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5); -+ public static final int CURRENT_VERSION = 5; -+ public static int getVersion(Channel attr) -+ { -+ Integer ver = attr.attr( protocolVersion ).get(); -+ return ( ver != null ) ? ver : CURRENT_VERSION; -+ } -+ public int getVersion() -+ { -+ return getVersion( this.m ); -+ } -+ // Spigot End - - public NetworkManager(boolean flag) { - this.j = flag; -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 8d3cf1f..a5be533 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -19,10 +19,19 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit - public class PacketDataSerializer extends ByteBuf { - - private final ByteBuf a; -+ // Spigot Start -+ public final int version; - -- public PacketDataSerializer(ByteBuf bytebuf) { -+ public PacketDataSerializer(ByteBuf bytebuf) -+ { -+ this( bytebuf, NetworkManager.CURRENT_VERSION ); -+ } -+ -+ public PacketDataSerializer(ByteBuf bytebuf, int version) { - this.a = bytebuf; -+ this.version = version; - } -+ // Spigot End - - public static int a(int i) { - return (i & -128) == 0 ? 1 : ((i & -16384) == 0 ? 2 : ((i & -2097152) == 0 ? 3 : ((i & -268435456) == 0 ? 4 : 5))); -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -new file mode 100644 -index 0000000..7994daa ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java -@@ -0,0 +1,45 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+import net.minecraft.util.com.google.common.collect.BiMap; -+import net.minecraft.util.io.netty.buffer.ByteBuf; -+import net.minecraft.util.io.netty.channel.ChannelHandlerContext; -+import net.minecraft.util.io.netty.handler.codec.MessageToByteEncoder; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+import org.apache.logging.log4j.Marker; -+import org.apache.logging.log4j.MarkerManager; -+ -+public class PacketEncoder extends MessageToByteEncoder { -+ -+ private static final Logger a = LogManager.getLogger(); -+ private static final Marker b = MarkerManager.getMarker("PACKET_SENT", NetworkManager.b); -+ private final NetworkStatistics c; -+ -+ public PacketEncoder(NetworkStatistics networkstatistics) { -+ this.c = networkstatistics; -+ } -+ -+ protected void a(ChannelHandlerContext channelhandlercontext, Packet packet, ByteBuf bytebuf) throws IOException { -+ Integer integer = (Integer) ((BiMap) channelhandlercontext.channel().attr(NetworkManager.f).get()).inverse().get(packet.getClass()); -+ -+ if (a.isDebugEnabled()) { -+ a.debug(b, "OUT: [{}:{}] {}[{}]", new Object[] { channelhandlercontext.channel().attr(NetworkManager.d).get(), integer, packet.getClass().getName(), packet.b()}); -+ } -+ -+ if (integer == null) { -+ throw new IOException("Can\'t serialize unregistered packet"); -+ } else { -+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf, NetworkManager.getVersion(channelhandlercontext.channel())); // Spigot -+ -+ packetdataserializer.b(integer.intValue()); -+ packet.b(packetdataserializer); -+ this.c.b(integer.intValue(), (long) packetdataserializer.readableBytes()); -+ } -+ } -+ -+ protected void encode(ChannelHandlerContext channelhandlercontext, Object object, ByteBuf bytebuf) throws IOException { -+ this.a(channelhandlercontext, (Packet) object, bytebuf); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketLoginOutSuccess.java b/src/main/java/net/minecraft/server/PacketLoginOutSuccess.java -new file mode 100644 -index 0000000..a244f00 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketLoginOutSuccess.java -@@ -0,0 +1,44 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.UUID; -+ -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+ -+public class PacketLoginOutSuccess extends Packet { -+ -+ private GameProfile a; -+ -+ public PacketLoginOutSuccess() {} -+ -+ public PacketLoginOutSuccess(GameProfile gameprofile) { -+ this.a = gameprofile; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ String s = packetdataserializer.c(36); -+ String s1 = packetdataserializer.c(16); -+ UUID uuid = UUID.fromString(s); -+ -+ this.a = new GameProfile(uuid, s1); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ UUID uuid = this.a.getId(); -+ -+ packetdataserializer.a(uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); -+ packetdataserializer.a(this.a.getName()); -+ } -+ -+ public void a(PacketLoginOutListener packetloginoutlistener) { -+ packetloginoutlistener.a(this); -+ } -+ -+ public boolean a() { -+ return true; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketLoginOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -index 0023f18..ccd4cec 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -@@ -66,8 +66,9 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { - packetdataserializer.b(this.a); - UUID uuid = this.b.getId(); - -- packetdataserializer.a(uuid == null ? "" : uuid.toString()); -+ packetdataserializer.a( uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); // Spigot - packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters -+ if (packetdataserializer.version >= 5 ) { // Spigot - packetdataserializer.b(this.b.getProperties().size()); - Iterator iterator = this.b.getProperties().values().iterator(); - -@@ -78,6 +79,7 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { - packetdataserializer.a(property.getValue()); - packetdataserializer.a(property.getSignature()); - } -+ } // Spigot - - packetdataserializer.writeInt(this.c); - packetdataserializer.writeInt(this.d); -diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 6423aec..f1571f1 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusListener.java -+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java -@@ -123,7 +123,7 @@ public class PacketStatusListener implements PacketStatusInListener { - ping.setFavicon(event.icon.value); - ping.setMOTD(new ChatComponentText(event.getMotd())); - ping.setPlayerSample(playerSample); -- ping.setServerInfo(new ServerPingServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), 5)); // TODO: Update when protocol changes -+ ping.setServerInfo(new ServerPingServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), networkManager.getVersion())); // TODO: Update when protocol changes - - this.networkManager.handle(new PacketStatusOutServerInfo(ping), new GenericFutureListener[0]); - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 7c3757f..2a50db9 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -23,6 +23,7 @@ public class TileEntitySkull extends TileEntity { - - GameProfileSerializer.serialize(nbttagcompound1, this.j); - nbttagcompound.set("Owner", nbttagcompound1); -+ nbttagcompound.setString("ExtraType", nbttagcompound1.getString("Name")); // Spigot - } - } - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0130-Don-t-special-case-invalid-usernames-for-UUIDs.patch b/CraftBukkit-Patches/0114-Don-t-special-case-invalid-usernames-for-UUIDs.patch similarity index 85% rename from CraftBukkit-Patches/0130-Don-t-special-case-invalid-usernames-for-UUIDs.patch rename to CraftBukkit-Patches/0114-Don-t-special-case-invalid-usernames-for-UUIDs.patch index db4588ddd9..6f1f3afbea 100644 --- a/CraftBukkit-Patches/0130-Don-t-special-case-invalid-usernames-for-UUIDs.patch +++ b/CraftBukkit-Patches/0114-Don-t-special-case-invalid-usernames-for-UUIDs.patch @@ -1,14 +1,14 @@ -From fa03cb6af4a7165e01f642d5dbc9235ef3af80d5 Mon Sep 17 00:00:00 2001 +From 7031cf8ff9e86f028c5f3bd6d9911ed290a46491 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 20 Apr 2014 18:58:00 +1000 Subject: [PATCH] Don't special case 'invalid' usernames for UUIDs. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a403509..79d4d99 100644 +index ebe7abc..3332792 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1394,11 +1394,6 @@ public final class CraftServer implements Server { +@@ -1271,11 +1271,6 @@ public final class CraftServer implements Server { Validate.notNull(name, "Name cannot be null"); com.google.common.base.Preconditions.checkArgument( !org.apache.commons.lang.StringUtils.isBlank( name ), "Name cannot be blank" ); // Spigot @@ -21,5 +21,5 @@ index a403509..79d4d99 100644 if (result == null) { // This is potentially blocking :( -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0115-Convert-player-skulls-async.patch b/CraftBukkit-Patches/0115-Convert-player-skulls-async.patch new file mode 100644 index 0000000000..4abe1e52fd --- /dev/null +++ b/CraftBukkit-Patches/0115-Convert-player-skulls-async.patch @@ -0,0 +1,223 @@ +From 2a1bd36f7c149628b85b6fb2e9e3954183cc6c22 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Sun, 20 Apr 2014 13:18:55 +0100 +Subject: [PATCH] Convert player skulls async + + +diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java +index 17e88b8..75763ab 100644 +--- a/src/main/java/net/minecraft/server/ItemSkull.java ++++ b/src/main/java/net/minecraft/server/ItemSkull.java +@@ -109,17 +109,24 @@ public class ItemSkull extends Item { + return super.a(itemstack); + } + +- public boolean a(NBTTagCompound nbttagcompound) { ++ public boolean a(final NBTTagCompound nbttagcompound) { // Spigot - make final + super.a(nbttagcompound); + if (nbttagcompound.hasKeyOfType("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) { + GameProfile gameprofile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); + +- gameprofile = TileEntitySkull.b(gameprofile); +- nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); ++ // Spigot start ++ TileEntitySkull.b(gameprofile, new com.google.common.base.Predicate() { ++ ++ @Override ++ public boolean apply(GameProfile gameprofile) { ++ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); ++ return false; ++ } ++ }); ++ // Spigot end + return true; + } else { + return false; + } + } +- + } +diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java +index 889ae50..6c33c2d 100644 +--- a/src/main/java/net/minecraft/server/TileEntitySkull.java ++++ b/src/main/java/net/minecraft/server/TileEntitySkull.java +@@ -5,11 +5,66 @@ import com.mojang.authlib.GameProfile; + import com.mojang.authlib.properties.Property; + import java.util.UUID; + ++// Spigot start ++import com.google.common.base.Predicate; ++import com.google.common.cache.LoadingCache; ++import com.google.common.cache.CacheBuilder; ++import com.google.common.cache.CacheLoader; ++import java.util.concurrent.Executor; ++import java.util.concurrent.Executors; ++import java.util.concurrent.TimeUnit; ++ ++import com.google.common.util.concurrent.ThreadFactoryBuilder; ++import com.mojang.authlib.Agent; ++// Spigot end ++ + public class TileEntitySkull extends TileEntity { + + private int a; + public int rotation; + private GameProfile g = null; ++ // Spigot start ++ public static final Executor executor = Executors.newFixedThreadPool(3, ++ new ThreadFactoryBuilder() ++ .setNameFormat("Head Conversion Thread - %1$d") ++ .build() ++ ); ++ public static final LoadingCache skinCache = CacheBuilder.newBuilder() ++ .maximumSize( 5000 ) ++ .expireAfterAccess( 60, TimeUnit.MINUTES ) ++ .build( new CacheLoader() ++ { ++ @Override ++ public GameProfile load(String key) throws Exception ++ { ++ GameProfile[] profiles = new GameProfile[1]; ++ GameProfileLookup gameProfileLookup = new GameProfileLookup(profiles); ++ ++ MinecraftServer.getServer().getGameProfileRepository().findProfilesByNames(new String[] { key }, Agent.MINECRAFT, gameProfileLookup); ++ ++ GameProfile profile = profiles[ 0 ]; ++ if (profile == null) { ++ UUID uuid = EntityHuman.a(new GameProfile(null, key)); ++ profile = new GameProfile(uuid, key); ++ ++ gameProfileLookup.onProfileLookupSucceeded(profile); ++ } else ++ { ++ ++ Property property = Iterables.getFirst( profile.getProperties().get( "textures" ), null ); ++ ++ if ( property == null ) ++ { ++ profile = MinecraftServer.getServer().aB().fillProfileProperties( profile, true ); ++ } ++ } ++ ++ ++ return profile; ++ } ++ } ); ++ ++ // Spigot end + + public TileEntitySkull() {} + +@@ -68,35 +123,58 @@ public class TileEntitySkull extends TileEntity { + } + + private void e() { +- this.g = b(this.g); +- this.update(); ++ // Spigot start ++ GameProfile profile = this.g; ++ setSkullType( 0 ); // Work around client bug ++ b(profile, new Predicate() { ++ ++ @Override ++ public boolean apply(GameProfile input) { ++ setSkullType( 3 ); // Work around client bug ++ g = input; ++ update(); ++ world.notify(position); ++ return false; ++ } ++ }); ++ // Spigot end + } + +- public static GameProfile b(GameProfile gameprofile) { ++ // Spigot start - Support async lookups ++ public static void b(final GameProfile gameprofile, final Predicate callback) { + if (gameprofile != null && !UtilColor.b(gameprofile.getName())) { + if (gameprofile.isComplete() && gameprofile.getProperties().containsKey("textures")) { +- return gameprofile; ++ callback.apply(gameprofile); + } else if (MinecraftServer.getServer() == null) { +- return gameprofile; ++ callback.apply(gameprofile); + } else { +- GameProfile gameprofile1 = MinecraftServer.getServer().getUserCache().getProfile(gameprofile.getName()); +- +- if (gameprofile1 == null) { +- return gameprofile; ++ GameProfile profile = skinCache.getIfPresent(gameprofile.getName()); ++ if (profile != null) { ++ callback.apply(profile); + } else { +- Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null); +- +- if (property == null) { +- gameprofile1 = MinecraftServer.getServer().aB().fillProfileProperties(gameprofile1, true); +- } +- +- return gameprofile1; ++ executor.execute(new Runnable() { ++ @Override ++ public void run() { ++ final GameProfile profile = skinCache.getUnchecked(gameprofile.getName().toLowerCase()); ++ MinecraftServer.getServer().processQueue.add(new Runnable() { ++ @Override ++ public void run() { ++ if (profile == null) { ++ callback.apply(gameprofile); ++ } else { ++ callback.apply(profile); ++ } ++ } ++ }); ++ } ++ }); + } + } + } else { +- return gameprofile; ++ callback.apply(gameprofile); + } + } ++ // Spigot end + + public int getSkullType() { + return this.a; +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +index 1d30e5e..e84f24c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +@@ -45,13 +45,27 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { + } + + @Override +- void applyToItem(NBTTagCompound tag) { ++ void applyToItem(final NBTTagCompound tag) { // Spigot - make final + super.applyToItem(tag); + + if (hasOwner()) { + NBTTagCompound owner = new NBTTagCompound(); + GameProfileSerializer.serialize(owner, profile); +- tag.set(SKULL_OWNER.NBT, owner); ++ tag.set( SKULL_OWNER.NBT, owner ); ++ // Spigot start - do an async lookup of the profile. ++ // Unfortunately there is not way to refresh the holding ++ // inventory, so that responsibility is left to the user. ++ net.minecraft.server.TileEntitySkull.b(profile, new com.google.common.base.Predicate() { ++ ++ @Override ++ public boolean apply(GameProfile input) { ++ NBTTagCompound owner = new NBTTagCompound(); ++ GameProfileSerializer.serialize( owner, input ); ++ tag.set( SKULL_OWNER.NBT, owner ); ++ return false; ++ } ++ }); ++ // Spigot end + } + } + +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0115-Fix-several-occurances-of-missed-diff.patch b/CraftBukkit-Patches/0115-Fix-several-occurances-of-missed-diff.patch deleted file mode 100644 index 6fd23af725..0000000000 --- a/CraftBukkit-Patches/0115-Fix-several-occurances-of-missed-diff.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 3fa3d99e8b307e03e75492ef805bae5ee4a0b7d8 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 17:49:14 +1000 -Subject: [PATCH] Fix several occurances of missed diff. - - -diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java -index d16f035..9fe2a8b 100644 ---- a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java -+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java -@@ -15,7 +15,7 @@ final class DispenseBehaviorFireball extends DispenseBehaviorItem { - EnumFacing enumfacing = BlockDispenser.b(isourceblock.h()); - IPosition iposition = BlockDispenser.a(isourceblock); - double d0 = iposition.getX() + (double) ((float) enumfacing.getAdjacentX() * 0.3F); -- double d1 = iposition.getY() + (double) ((float) enumfacing.getAdjacentY() * 0.3F); -+ double d1 = iposition.getY() + (double) ((float) enumfacing.getAdjacentX() * 0.3F); - double d2 = iposition.getZ() + (double) ((float) enumfacing.getAdjacentZ() * 0.3F); - World world = isourceblock.k(); - Random random = world.random; -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index 8a3ea63..c9f2b13 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -147,7 +147,7 @@ public class EntityBoat extends Entity { - return !this.dead; - } - -- public void h() { -+ public void h() { - // CraftBukkit start - double prevX = this.locX; - double prevY = this.locY; -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index a45bed9..98a4ac7 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -320,7 +320,7 @@ public class EntityItem extends Entity { - public ItemStack getItemStack() { - ItemStack itemstack = this.getDataWatcher().getItemStack(10); - -- return itemstack == null ? new ItemStack(Blocks.STONE) : itemstack; -+ return itemstack == null ? new ItemStack(Blocks.STONE) : itemstack; - } - - public void setItemStack(ItemStack itemstack) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 38ed1bf..c80e06f 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1738,7 +1738,7 @@ public class PlayerConnection implements PacketPlayInListener { - } - - if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.BOOK_AND_QUILL) { -- CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit -+ CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit - } - - return; -diff --git a/src/main/java/net/minecraft/server/PlayerSelector.java b/src/main/java/net/minecraft/server/PlayerSelector.java -index 819a133..14d44f0 100644 ---- a/src/main/java/net/minecraft/server/PlayerSelector.java -+++ b/src/main/java/net/minecraft/server/PlayerSelector.java -@@ -1,6 +1,10 @@ - package net.minecraft.server; - --import java.util.*; -+import java.util.Collections; -+import java.util.HashMap; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Map; - import java.util.regex.Matcher; - import java.util.regex.Pattern; - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0132-Prevent-NoClassDefError-crash-and-notify-on-crash.patch b/CraftBukkit-Patches/0116-Prevent-NoClassDefError-crash-and-notify-on-crash.patch similarity index 83% rename from CraftBukkit-Patches/0132-Prevent-NoClassDefError-crash-and-notify-on-crash.patch rename to CraftBukkit-Patches/0116-Prevent-NoClassDefError-crash-and-notify-on-crash.patch index f51f231b27..557eed5255 100644 --- a/CraftBukkit-Patches/0132-Prevent-NoClassDefError-crash-and-notify-on-crash.patch +++ b/CraftBukkit-Patches/0116-Prevent-NoClassDefError-crash-and-notify-on-crash.patch @@ -1,14 +1,14 @@ -From a37a61a62676afd0be16d7b334cdeef1ce07762c Mon Sep 17 00:00:00 2001 +From f1584ab1932c38af97d243a0ee2f9ec3cb57db32 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Apr 2014 12:43:08 +0100 Subject: [PATCH] Prevent NoClassDefError crash and notify on crash diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 554023a..e7cf335 100644 +index d525845..ffcef45 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -111,6 +111,8 @@ public abstract class World implements IBlockAccess { +@@ -118,6 +118,8 @@ public abstract class World implements IBlockAccess { protected float growthOdds = 100; protected float modifiedOdds = 100; private final byte chunkTickRadius; @@ -17,13 +17,13 @@ index 554023a..e7cf335 100644 public static long chunkToKey(int x, int z) { -@@ -631,6 +633,9 @@ public abstract class World implements IBlockAccess { +@@ -518,6 +520,9 @@ public abstract class World implements IBlockAccess { + } // CraftBukkit end - - block1.doPhysics(this, i, j, k, block); + iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block); + } catch (StackOverflowError stackoverflowerror) { // Spigot Start + haveWeSilencedAPhysicsCrash = true; -+ blockLocation = i + ", " + j + ", " + k; // Spigot End ++ blockLocation = blockposition.getX() + ", " + blockposition.getY() + ", " + blockposition.getZ(); // Spigot End } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated"); @@ -46,5 +46,5 @@ index de08ad6..94a3d42 100644 log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" ); dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0116-Update-Warning.patch b/CraftBukkit-Patches/0116-Update-Warning.patch deleted file mode 100644 index d3d6c639e6..0000000000 --- a/CraftBukkit-Patches/0116-Update-Warning.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 4abb7113bcfaae67d5d20c7764d4fb045b6c9e1c Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 12 Apr 2014 21:37:12 +1000 -Subject: [PATCH] Update Warning - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 008e037..1977722 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -1,10 +1,13 @@ - package org.bukkit.craftbukkit; - -+import java.io.BufferedReader; - import java.io.File; - import java.io.IOException; -+import java.io.InputStreamReader; - import java.text.SimpleDateFormat; - import java.util.Arrays; - import java.util.List; -+import java.util.concurrent.TimeUnit; - import java.util.logging.Level; - import java.util.logging.Logger; - import joptsimple.OptionParser; -@@ -15,7 +18,28 @@ public class Main { - public static boolean useJline = true; - public static boolean useConsole = true; - -- public static void main(String[] args) { -+ public static void main(String[] args) throws IOException { -+ // Spigot Start -+ File lock = new File( ".update-lock" ); -+ if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null ) -+ { -+ System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." ); -+ System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" ); -+ System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" ); -+ System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" ); -+ System.err.println( "Please type yes to continue starting the server. You have been warned :)" ); -+ System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" ); -+ System.err.println( "=================================================================================" ); -+ System.err.println( "Starting server in 10 seconds" ); -+ lock.createNewFile(); -+ try -+ { -+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -+ } catch ( InterruptedException ex ) -+ { -+ } -+ } -+ // Spigot End - // Todo: Installation script - OptionParser parser = new OptionParser() { - { --- -1.9.1 - diff --git a/CraftBukkit-Patches/0117-Check-Skull-canPlace.patch b/CraftBukkit-Patches/0117-Check-Skull-canPlace.patch new file mode 100644 index 0000000000..e9c54329b6 --- /dev/null +++ b/CraftBukkit-Patches/0117-Check-Skull-canPlace.patch @@ -0,0 +1,26 @@ +From 4ab9e517242a81a3b7e6c4d6e473586b64798ef0 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Tue, 15 Apr 2014 10:48:35 +1000 +Subject: [PATCH] Check Skull canPlace + + +diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java +index 75763ab..7f727f5 100644 +--- a/src/main/java/net/minecraft/server/ItemSkull.java ++++ b/src/main/java/net/minecraft/server/ItemSkull.java +@@ -35,6 +35,12 @@ public class ItemSkull extends Item { + return false; + } else { + if (!world.isStatic) { ++ // Spigot Start ++ if ( !Blocks.SKULL.canPlace( world, blockposition ) ) ++ { ++ return false; ++ } ++ // Spigot End + world.setTypeAndData(blockposition, Blocks.SKULL.getBlockData().set(BlockSkull.FACING, enumdirection), 3); + int i = 0; + +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0118-Don-t-let-trees-replace-any-block.patch b/CraftBukkit-Patches/0118-Don-t-let-trees-replace-any-block.patch new file mode 100644 index 0000000000..289956ff87 --- /dev/null +++ b/CraftBukkit-Patches/0118-Don-t-let-trees-replace-any-block.patch @@ -0,0 +1,30 @@ +From 7892209204e55e33e095667978ad2537387a7ab2 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Mon, 20 Jan 2014 20:42:28 +0000 +Subject: [PATCH] Don't let trees replace any block. + + +diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java +index 2653bd8..dd9e5b6 100644 +--- a/src/main/java/net/minecraft/server/WorldGenForestTree.java ++++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java +@@ -123,7 +123,15 @@ public class WorldGenForestTree extends WorldGenTreeAbstract { + int k2; + + for (k2 = 0; k2 < j2; ++k2) { +- this.a(world, new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ // Spigot start ++ BlockPosition position = new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2); ++ Block bl = world.getType(position).getBlock(); ++ ++ if (bl.getMaterial() == Material.AIR || bl.getMaterial() == Material.LEAVES) ++ { ++ this.a(world, position, Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4); ++ } ++ // Spigot end + } + + int l2; +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0135-Fix-race-condition-that-could-kill-connections-befor.patch b/CraftBukkit-Patches/0119-Fix-race-condition-that-could-kill-connections-befor.patch similarity index 52% rename from CraftBukkit-Patches/0135-Fix-race-condition-that-could-kill-connections-befor.patch rename to CraftBukkit-Patches/0119-Fix-race-condition-that-could-kill-connections-befor.patch index c6b180d6a6..89b0a77270 100644 --- a/CraftBukkit-Patches/0135-Fix-race-condition-that-could-kill-connections-befor.patch +++ b/CraftBukkit-Patches/0119-Fix-race-condition-that-could-kill-connections-befor.patch @@ -1,4 +1,4 @@ -From ee1c3f527f82e3988082a725c9f1705be9fa36af Mon Sep 17 00:00:00 2001 +From 1e92c6509e0e9d5ecb2e7aa2f19617a12ec57a89 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Fri, 25 Apr 2014 23:46:46 +0200 Subject: [PATCH] Fix race condition that could kill connections before they @@ -12,52 +12,52 @@ initialized. The ServerConnection does not remove NetworkManagers with this flag. diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 9939652..ae3de2f 100644 +index 65b66cd..b4eb893 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -45,6 +45,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { - public SocketAddress n; +@@ -35,6 +35,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + public SocketAddress j; public java.util.UUID spoofedUUID; - public Property[] spoofedProfile; + public com.mojang.authlib.properties.Property[] spoofedProfile; + public boolean preparing = true; // Spigot End - private PacketListener o; - private EnumProtocol p; -@@ -73,6 +74,9 @@ public class NetworkManager extends SimpleChannelInboundHandler { + private PacketListener k; + private IChatBaseComponent l; +@@ -49,6 +50,9 @@ public class NetworkManager extends SimpleChannelInboundHandler { super.channelActive(channelhandlercontext); - this.m = channelhandlercontext.channel(); - this.n = this.m.remoteAddress(); + this.i = channelhandlercontext.channel(); + this.j = this.i.remoteAddress(); + // Spigot Start + this.preparing = false; + // Spigot End - this.a(EnumProtocol.HANDSHAKING); - } -@@ -191,6 +195,9 @@ public class NetworkManager extends SimpleChannelInboundHandler { + try { + this.a(EnumProtocol.HANDSHAKING); +@@ -163,6 +167,9 @@ public class NetworkManager extends SimpleChannelInboundHandler { } public void close(IChatBaseComponent ichatbasecomponent) { + // Spigot Start + this.preparing = false; + // Spigot End - if (this.m.isOpen()) { - this.m.close(); - this.q = ichatbasecomponent; + if (this.i.isOpen()) { + this.i.close(); // We can't wait as this may be called from an event loop. + this.l = ichatbasecomponent; diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 1d7b814..981e22c 100644 +index 6c6ffa7..de1b3d1 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -66,6 +66,10 @@ public class ServerConnection { - NetworkManager networkmanager = (NetworkManager) iterator.next(); +@@ -71,6 +71,10 @@ public class ServerConnection { - if (!networkmanager.isConnected()) { -+ // Spigot Start -+ // Fix a race condition where a NetworkManager could be unregistered just before connection. -+ if (networkmanager.preparing) continue; -+ // Spigot End - iterator.remove(); - if (networkmanager.f() != null) { - networkmanager.getPacketListener().a(networkmanager.f()); + if (!networkmanager.h()) { + if (!networkmanager.g()) { ++ // Spigot Start ++ // Fix a race condition where a NetworkManager could be unregistered just before connection. ++ if (networkmanager.preparing) continue; ++ // Spigot End + iterator.remove(); + networkmanager.l(); + } else { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0136-Configurable-UserCache-cap.patch b/CraftBukkit-Patches/0120-Configurable-UserCache-cap.patch similarity index 87% rename from CraftBukkit-Patches/0136-Configurable-UserCache-cap.patch rename to CraftBukkit-Patches/0120-Configurable-UserCache-cap.patch index 0825d88d11..3fdcd90cdc 100644 --- a/CraftBukkit-Patches/0136-Configurable-UserCache-cap.patch +++ b/CraftBukkit-Patches/0120-Configurable-UserCache-cap.patch @@ -1,14 +1,14 @@ -From b458354ebda3ba3293c16ef0428adcc057d82bc7 Mon Sep 17 00:00:00 2001 +From 187a5144128bba37d75c79f0167430ad60daefeb Mon Sep 17 00:00:00 2001 From: drXor Date: Fri, 25 Apr 2014 18:17:30 -0400 Subject: [PATCH] Configurable UserCache cap diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index bbbcc86..4aea9df 100644 +index 6781a64..3eeaf09 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -206,7 +206,7 @@ public class UserCache { +@@ -186,7 +186,7 @@ public class UserCache { } public void c() { @@ -18,7 +18,7 @@ index bbbcc86..4aea9df 100644 try { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a299317..8e4e7db 100644 +index 4932990..d416087 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -315,4 +315,10 @@ public class SpigotConfig @@ -33,5 +33,5 @@ index a299317..8e4e7db 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0137-Implement-PlayerSpawnLocationEvent.patch b/CraftBukkit-Patches/0121-Implement-PlayerSpawnLocationEvent.patch similarity index 73% rename from CraftBukkit-Patches/0137-Implement-PlayerSpawnLocationEvent.patch rename to CraftBukkit-Patches/0121-Implement-PlayerSpawnLocationEvent.patch index b9c733ef6f..95f25ce23d 100644 --- a/CraftBukkit-Patches/0137-Implement-PlayerSpawnLocationEvent.patch +++ b/CraftBukkit-Patches/0121-Implement-PlayerSpawnLocationEvent.patch @@ -1,14 +1,14 @@ -From 65748d5b5c27ce3e6ad792546a6a63e2080c703e Mon Sep 17 00:00:00 2001 +From e29720f25bab51a25058725b7f0f30f34a1d0fa7 Mon Sep 17 00:00:00 2001 From: ninja Date: Tue, 8 Apr 2014 14:05:19 +0200 Subject: [PATCH] Implement PlayerSpawnLocationEvent. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 4b8835d..ea9fcd9 100644 +index c9ef1d6..26e4328 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -36,6 +36,7 @@ import org.bukkit.event.player.PlayerQuitEvent; +@@ -35,6 +35,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.util.Vector; @@ -16,7 +16,7 @@ index 4b8835d..ea9fcd9 100644 // CraftBukkit end public abstract class PlayerList { -@@ -99,6 +100,19 @@ public abstract class PlayerList { +@@ -98,6 +99,19 @@ public abstract class PlayerList { s1 = networkmanager.getSocketAddress().toString(); } @@ -30,12 +30,12 @@ index 4b8835d..ea9fcd9 100644 + + entityplayer.spawnIn(world); + entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); -+ entityplayer.b(loc.getYaw(), loc.getPitch()); // should be setYawAndPitch ++ entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); + // Spigot end + // CraftBukkit - Moved message to after join - // g.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); + // PlayerList.h.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0138-Cap-Objective-Score-Length.patch b/CraftBukkit-Patches/0122-Cap-Objective-Score-Length.patch similarity index 93% rename from CraftBukkit-Patches/0138-Cap-Objective-Score-Length.patch rename to CraftBukkit-Patches/0122-Cap-Objective-Score-Length.patch index 67484b5b24..fec2f8d040 100644 --- a/CraftBukkit-Patches/0138-Cap-Objective-Score-Length.patch +++ b/CraftBukkit-Patches/0122-Cap-Objective-Score-Length.patch @@ -1,4 +1,4 @@ -From 05e8e914587c986d255d977e92562967cb30090c Mon Sep 17 00:00:00 2001 +From 1677b5fe5a8148b445d67addaa3fe06a8125d307 Mon Sep 17 00:00:00 2001 From: hauno Date: Tue, 6 May 2014 18:01:37 -0700 Subject: [PATCH] Cap Objective Score Length @@ -18,5 +18,5 @@ index 9eaec71..0ee1147 100644 return new CraftScore(this, entry); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0139-Process-conversation-input-on-the-main-thread.-Fixes.patch b/CraftBukkit-Patches/0123-Process-conversation-input-on-the-main-thread.-Fixes.patch similarity index 86% rename from CraftBukkit-Patches/0139-Process-conversation-input-on-the-main-thread.-Fixes.patch rename to CraftBukkit-Patches/0123-Process-conversation-input-on-the-main-thread.-Fixes.patch index ffa3807c36..3a792027e1 100644 --- a/CraftBukkit-Patches/0139-Process-conversation-input-on-the-main-thread.-Fixes.patch +++ b/CraftBukkit-Patches/0123-Process-conversation-input-on-the-main-thread.-Fixes.patch @@ -1,4 +1,4 @@ -From cdebce86adaadaadf62ba9da318d1b391499d756 Mon Sep 17 00:00:00 2001 +From efcae0ea82f494d81f9f307481d0f80e89248576 Mon Sep 17 00:00:00 2001 From: riking Date: Wed, 14 May 2014 13:46:48 -0700 Subject: [PATCH] Process conversation input on the main thread. Fixes @@ -6,10 +6,10 @@ Subject: [PATCH] Process conversation input on the main thread. Fixes diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index c80e06f..024ec84 100644 +index f100076..7d1a1a9 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -835,7 +835,18 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -925,7 +925,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } else if (s.isEmpty()) { c.warn(this.player.getName() + " tried to send an empty message"); } else if (getPlayer().isConversing()) { @@ -30,5 +30,5 @@ index c80e06f..024ec84 100644 ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0140-Configurable-save-on-stop-only-for-UserCache.patch b/CraftBukkit-Patches/0124-Configurable-save-on-stop-only-for-UserCache.patch similarity index 78% rename from CraftBukkit-Patches/0140-Configurable-save-on-stop-only-for-UserCache.patch rename to CraftBukkit-Patches/0124-Configurable-save-on-stop-only-for-UserCache.patch index 478df1829f..c15741466a 100644 --- a/CraftBukkit-Patches/0140-Configurable-save-on-stop-only-for-UserCache.patch +++ b/CraftBukkit-Patches/0124-Configurable-save-on-stop-only-for-UserCache.patch @@ -1,32 +1,33 @@ -From 96a3ae527b81f56bc3cbcefebc0b5baa7d25a979 Mon Sep 17 00:00:00 2001 +From 1463e9101902bc0ae222eaa38f5520cf6fe64e6d Mon Sep 17 00:00:00 2001 From: drXor Date: Fri, 23 May 2014 18:05:10 -0400 Subject: [PATCH] Configurable save-on-stop-only for UserCache diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c62d9fe..d5d9ebc 100644 +index bbe16d8..9080d46 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -419,6 +419,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - if (this.l.d()) { - this.l.e(); +@@ -457,7 +457,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + if (this.m.d()) { + this.m.e(); } +- + // Spigot start + if( org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) + { -+ i.info("Saving usercache.json"); -+ this.X.c(); ++ LOGGER.info("Saving usercache.json"); ++ this.Z.c(); + } + //Spigot end } } diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 4aea9df..9f7de3f 100644 +index 3eeaf09..03abfbd 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -133,7 +133,7 @@ public class UserCache { +@@ -120,7 +120,7 @@ public class UserCache { } } @@ -36,7 +37,7 @@ index 4aea9df..9f7de3f 100644 } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 8e4e7db..46c8573 100644 +index d416087..78dcb39 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -321,4 +321,10 @@ public class SpigotConfig @@ -51,5 +52,5 @@ index 8e4e7db..46c8573 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0141-Prevent-Unbounded-IntCache-Growth.patch b/CraftBukkit-Patches/0125-Prevent-Unbounded-IntCache-Growth.patch similarity index 67% rename from CraftBukkit-Patches/0141-Prevent-Unbounded-IntCache-Growth.patch rename to CraftBukkit-Patches/0125-Prevent-Unbounded-IntCache-Growth.patch index b9ea33f1b6..f75e5be39f 100644 --- a/CraftBukkit-Patches/0141-Prevent-Unbounded-IntCache-Growth.patch +++ b/CraftBukkit-Patches/0125-Prevent-Unbounded-IntCache-Growth.patch @@ -1,4 +1,4 @@ -From 2538f25c2c2b5dd9756a12393995575467da8bb5 Mon Sep 17 00:00:00 2001 +From a1c304d35d21c963d6e0af8e8fcf81d2e21dfe74 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 20 Jun 2014 19:40:00 +1000 Subject: [PATCH] Prevent Unbounded IntCache Growth @@ -6,44 +6,44 @@ Subject: [PATCH] Prevent Unbounded IntCache Growth Based on work by Peter Lawrey, this commit prevents unbounded growth of the integer cache and instead caps it to a value specified in the configuration (1024 by default). Should prevent thrashing, especially around world generation. diff --git a/src/main/java/net/minecraft/server/IntCache.java b/src/main/java/net/minecraft/server/IntCache.java -index 9858720..47e06df 100644 +index 4b4f005..0d8eb6c 100644 --- a/src/main/java/net/minecraft/server/IntCache.java +++ b/src/main/java/net/minecraft/server/IntCache.java @@ -17,11 +17,11 @@ public class IntCache { if (i <= 256) { - if (b.isEmpty()) { + if (IntCache.b.isEmpty()) { aint = new int[256]; -- c.add(aint); -+ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) c.add(aint); +- IntCache.c.add(aint); ++ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.c.add(aint); return aint; } else { - aint = (int[]) b.remove(b.size() - 1); -- c.add(aint); -+ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) c.add(aint); + aint = (int[]) IntCache.b.remove(IntCache.b.size() - 1); +- IntCache.c.add(aint); ++ if (c.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.c.add(aint); return aint; } - } else if (i > a) { + } else if (i > IntCache.a) { @@ -29,15 +29,15 @@ public class IntCache { - d.clear(); - e.clear(); - aint = new int[a]; -- e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) e.add(aint); + IntCache.d.clear(); + IntCache.e.clear(); + aint = new int[IntCache.a]; +- IntCache.e.add(aint); ++ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); return aint; - } else if (d.isEmpty()) { - aint = new int[a]; -- e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) e.add(aint); + } else if (IntCache.d.isEmpty()) { + aint = new int[IntCache.a]; +- IntCache.e.add(aint); ++ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); return aint; } else { - aint = (int[]) d.remove(d.size() - 1); -- e.add(aint); -+ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) e.add(aint); + aint = (int[]) IntCache.d.remove(IntCache.d.size() - 1); +- IntCache.e.add(aint); ++ if (e.size() < org.spigotmc.SpigotConfig.intCacheLimit) IntCache.e.add(aint); return aint; } } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 46c8573..429ad36 100644 +index 78dcb39..c5e995b 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -327,4 +327,10 @@ public class SpigotConfig @@ -58,5 +58,5 @@ index 46c8573..429ad36 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0143-Add-damager-to-the-unhandled-error.patch b/CraftBukkit-Patches/0126-Add-damager-to-the-unhandled-error.patch similarity index 86% rename from CraftBukkit-Patches/0143-Add-damager-to-the-unhandled-error.patch rename to CraftBukkit-Patches/0126-Add-damager-to-the-unhandled-error.patch index 57378561ad..d63081b6e0 100644 --- a/CraftBukkit-Patches/0143-Add-damager-to-the-unhandled-error.patch +++ b/CraftBukkit-Patches/0126-Add-damager-to-the-unhandled-error.patch @@ -1,23 +1,23 @@ -From 24e4d0079e6a7c6761cd2177da4808c123443542 Mon Sep 17 00:00:00 2001 +From 53a832abd832282aeb012b6f1415e06101219bfc Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Thu, 26 Jun 2014 23:42:52 +0100 Subject: [PATCH] Add damager to the unhandled error diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 029652d..d452df7 100644 +index 982e45c..2f3ff86 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -207,7 +207,7 @@ public class CraftEventFactory { +@@ -184,7 +184,7 @@ public class CraftEventFactory { */ public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) { if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) { - throw new AssertionError(String.format("%s performing %s with %s", who, action, itemstack)); + throw new IllegalArgumentException(String.format("%s performing %s with %s", who, action, itemstack)); // Spigot } - return callPlayerInteractEvent(who, action, 0, 256, 0, 0, itemstack); + return callPlayerInteractEvent(who, action, new BlockPosition(0, 256, 0), EnumDirection.SOUTH, itemstack); } -@@ -484,7 +484,7 @@ public class CraftEventFactory { +@@ -468,7 +468,7 @@ public class CraftEventFactory { if (source == DamageSource.CACTUS) { cause = DamageCause.CONTACT; } else { @@ -26,7 +26,7 @@ index 029652d..d452df7 100644 } EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions)); if (!event.isCancelled()) { -@@ -502,7 +502,7 @@ public class CraftEventFactory { +@@ -486,7 +486,7 @@ public class CraftEventFactory { } else if (source == DamageSource.FALL) { cause = DamageCause.FALL; } else { @@ -35,7 +35,7 @@ index 029652d..d452df7 100644 } EntityDamageEvent event = callEvent(new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions)); if (!event.isCancelled()) { -@@ -540,7 +540,7 @@ public class CraftEventFactory { +@@ -524,7 +524,7 @@ public class CraftEventFactory { return callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions); } @@ -45,5 +45,5 @@ index 029652d..d452df7 100644 private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map modifiers, Map> modifierFunctions) { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0126-Convert-Horses-owner-to-UUID.patch b/CraftBukkit-Patches/0126-Convert-Horses-owner-to-UUID.patch deleted file mode 100644 index e3535ac0b0..0000000000 --- a/CraftBukkit-Patches/0126-Convert-Horses-owner-to-UUID.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 209855fb703c6c4774a4f7302391651c241b80f7 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 16 Apr 2014 01:40:30 -0400 -Subject: [PATCH] Convert Horses owner to UUID - - -diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java -index d167c00..e9f6236 100644 ---- a/src/main/java/net/minecraft/server/EntityHorse.java -+++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -993,6 +993,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { - if (nbttagcompound.hasKeyOfType("OwnerUUID", 8)) { - this.setOwnerUUID(nbttagcompound.getString("OwnerUUID")); - } -+ // Spigot start -+ else if (nbttagcompound.hasKey("OwnerName")) { -+ String owner = nbttagcompound.getString("OwnerName"); -+ if (owner != null && !owner.isEmpty()) { -+ this.setOwnerUUID(NameReferencingFileConverter.a(owner)); -+ } -+ } -+ // Spigot end - // CraftBukkit start - if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) { - this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication"); --- -1.9.1 - diff --git a/CraftBukkit-Patches/0144-Cross-World-Entity-Teleportation.patch b/CraftBukkit-Patches/0127-Cross-World-Entity-Teleportation.patch similarity index 88% rename from CraftBukkit-Patches/0144-Cross-World-Entity-Teleportation.patch rename to CraftBukkit-Patches/0127-Cross-World-Entity-Teleportation.patch index 999bb5a528..51da0394e5 100644 --- a/CraftBukkit-Patches/0144-Cross-World-Entity-Teleportation.patch +++ b/CraftBukkit-Patches/0127-Cross-World-Entity-Teleportation.patch @@ -1,4 +1,4 @@ -From 25ffe3f52540b14262b4e05644da51bcc11f6b09 Mon Sep 17 00:00:00 2001 +From 92032898faf2c92ba9bd4172815ae3a0394d2cdf Mon Sep 17 00:00:00 2001 From: Andrew Krieger Date: Tue, 24 Dec 2013 07:55:23 -0800 Subject: [PATCH] Cross World Entity Teleportation @@ -6,10 +6,10 @@ Subject: [PATCH] Cross World Entity Teleportation Use Entity.teleportTo for cross-world teleportation in CraftEntity. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index ce18aea..1c8099d 100644 +index c50396d..7e87fed 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -208,7 +208,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -212,7 +212,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { // If this entity is riding another entity, we must dismount before teleporting. entity.mount(null); @@ -26,5 +26,5 @@ index ce18aea..1c8099d 100644 // entity.setLocation() throws no event, and so cannot be cancelled return true; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0145-Limit-block-placement-interaction-packets.patch b/CraftBukkit-Patches/0128-Limit-block-placement-interaction-packets.patch similarity index 59% rename from CraftBukkit-Patches/0145-Limit-block-placement-interaction-packets.patch rename to CraftBukkit-Patches/0128-Limit-block-placement-interaction-packets.patch index da508ba552..7b8d3a2ffe 100644 --- a/CraftBukkit-Patches/0145-Limit-block-placement-interaction-packets.patch +++ b/CraftBukkit-Patches/0128-Limit-block-placement-interaction-packets.patch @@ -1,15 +1,15 @@ -From 5ad9406667740590bcb08088bfb97e48d3bd5c22 Mon Sep 17 00:00:00 2001 +From 6652d07bcd30b9459e23d686c0c4d2cc04ae5a4c Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sun, 29 Jun 2014 21:10:34 +0100 Subject: [PATCH] Limit block placement/interaction packets diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 024ec84..bd61823 100644 +index 7d1a1a9..5c71b5d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -573,7 +573,20 @@ public class PlayerConnection implements PacketPlayInListener { - } +@@ -621,9 +621,22 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + // CraftBukkit end } + // Spigot start - limit place/interactions @@ -17,6 +17,8 @@ index 024ec84..bd61823 100644 + private int packets = 0; + public void a(PacketPlayInBlockPlace packetplayinblockplace) { + PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + boolean throttled = false; + if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { + throttled = true; @@ -26,10 +28,10 @@ index 024ec84..bd61823 100644 + packets = 0; + } + // Spigot end - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - + // CraftBukkit start -@@ -616,10 +629,14 @@ public class PlayerConnection implements PacketPlayInListener { + if (this.player.dead) return; +@@ -663,10 +676,14 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit start int itemstackAmount = itemstack.count; @@ -44,15 +46,15 @@ index 024ec84..bd61823 100644 // CraftBukkit - notch decrements the counter by 1 in the above method with food, // snowballs and so forth, but he does it in a place that doesn't cause the -@@ -640,7 +657,7 @@ public class PlayerConnection implements PacketPlayInListener { - return; +@@ -692,7 +709,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList } -- if (!this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j())) { -+ if (throttled || !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j())) { // Spigot - skip the event if throttled - always = true; // force PacketPlayOutSetSlot to be sent to client to update ItemStack count + if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.af().a(blockposition)) { +- always = !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); ++ always = throttled || !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); } // CraftBukkit end + -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0146-Better-item-validation.patch b/CraftBukkit-Patches/0129-Better-item-validation.patch similarity index 83% rename from CraftBukkit-Patches/0146-Better-item-validation.patch rename to CraftBukkit-Patches/0129-Better-item-validation.patch index f53bf9ab0e..b61997a300 100644 --- a/CraftBukkit-Patches/0146-Better-item-validation.patch +++ b/CraftBukkit-Patches/0129-Better-item-validation.patch @@ -1,15 +1,15 @@ -From d81b7d5688c033fe2bcf6b8d001c40f0610cb933 Mon Sep 17 00:00:00 2001 +From b8b26fc29e5aa514a8e5986dba2bd809424d67cb Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Wed, 2 Jul 2014 23:35:51 +0100 Subject: [PATCH] Better item validation diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index e368514..395d054 100644 +index 966d737..ca3469f 100644 --- a/src/main/java/net/minecraft/server/DataWatcher.java +++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -149,6 +149,17 @@ public class DataWatcher { - arraylist = new ArrayList(); +@@ -154,6 +154,17 @@ public class DataWatcher { + arraylist = Lists.newArrayList(); } + // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions @@ -26,7 +26,7 @@ index e368514..395d054 100644 arraylist.add(watchableobject); } } -@@ -180,6 +191,21 @@ public class DataWatcher { +@@ -185,6 +196,21 @@ public class DataWatcher { this.f.readLock().lock(); arraylist.addAll(this.dataValues.valueCollection()); // Spigot @@ -49,27 +49,27 @@ index e368514..395d054 100644 this.f.readLock().unlock(); return arraylist; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index a5be533..e4df5b3 100644 +index 8b7dc17..5227007 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -97,6 +97,10 @@ public class PacketDataSerializer extends ByteBuf { +@@ -172,6 +172,10 @@ public class PacketDataSerializer extends ByteBuf { NBTTagCompound nbttagcompound = null; - if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) { + if (itemstack.getItem().usesDurability() || itemstack.getItem().p()) { + // Spigot start - filter + itemstack = itemstack.cloneItemStack(); + CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); + // Spigot end - nbttagcompound = itemstack.tag; + nbttagcompound = itemstack.getTag(); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index 1cf8fce..bdc6364 100644 +index 9a24d2e..d3b5002 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -@@ -17,6 +17,10 @@ import com.google.common.base.Strings; - import com.google.common.collect.ImmutableList; - import com.google.common.collect.ImmutableMap.Builder; +@@ -20,6 +20,10 @@ import net.minecraft.server.ChatSerializer; + import net.minecraft.server.NBTTagString; + import org.bukkit.craftbukkit.util.CraftChatMessage; +// Spigot start +import static org.spigotmc.ValidateUtils.*; @@ -78,7 +78,7 @@ index 1cf8fce..bdc6364 100644 @DelegateDeserialization(SerializableMeta.class) class CraftMetaBook extends CraftMetaItem implements BookMeta { static final ItemMetaKey BOOK_TITLE = new ItemMetaKey("title"); -@@ -45,11 +49,11 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { +@@ -54,11 +58,11 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { super(tag); if (tag.hasKey(BOOK_TITLE.NBT)) { @@ -90,17 +90,17 @@ index 1cf8fce..bdc6364 100644 - this.author = tag.getString(BOOK_AUTHOR.NBT); + this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 1024 ); // Spigot } - - if (tag.hasKey(BOOK_PAGES.NBT)) { -@@ -57,7 +61,7 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { - String[] pageArray = new String[pages.size()]; - - for (int i = 0; i < pages.size(); i++) { -- String page = pages.getString(i); -+ String page = limit( pages.getString(i), 2048 ); // Spigot - pageArray[i] = page; + + if (tag.hasKey(RESOLVED.NBT)) { +@@ -78,7 +82,7 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { + if (resolved != null && resolved) { + page = CraftChatMessage.fromComponent(ChatSerializer.a(page)); + } +- pageArray[i] = page; ++ pageArray[i] = limit( page, 2048 ); // Spigot } + addPage(pageArray); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index 32d4a67..53c3f6c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -155,5 +155,5 @@ index 0000000..58a9534 + } +} -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0147-Further-Seed-Customisation.patch b/CraftBukkit-Patches/0130-Further-Seed-Customisation.patch similarity index 77% rename from CraftBukkit-Patches/0147-Further-Seed-Customisation.patch rename to CraftBukkit-Patches/0130-Further-Seed-Customisation.patch index 9918f422f1..b05556fac5 100644 --- a/CraftBukkit-Patches/0147-Further-Seed-Customisation.patch +++ b/CraftBukkit-Patches/0130-Further-Seed-Customisation.patch @@ -1,4 +1,4 @@ -From 36eae16a6ef2da76399fd0daf0cbae68994534f2 Mon Sep 17 00:00:00 2001 +From ea4d6da1f8cc62b3f906849b558ddf6e543253a4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 4 Jul 2014 13:28:45 +1000 Subject: [PATCH] Further Seed Customisation @@ -6,33 +6,33 @@ Subject: [PATCH] Further Seed Customisation Allow server admins that really want to to customise the seeds used in world generation even further. diff --git a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -index 1e5efc4..72f5d10 100644 +index 02e6208..0bd6783 100644 --- a/src/main/java/net/minecraft/server/WorldGenLargeFeature.java +++ b/src/main/java/net/minecraft/server/WorldGenLargeFeature.java -@@ -53,7 +53,7 @@ public class WorldGenLargeFeature extends StructureGenerator { +@@ -54,7 +54,7 @@ public class WorldGenLargeFeature extends StructureGenerator { int i1 = i / this.g; int j1 = j / this.g; -- Random random = this.c.A(i1, j1, 14357617); -+ Random random = this.c.A(i1, j1, this.c.spigotConfig.largeFeatureSeed); // Spigot +- Random random = this.c.a(i1, j1, 14357617); ++ Random random = this.c.a(i1, j1, this.c.spigotConfig.largeFeatureSeed); // Spigot i1 *= this.g; j1 *= this.g; diff --git a/src/main/java/net/minecraft/server/WorldGenVillage.java b/src/main/java/net/minecraft/server/WorldGenVillage.java -index 7ca18a1..8d1721a 100644 +index 375de85..bf699af 100644 --- a/src/main/java/net/minecraft/server/WorldGenVillage.java +++ b/src/main/java/net/minecraft/server/WorldGenVillage.java -@@ -52,7 +52,7 @@ public class WorldGenVillage extends StructureGenerator { +@@ -53,7 +53,7 @@ public class WorldGenVillage extends StructureGenerator { int i1 = i / this.g; int j1 = j / this.g; -- Random random = this.c.A(i1, j1, 10387312); -+ Random random = this.c.A(i1, j1, this.c.spigotConfig.villageSeed); // Spigot +- Random random = this.c.a(i1, j1, 10387312); ++ Random random = this.c.a(i1, j1, this.c.spigotConfig.villageSeed); // Spigot i1 *= this.g; j1 *= this.g; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 3e6b1e6..2073732 100644 +index 7904926..df43af5 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -292,4 +292,13 @@ public class SpigotWorldConfig @@ -50,5 +50,5 @@ index 3e6b1e6..2073732 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0131-Convert-player-skulls-async.patch b/CraftBukkit-Patches/0131-Convert-player-skulls-async.patch deleted file mode 100644 index 215ef33d60..0000000000 --- a/CraftBukkit-Patches/0131-Convert-player-skulls-async.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 9a18280069d9e62073e94dddba10714c382583a3 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sun, 20 Apr 2014 13:18:55 +0100 -Subject: [PATCH] Convert player skulls async - - -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 7d2d401..ee82aba 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -216,9 +216,61 @@ public final class ItemStack { - if (nbttagcompound.hasKeyOfType("tag", 10)) { - // CraftBukkit - make defensive copy as this data may be coming from the save thread - this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone(); -+ validateSkullSkin(); // Spigot - } - } - -+ // Spigot start - make sure the tag is given the full gameprofile if it's a skull (async lookup) -+ public void validateSkullSkin() -+ { -+ if ( this.item == Items.SKULL && this.getData() == 3 ) -+ { -+ String owner; -+ if ( this.tag.hasKeyOfType( "SkullOwner", 8 ) ) -+ { -+ owner = this.tag.getString( "SkullOwner" ); -+ } else if ( this.tag.hasKeyOfType( "SkullOwner", 10 ) ) -+ { -+ net.minecraft.util.com.mojang.authlib.GameProfile profile = GameProfileSerializer.deserialize( this.tag.getCompound( "SkullOwner" ) ); -+ if ( profile == null || !profile.getProperties().isEmpty() ) -+ { -+ return; -+ } else -+ { -+ owner = profile.getName(); -+ } -+ } else -+ { -+ return; -+ } -+ -+ final String finalOwner = owner; -+ TileEntitySkull.executor.execute( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ -+ final net.minecraft.util.com.mojang.authlib.GameProfile profile = TileEntitySkull.skinCache.getUnchecked( finalOwner.toLowerCase() ); -+ if ( profile != null ) -+ { -+ MinecraftServer.getServer().processQueue.add( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ NBTTagCompound nbtProfile = new NBTTagCompound(); -+ GameProfileSerializer.serialize( nbtProfile, profile ); -+ ItemStack.this.tag.set( "SkullOwner", nbtProfile ); -+ } -+ } ); -+ } -+ } -+ } ); -+ } -+ } -+ // Spigot end -+ - public int getMaxStackSize() { - return this.getItem().getMaxStackSize(); - } -@@ -457,6 +509,7 @@ public final class ItemStack { - - public void setTag(NBTTagCompound nbttagcompound) { - this.tag = nbttagcompound; -+ validateSkullSkin(); // Spigot - } - - public String getName() { -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 2a50db9..1796a56 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -6,11 +6,64 @@ import net.minecraft.util.com.google.common.collect.Iterables; - import net.minecraft.util.com.mojang.authlib.GameProfile; - import net.minecraft.util.com.mojang.authlib.properties.Property; - -+// Spigot start -+import com.google.common.cache.Cache; -+import com.google.common.cache.CacheBuilder; -+import com.google.common.cache.CacheLoader; -+import java.util.concurrent.Executor; -+import java.util.concurrent.Executors; -+import java.util.concurrent.TimeUnit; -+ -+import com.google.common.util.concurrent.ThreadFactoryBuilder; -+import net.minecraft.util.com.mojang.authlib.Agent; -+// Spigot end -+ - public class TileEntitySkull extends TileEntity { - - private int a; - private int i; - private GameProfile j = null; -+ // Spigot start -+ public static final Executor executor = Executors.newFixedThreadPool(3, -+ new ThreadFactoryBuilder() -+ .setNameFormat("Head Conversion Thread - %1$d") -+ .build() -+ ); -+ public static final Cache skinCache = CacheBuilder.newBuilder() -+ .maximumSize( 5000 ) -+ .expireAfterAccess( 60, TimeUnit.MINUTES ) -+ .build( new CacheLoader() -+ { -+ @Override -+ public GameProfile load(String key) throws Exception -+ { -+ GameProfile[] profiles = new GameProfile[1]; -+ GameProfileLookup gameProfileLookup = new GameProfileLookup(profiles); -+ -+ MinecraftServer.getServer().getGameProfileRepository().findProfilesByNames(new String[] { key }, Agent.MINECRAFT, gameProfileLookup); -+ -+ GameProfile profile = profiles[ 0 ]; -+ if (profile == null) { -+ UUID uuid = EntityHuman.a(new GameProfile(null, key)); -+ profile = new GameProfile(uuid, key); -+ -+ gameProfileLookup.onProfileLookupSucceeded(profile); -+ } else -+ { -+ -+ Property property = Iterables.getFirst( profile.getProperties().get( "textures" ), null ); -+ -+ if ( property == null ) -+ { -+ profile = MinecraftServer.getServer().av().fillProfileProperties( profile, true ); -+ } -+ } -+ -+ -+ return profile; -+ } -+ } ); -+ // Spigot end - - public TileEntitySkull() {} - -@@ -66,18 +119,38 @@ public class TileEntitySkull extends TileEntity { - private void d() { - if (this.j != null && !UtilColor.b(this.j.getName())) { - if (!this.j.isComplete() || !this.j.getProperties().containsKey("textures")) { -- GameProfile gameprofile = MinecraftServer.getServer().getUserCache().getProfile(this.j.getName()); -- -- if (gameprofile != null) { -- Property property = (Property) Iterables.getFirst(gameprofile.getProperties().get("textures"), null); -- -- if (property == null) { -- gameprofile = MinecraftServer.getServer().av().fillProfileProperties(gameprofile, true); -+ // Spigot start - Handle async -+ final String name = this.j.getName(); -+ setSkullType( 0 ); // Work around a client bug -+ executor.execute(new Runnable() { -+ @Override -+ public void run() { -+ -+ GameProfile profile = skinCache.getUnchecked( name.toLowerCase() ); -+ -+ if (profile != null) { -+ final GameProfile finalProfile = profile; -+ MinecraftServer.getServer().processQueue.add(new Runnable() { -+ @Override -+ public void run() { -+ a = 3; -+ j = finalProfile; -+ world.notify( x, y, z ); -+ } -+ }); -+ } else { -+ MinecraftServer.getServer().processQueue.add(new Runnable() { -+ @Override -+ public void run() { -+ a = 3; -+ j = new GameProfile( null, name ); -+ world.notify( x, y, z ); -+ } -+ }); -+ } - } -- -- this.j = gameprofile; -- this.update(); -- } -+ }); -+ // Spigot end - } - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index d648d05..e32bcb1 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -46,13 +46,39 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { - } - - @Override -- void applyToItem(NBTTagCompound tag) { -+ void applyToItem(final NBTTagCompound tag) { // Spigot - make final - super.applyToItem(tag); - - if (hasOwner()) { - NBTTagCompound owner = new NBTTagCompound(); - GameProfileSerializer.serialize(owner, profile); -- tag.set(SKULL_OWNER.NBT, owner); -+ tag.set( SKULL_OWNER.NBT, owner ); -+ // Spigot start - do an async lookup of the profile. -+ // Unfortunately there is not way to refresh the holding -+ // inventory, so that responsibility is left to the user. -+ net.minecraft.server.TileEntitySkull.executor.execute( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ -+ final GameProfile profile = net.minecraft.server.TileEntitySkull.skinCache.getUnchecked( CraftMetaSkull.this.profile.getName().toLowerCase() ); -+ if ( profile != null ) -+ { -+ MinecraftServer.getServer().processQueue.add( new Runnable() -+ { -+ @Override -+ public void run() -+ { -+ NBTTagCompound owner = new NBTTagCompound(); -+ GameProfileSerializer.serialize( owner, profile ); -+ tag.set( SKULL_OWNER.NBT, owner ); -+ } -+ } ); -+ } -+ } -+ } ); -+ // Spigot end - } - } - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0148-Disable-ResourceLeakDetector.patch b/CraftBukkit-Patches/0131-Disable-ResourceLeakDetector.patch similarity index 56% rename from CraftBukkit-Patches/0148-Disable-ResourceLeakDetector.patch rename to CraftBukkit-Patches/0131-Disable-ResourceLeakDetector.patch index a54c1255b2..c906d3404e 100644 --- a/CraftBukkit-Patches/0148-Disable-ResourceLeakDetector.patch +++ b/CraftBukkit-Patches/0131-Disable-ResourceLeakDetector.patch @@ -1,4 +1,4 @@ -From f27c7a8f1e0005e654683f8f538fcd823f2e9f49 Mon Sep 17 00:00:00 2001 +From e5c6a31967f7fe53fb805eb3b15d35dcf69d2de5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 8 Jul 2014 09:01:50 +1000 Subject: [PATCH] Disable ResourceLeakDetector @@ -6,17 +6,17 @@ Subject: [PATCH] Disable ResourceLeakDetector Hopefully no plugins are somehow leaking buffers, but disabling the ResourceLeakDetector is a good thing for performance of the Netty IO subsytem (it's been disabled in BungeeCord for a while now). diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d5d9ebc..b905c6e 100644 +index 9080d46..7bfd6f5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -115,6 +115,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -126,6 +126,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet -+ net.minecraft.util.io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable - this.X = new UserCache(this, a); - j = this; + public MinecraftServer(OptionSet options, Proxy proxy, File file1) { ++ io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable this.d = proxy; + MinecraftServer.k = this; + // this.universe = file; // CraftBukkit -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0149-Add-More-Information-to-session.lock-Errors.patch b/CraftBukkit-Patches/0132-Add-More-Information-to-session.lock-Errors.patch similarity index 90% rename from CraftBukkit-Patches/0149-Add-More-Information-to-session.lock-Errors.patch rename to CraftBukkit-Patches/0132-Add-More-Information-to-session.lock-Errors.patch index 4d65a64f9d..df78f9c9d3 100644 --- a/CraftBukkit-Patches/0149-Add-More-Information-to-session.lock-Errors.patch +++ b/CraftBukkit-Patches/0132-Add-More-Information-to-session.lock-Errors.patch @@ -1,15 +1,15 @@ -From 061a6b2daa24da1fe8e7b138d556d42d40014383 Mon Sep 17 00:00:00 2001 +From ee84e35a34635073821681a872a0c682ed16d8ac Mon Sep 17 00:00:00 2001 From: Suddenly Date: Sat, 5 Jul 2014 16:56:44 +0100 Subject: [PATCH] Add More Information to session.lock Errors diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index efdcad7..141248e 100644 +index ee79cbd..b187aed 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java @@ -54,7 +54,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - } + } catch (IOException ioexception) { ioexception.printStackTrace(); - throw new RuntimeException("Failed to check session lock, aborting"); @@ -17,7 +17,7 @@ index efdcad7..141248e 100644 } } -@@ -69,13 +69,13 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { +@@ -69,14 +69,14 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { try { if (datainputstream.readLong() != this.sessionId) { @@ -27,6 +27,7 @@ index efdcad7..141248e 100644 } finally { datainputstream.close(); } + } catch (IOException ioexception) { - throw new ExceptionWorldConflict("Failed to check session lock, aborting"); + throw new ExceptionWorldConflict("Failed to check session lock for world located at " + this.baseDir + ", aborting. Stop the server and delete the session.lock in this world to prevent further issues."); // Spigot @@ -34,5 +35,5 @@ index efdcad7..141248e 100644 } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0133-Check-Skull-canPlace.patch b/CraftBukkit-Patches/0133-Check-Skull-canPlace.patch deleted file mode 100644 index 138c45e919..0000000000 --- a/CraftBukkit-Patches/0133-Check-Skull-canPlace.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 308a3495c74811af7e4a3e2c48b3582be94d2b80 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 15 Apr 2014 10:48:35 +1000 -Subject: [PATCH] Check Skull canPlace - - -diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java -index 4a40068..3deacc6 100644 ---- a/src/main/java/net/minecraft/server/ItemSkull.java -+++ b/src/main/java/net/minecraft/server/ItemSkull.java -@@ -42,6 +42,12 @@ public class ItemSkull extends Item { - } - - if (!world.isStatic) { -+ // Spigot Start -+ if ( !Blocks.SKULL.canPlace( world, i, j, k ) ) -+ { -+ return false; -+ } -+ // Spigot End - world.setTypeAndData(i, j, k, Blocks.SKULL, l, 2); - int i1 = 0; - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0150-Safer-JSON-Loading.patch b/CraftBukkit-Patches/0133-Safer-JSON-Loading.patch similarity index 80% rename from CraftBukkit-Patches/0150-Safer-JSON-Loading.patch rename to CraftBukkit-Patches/0133-Safer-JSON-Loading.patch index 5534ccd664..3f7c93871c 100644 --- a/CraftBukkit-Patches/0150-Safer-JSON-Loading.patch +++ b/CraftBukkit-Patches/0133-Safer-JSON-Loading.patch @@ -1,22 +1,22 @@ -From 1bba17d0ad3cff7e6fd825bf56a06f6677ae7d9f Mon Sep 17 00:00:00 2001 +From 59a9427226a9623432dfd92ea0cf7273e5beb2c2 Mon Sep 17 00:00:00 2001 From: Suddenly Date: Tue, 8 Jul 2014 09:44:18 +1000 Subject: [PATCH] Safer JSON Loading diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index 9d1cb33..71ae29e 100644 +index 61c676a..af2e2d1 100644 --- a/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -146,6 +146,17 @@ public class JsonList { +@@ -149,6 +149,17 @@ public class JsonList { try { bufferedreader = Files.newReader(this.c, Charsets.UTF_8); - collection = (Collection) this.b.fromJson(bufferedreader, f); + collection = (Collection) this.b.fromJson(bufferedreader, JsonList.f); + // Spigot Start + } catch ( java.io.FileNotFoundException ex ) + { + org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Unable to find file {0}, creating it.", this.c ); -+ } catch ( net.minecraft.util.com.google.gson.JsonSyntaxException ex ) ++ } catch ( com.google.gson.JsonSyntaxException ex ) + { + org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Unable to read file {0}, backing it up to {0}.backup and creating new copy.", this.c ); + File backup = new File( this.c + ".backup" ); @@ -27,15 +27,15 @@ index 9d1cb33..71ae29e 100644 IOUtils.closeQuietly(bufferedreader); } diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 9f7de3f..1ce89c4 100644 +index 03abfbd..bd35a0f 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -176,6 +176,11 @@ public class UserCache { - break label81; +@@ -160,6 +160,11 @@ public class UserCache { + break label64; } catch (FileNotFoundException filenotfoundexception) { ; + // Spigot Start -+ } catch (net.minecraft.util.com.google.gson.JsonSyntaxException ex) { ++ } catch (com.google.gson.JsonSyntaxException ex) { + JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." ); + this.g.delete(); + // Spigot End @@ -43,5 +43,5 @@ index 9f7de3f..1ce89c4 100644 IOUtils.closeQuietly(bufferedreader); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0134-Don-t-let-trees-replace-any-block.patch b/CraftBukkit-Patches/0134-Don-t-let-trees-replace-any-block.patch deleted file mode 100644 index f49af7c2e1..0000000000 --- a/CraftBukkit-Patches/0134-Don-t-let-trees-replace-any-block.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 70092df3110e536484714196a0aeb5b23e57b54d Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 20 Jan 2014 20:42:28 +0000 -Subject: [PATCH] Don't let trees replace any block. - - -diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java -index c0d0ff9..6196163 100644 ---- a/src/main/java/net/minecraft/server/WorldGenForestTree.java -+++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java -@@ -124,7 +124,12 @@ public class WorldGenForestTree extends WorldGenTreeAbstract { - int k3; - - for (k3 = 0; k3 < j3; ++k3) { -- this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1); -+ Block block = world.getType(i + l2, k2 - k3 - 1, k + i3); -+ -+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) -+ { -+ this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1); -+ } - } - - int l3; --- -1.9.1 - diff --git a/CraftBukkit-Patches/0151-Fix-Slow-Loading-Libraries.patch b/CraftBukkit-Patches/0134-Fix-Slow-Loading-Libraries.patch similarity index 82% rename from CraftBukkit-Patches/0151-Fix-Slow-Loading-Libraries.patch rename to CraftBukkit-Patches/0134-Fix-Slow-Loading-Libraries.patch index 4e924c209d..f263d98632 100644 --- a/CraftBukkit-Patches/0151-Fix-Slow-Loading-Libraries.patch +++ b/CraftBukkit-Patches/0134-Fix-Slow-Loading-Libraries.patch @@ -1,14 +1,14 @@ -From d3c8c980c0032e1455f3e5eb47f906adbd9e2b66 Mon Sep 17 00:00:00 2001 +From 32c93e286834918ddb5277838a61aba5aa092f5e Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 8 Jul 2014 20:27:52 +1000 Subject: [PATCH] Fix Slow "Loading Libraries" diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 1977722..e5f73fc 100644 +index 008e037..46ba3ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -195,7 +195,6 @@ public class Main { +@@ -171,7 +171,6 @@ public class Main { System.out.println( "Please see http://www.spigotmc.org/wiki/changing-permgen-size/ for more details and more in-depth instructions." ); } // Spigot End @@ -17,16 +17,16 @@ index 1977722..e5f73fc 100644 } catch (Throwable t) { t.printStackTrace(); diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml -index 36eff85..e2209b8 100644 +index 36eff85..08d68aa 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -1,5 +1,5 @@ - -+ ++ -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0152-Add-CommandLine-EULA-Flag.patch b/CraftBukkit-Patches/0135-Add-CommandLine-EULA-Flag.patch similarity index 78% rename from CraftBukkit-Patches/0152-Add-CommandLine-EULA-Flag.patch rename to CraftBukkit-Patches/0135-Add-CommandLine-EULA-Flag.patch index 7a67e40788..6667cec19d 100644 --- a/CraftBukkit-Patches/0152-Add-CommandLine-EULA-Flag.patch +++ b/CraftBukkit-Patches/0135-Add-CommandLine-EULA-Flag.patch @@ -1,4 +1,4 @@ -From 89afc891b03326b9f792ed4077498387590172cf Mon Sep 17 00:00:00 2001 +From 71bb568a74fc8d0eb13e3d8cb51dc53ab5d6da4c Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 9 Jul 2014 10:35:44 +1000 Subject: [PATCH] Add CommandLine EULA Flag @@ -8,14 +8,14 @@ This flag contains the same message as eula.txt (albeit with proper grammar for This feature only exists for hosting companies and people who manage servers in bulk who wish to agree to the terms by setting a flag in a script. diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 12e8b14..9cc0526 100644 +index 80755dd..2806f1e 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -77,7 +77,16 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - i.info("Loading properties"); + DedicatedServer.LOGGER.info("Loading properties"); this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support - this.n = new EULA(new File("eula.txt")); -- if (!this.n.a()) { + this.o = new EULA(new File("eula.txt")); +- if (!this.o.a()) { + // Spigot Start + boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); + if ( eulaAgreed ) @@ -25,10 +25,10 @@ index 12e8b14..9cc0526 100644 + System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); + } + // Spigot End -+ if (!this.n.a() && !eulaAgreed) { - i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); - this.n.b(); ++ if (!this.o.a() && !eulaAgreed) { // Spigot + DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + this.o.b(); return false; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0154-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch b/CraftBukkit-Patches/0136-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch similarity index 86% rename from CraftBukkit-Patches/0154-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch rename to CraftBukkit-Patches/0136-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch index 14b94c9487..9dfcd460dc 100644 --- a/CraftBukkit-Patches/0154-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch +++ b/CraftBukkit-Patches/0136-Fix-for-enchanting-table-wiping-meta-when-placing-st.patch @@ -1,4 +1,4 @@ -From afa18162ec0cd28a5513fa02f86d3132cd7fac57 Mon Sep 17 00:00:00 2001 +From 4a220fe89e54e214aae790044acc43470f50e452 Mon Sep 17 00:00:00 2001 From: drXor Date: Thu, 17 Jul 2014 21:13:15 -0400 Subject: [PATCH] Fix for enchanting table wiping meta when placing stacked @@ -6,10 +6,10 @@ Subject: [PATCH] Fix for enchanting table wiping meta when placing stacked diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java -index 5f948e4..af3aa1d 100644 +index 7938983..8b3a0e6 100644 --- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java +++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java -@@ -249,7 +249,11 @@ public class ContainerEnchantTable extends Container { +@@ -311,7 +311,11 @@ public class ContainerEnchantTable extends Container { ((Slot) this.c.get(0)).set(itemstack1.cloneItemStack()); itemstack1.count = 0; } else if (itemstack1.count >= 1) { @@ -23,5 +23,5 @@ index 5f948e4..af3aa1d 100644 } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0155-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch b/CraftBukkit-Patches/0137-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch similarity index 63% rename from CraftBukkit-Patches/0155-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch rename to CraftBukkit-Patches/0137-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch index 489104544a..83060c608c 100644 --- a/CraftBukkit-Patches/0155-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch +++ b/CraftBukkit-Patches/0137-Don-t-spawn-bonus-ocelots-when-plugins-spawn-ocelots.patch @@ -1,35 +1,35 @@ -From 324451287f5331413823a6e2ffe14e9d8c3cbbec Mon Sep 17 00:00:00 2001 +From e5c1ec8f79b8656fb5d055fa3bddd83f9110443f Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 19 Jul 2014 12:49:48 +0100 Subject: [PATCH] Don't spawn bonus ocelots when plugins spawn ocelots diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index aba3748..22aac7b 100644 +index 9d09404..7ae68bb 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -2,6 +2,7 @@ package net.minecraft.server; - - public class EntityOcelot extends EntityTameableAnimal { +@@ -6,6 +6,7 @@ public class EntityOcelot extends EntityTameableAnimal { + private PathfinderGoalAvoidTarget bm; + private PathfinderGoalTempt bn; + public boolean spawnBonus = true; // Spigot - private PathfinderGoalTempt bq; public EntityOcelot(World world) { -@@ -213,7 +214,7 @@ public class EntityOcelot extends EntityTameableAnimal { + super(world); +@@ -226,7 +227,7 @@ public class EntityOcelot extends EntityTameableAnimal { - public GroupDataEntity prepare(GroupDataEntity groupdataentity) { - groupdataentity = super.prepare(groupdataentity); + public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, GroupDataEntity groupdataentity) { + groupdataentity = super.prepare(difficultydamagescaler, groupdataentity); - if (this.world.random.nextInt(7) == 0) { + if (spawnBonus && this.world.random.nextInt(7) == 0) { // Spigot for (int i = 0; i < 2; ++i) { EntityOcelot entityocelot = new EntityOcelot(this.world); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 92f7188..ea786ae 100644 +index 50fdfcd..d5ea292 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1056,6 +1056,12 @@ public class CraftWorld implements World { +@@ -1066,6 +1066,12 @@ public class CraftWorld implements World { } if (entity != null) { @@ -40,8 +40,8 @@ index 92f7188..ea786ae 100644 + } + // Spigot end if (entity instanceof EntityInsentient) { - ((EntityInsentient) entity).prepare((GroupDataEntity) null); + ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0156-Prevent-a-crash-involving-attributes.patch b/CraftBukkit-Patches/0138-Prevent-a-crash-involving-attributes.patch similarity index 69% rename from CraftBukkit-Patches/0156-Prevent-a-crash-involving-attributes.patch rename to CraftBukkit-Patches/0138-Prevent-a-crash-involving-attributes.patch index ab6dc08b36..ba7554fe0d 100644 --- a/CraftBukkit-Patches/0156-Prevent-a-crash-involving-attributes.patch +++ b/CraftBukkit-Patches/0138-Prevent-a-crash-involving-attributes.patch @@ -1,18 +1,18 @@ -From 80ddf0886e3309efbfc551db05b5af628c3baea0 Mon Sep 17 00:00:00 2001 +From 82207506f2e55fe35c4a416b8cc970bc2690c8a3 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 19 Jul 2014 19:54:41 +0100 Subject: [PATCH] Prevent a crash involving attributes diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 27d3715..e7569c6 100644 +index 75061e6..5864a51 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1287,7 +1287,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1309,7 +1309,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { break; } } -- collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); +- collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + // Spigot start + double healthMod = scaledHealth ? healthScale : getMaxHealth(); + if ( healthMod >= Float.MAX_VALUE || healthMod <= 0 ) @@ -20,11 +20,11 @@ index 27d3715..e7569c6 100644 + healthMod = 20; // Reset health + getServer().getLogger().warning( getName() + " tried to crash the server with a large health attribute" ); + } -+ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged("generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); ++ collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", healthMod, 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + // Spigot end } // Spigot start -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0158-Make-moved-wrongly-limit-configurable.patch b/CraftBukkit-Patches/0139-Make-moved-wrongly-limit-configurable.patch similarity index 71% rename from CraftBukkit-Patches/0158-Make-moved-wrongly-limit-configurable.patch rename to CraftBukkit-Patches/0139-Make-moved-wrongly-limit-configurable.patch index 83ed0cc5eb..1fbc4f9f2c 100644 --- a/CraftBukkit-Patches/0158-Make-moved-wrongly-limit-configurable.patch +++ b/CraftBukkit-Patches/0139-Make-moved-wrongly-limit-configurable.patch @@ -1,25 +1,25 @@ -From 77928f8b84ccf7abeb9851cf4963e3e8953eb376 Mon Sep 17 00:00:00 2001 +From a9c4fa7d4061258d818ac02f6474535f963d6451 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Fri, 4 Jul 2014 23:03:13 +0200 Subject: [PATCH] Make "moved wrongly" limit configurable diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index bd61823..845fbc4 100644 +index 5c71b5d..44ec70d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -399,7 +399,8 @@ public class PlayerConnection implements PacketPlayInListener { - d10 = d4 * d4 + d5 * d5 + d6 * d6; +@@ -411,7 +411,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + d17 = d11 * d11 + d12 * d12 + d13 * d13; boolean flag1 = false; -- if (d10 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { +- if (d17 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { + // Spigot: make "moved wrongly" limit configurable -+ if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { ++ if (d17 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { flag1 = true; - c.warn(this.player.getName() + " moved wrongly!"); + PlayerConnection.c.warn(this.player.getName() + " moved wrongly!"); } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 429ad36..6a230f9 100644 +index c5e995b..759a95a 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -333,4 +333,10 @@ public class SpigotConfig @@ -34,5 +34,5 @@ index 429ad36..6a230f9 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0159-Fix-Null-Tile-Entity-Worlds.patch b/CraftBukkit-Patches/0140-Fix-Null-Tile-Entity-Worlds.patch similarity index 71% rename from CraftBukkit-Patches/0159-Fix-Null-Tile-Entity-Worlds.patch rename to CraftBukkit-Patches/0140-Fix-Null-Tile-Entity-Worlds.patch index f4e1908ee2..3e5688372a 100644 --- a/CraftBukkit-Patches/0159-Fix-Null-Tile-Entity-Worlds.patch +++ b/CraftBukkit-Patches/0140-Fix-Null-Tile-Entity-Worlds.patch @@ -1,21 +1,21 @@ -From 5925f83872343e107f0cea12eef3f240f68822e1 Mon Sep 17 00:00:00 2001 +From 168f7a3f93e3692a7b18d5626048051418f141a2 Mon Sep 17 00:00:00 2001 From: "Evan A. Haskell" Date: Thu, 26 Jun 2014 18:37:29 -0400 Subject: [PATCH] Fix Null Tile Entity Worlds diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e7cf335..c4fb3d8 100644 +index ffcef45..2f79c83 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1956,6 +1956,7 @@ public abstract class World implements IBlockAccess { +@@ -1859,6 +1859,7 @@ public abstract class World implements IBlockAccess { } } + tileentity.a(this); // Spigot - No null worlds this.a.add(tileentity); } else { - this.tileEntityList.add(tileentity); + this.a(tileentity); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0160-Make-moved-too-quickly-limit-configurable.patch b/CraftBukkit-Patches/0141-Make-moved-too-quickly-limit-configurable.patch similarity index 61% rename from CraftBukkit-Patches/0160-Make-moved-too-quickly-limit-configurable.patch rename to CraftBukkit-Patches/0141-Make-moved-too-quickly-limit-configurable.patch index cbc7c16e1f..c837d557f2 100644 --- a/CraftBukkit-Patches/0160-Make-moved-too-quickly-limit-configurable.patch +++ b/CraftBukkit-Patches/0141-Make-moved-too-quickly-limit-configurable.patch @@ -1,25 +1,25 @@ -From 033bce7fffd491b87a0e51002dcfef51ece8b4ab Mon Sep 17 00:00:00 2001 +From e31fe51a2bf30cec67cd6c0b5a0e2b3347679644 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Tue, 22 Jul 2014 15:59:01 +0200 Subject: [PATCH] Make "moved too quickly" limit configurable diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 845fbc4..2b764b5 100644 +index 44ec70d..2bfa289 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -371,7 +371,8 @@ public class PlayerConnection implements PacketPlayInListener { +@@ -384,7 +384,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList // CraftBukkit end - double d10 = d7 * d7 + d8 * d8 + d9 * d9; + double d17 = d14 * d14 + d15 * d15 + d16 * d16; -- if (d10 > 100.0D && this.checkMovement && (!this.minecraftServer.N() || !this.minecraftServer.M().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports +- if (d17 > 100.0D && this.checkMovement && (!this.minecraftServer.S() || !this.minecraftServer.R().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports + // Spigot: make "moved too quickly" limit configurable -+ if (d10 > org.spigotmc.SpigotConfig.movedTooQuicklyThreshold && this.checkMovement && (!this.minecraftServer.N() || !this.minecraftServer.M().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports - c.warn(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")"); - this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch); ++ if (d17 > org.spigotmc.SpigotConfig.movedTooQuicklyThreshold && this.checkMovement && (!this.minecraftServer.S() || !this.minecraftServer.R().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports + PlayerConnection.c.warn(this.player.getName() + " moved too quickly! " + d11 + "," + d12 + "," + d13 + " (" + d14 + ", " + d15 + ", " + d16 + ")"); + this.a(this.o, this.p, this.q, this.player.yaw, this.player.pitch); return; diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 6a230f9..0a63291 100644 +index 759a95a..8233de7 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -339,4 +339,10 @@ public class SpigotConfig @@ -34,5 +34,5 @@ index 6a230f9..0a63291 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0161-Alternative-Hopper-Ticking.patch b/CraftBukkit-Patches/0142-Alternative-Hopper-Ticking.patch similarity index 69% rename from CraftBukkit-Patches/0161-Alternative-Hopper-Ticking.patch rename to CraftBukkit-Patches/0142-Alternative-Hopper-Ticking.patch index 4e36356b7b..892ce94c55 100644 --- a/CraftBukkit-Patches/0161-Alternative-Hopper-Ticking.patch +++ b/CraftBukkit-Patches/0142-Alternative-Hopper-Ticking.patch @@ -1,42 +1,42 @@ -From dd8aa3f1e67f6339ed38fec6ec2a1a86db18d696 Mon Sep 17 00:00:00 2001 +From c9c4e4ee3d6001e4e4978dd4bbb3ab2b0822d192 Mon Sep 17 00:00:00 2001 From: "Evan A. Haskell" Date: Sat, 19 Apr 2014 16:58:26 -0400 Subject: [PATCH] Alternative Hopper Ticking diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java -index b85b72f..b33ed64 100644 +index cc3e340..9a6ecbb 100644 --- a/src/main/java/net/minecraft/server/BlockHopper.java +++ b/src/main/java/net/minecraft/server/BlockHopper.java -@@ -87,6 +87,17 @@ public class BlockHopper extends BlockContainer { +@@ -88,6 +88,17 @@ public class BlockHopper extends BlockContainer { - if (flag != flag1) { - world.setData(i, j, k, i1 | (flag ? 0 : 8), 4); + if (flag != ((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) { + world.setTypeAndData(blockposition, iblockdata.set(BlockHopper.ENABLED, Boolean.valueOf(flag)), 4); + // Spigot start - When this hopper becomes unpowered, make it active. + // Called when this block's power level changes. flag1 is the current + // isNotPowered from metadata. flag is the recalculated isNotPowered. + if (world.spigotConfig.altHopperTicking) { + // e returns the TileEntityHopper associated with this BlockHopper. -+ TileEntityHopper hopper = e((IBlockAccess) world, i, j, k); ++ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition); + if (flag && hopper != null) { + hopper.makeTick(); + } + } + // Spigot end } - } -@@ -163,4 +174,17 @@ public class BlockHopper extends BlockContainer { - public static TileEntityHopper e(IBlockAccess iblockaccess, int i, int j, int k) { - return (TileEntityHopper) iblockaccess.getTileEntity(i, j, k); + } +@@ -149,4 +160,17 @@ public class BlockHopper extends BlockContainer { + protected BlockStateList getStateList() { + return new BlockStateList(this, new IBlockState[] { BlockHopper.FACING, BlockHopper.ENABLED}); } + + // Spigot start - Use random block updates to make hoppers active. + @Override -+ public void a(World world, int i, int j, int k, Random random) { ++ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, java.util.Random random) { + if (world.spigotConfig.altHopperTicking) { + // e returns the TileEntityHopper associated with this BlockHopper. -+ TileEntityHopper hopper = e((IBlockAccess) world, i, j, k); ++ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition); + if (hopper != null) { + hopper.makeTick(); + } @@ -45,13 +45,13 @@ index b85b72f..b33ed64 100644 + // Spigot end } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index cbcc9e9..0423ee9 100644 +index e664e55..858e12c 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -750,6 +750,11 @@ public class Chunk { +@@ -763,6 +763,11 @@ public class Chunk { - tileentity.t(); - this.tileEntities.put(chunkposition, tileentity); + tileentity.D(); + this.tileEntities.put(blockposition, tileentity); + // Spigot start - The tile entity has a world, now hoppers can be born ticking. + if (this.world.spigotConfig.altHopperTicking) { + this.world.triggerHoppersList.add(tileentity); @@ -59,28 +59,28 @@ index cbcc9e9..0423ee9 100644 + // Spigot end // CraftBukkit start } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 98a4ac7..a61e91a 100644 +index e35f78f..fc34447 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -102,6 +102,27 @@ public class EntityItem extends Entity { +@@ -100,6 +100,27 @@ public class EntityItem extends Entity { if (this.onGround) { this.motY *= -0.5D; } + // Spigot start - Make the hopper(s) below this item active. + // Called each tick on each item entity. + if (this.world.spigotConfig.altHopperTicking) { -+ int xi = MathHelper.floor(this.boundingBox.a); -+ int yi = MathHelper.floor(this.boundingBox.b) - 1; -+ int zi = MathHelper.floor(this.boundingBox.c); -+ int xf = MathHelper.floor(this.boundingBox.d); -+ int yf = MathHelper.floor(this.boundingBox.e) - 1; -+ int zf = MathHelper.floor(this.boundingBox.f); ++ int xi = MathHelper.floor(this.getBoundingBox().a); ++ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; ++ int zi = MathHelper.floor(this.getBoundingBox().c); ++ int xf = MathHelper.floor(this.getBoundingBox().d); ++ int yf = MathHelper.floor(this.getBoundingBox().e) - 1; ++ int zf = MathHelper.floor(this.getBoundingBox().f); + for (int a = xi; a <= xf; a++) { + for (int c = zi; c <= zf; c++) { + for (int b = yi; b <= yf; b++) { -+ TileEntity tileEntity = this.world.getTileEntity(a, b, c); ++ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c)); + if (tileEntity instanceof TileEntityHopper) { + ((TileEntityHopper) tileEntity).makeTick(); + } @@ -90,29 +90,29 @@ index 98a4ac7..a61e91a 100644 + } + // Spigot end - // ++this.age; // CraftBukkit - Moved up - if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot + /* Craftbukkit start - moved up + if (this.age != -32768) { diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index f1ccd3a..2a1e69d 100644 +index ee24008..ffc5ccb 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -342,6 +342,27 @@ public abstract class EntityMinecartAbstract extends Entity { - +@@ -337,6 +337,28 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT this.passenger = null; } + + // Spigot start - Make hoppers around this container minecart active. + // Called each tick on each minecart. + if (this.world.spigotConfig.altHopperTicking && this instanceof EntityMinecartContainer) { -+ int xi = MathHelper.floor(this.boundingBox.a) - 1; -+ int yi = MathHelper.floor(this.boundingBox.b) - 1; -+ int zi = MathHelper.floor(this.boundingBox.c) - 1; -+ int xf = MathHelper.floor(this.boundingBox.d) + 1; -+ int yf = MathHelper.floor(this.boundingBox.e) + 1; -+ int zf = MathHelper.floor(this.boundingBox.f) + 1; ++ int xi = MathHelper.floor(this.getBoundingBox().a) - 1; ++ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; ++ int zi = MathHelper.floor(this.getBoundingBox().c) - 1; ++ int xf = MathHelper.floor(this.getBoundingBox().d) + 1; ++ int yf = MathHelper.floor(this.getBoundingBox().e) + 1; ++ int zf = MathHelper.floor(this.getBoundingBox().f) + 1; + for (int a = xi; a <= xf; a++) { + for (int b = yi; b <= yf; b++) { + for (int c = zi; c <= zf; c++) { -+ TileEntity tileEntity = this.world.getTileEntity(a, b, c); ++ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c)); + if (tileEntity instanceof TileEntityHopper) { + ((TileEntityHopper) tileEntity).makeTick(); + } @@ -121,14 +121,15 @@ index f1ccd3a..2a1e69d 100644 + } + } + // Spigot end ++ + this.W(); } } - diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index 22aac7b..8abbcdf 100644 +index 7ae68bb..2627745 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -28,6 +28,31 @@ public class EntityOcelot extends EntityTameableAnimal { +@@ -30,6 +30,31 @@ public class EntityOcelot extends EntityTameableAnimal { this.datawatcher.a(18, Byte.valueOf((byte) 0)); } @@ -137,47 +138,48 @@ index 22aac7b..8abbcdf 100644 + // knowing that it may be dead, gone, or standing after this method returns. + // Called each tick on each ocelot. + @Override -+ public void h() { ++ public void s_() { + if (this.world.spigotConfig.altHopperTicking && this.isSitting()) { -+ int xi = MathHelper.floor(this.boundingBox.a); -+ int yi = MathHelper.floor(this.boundingBox.b) - 1; -+ int zi = MathHelper.floor(this.boundingBox.c); -+ int xf = MathHelper.floor(this.boundingBox.d); -+ int yf = MathHelper.floor(this.boundingBox.e) - 1; -+ int zf = MathHelper.floor(this.boundingBox.f); ++ int xi = MathHelper.floor(this.getBoundingBox().a); ++ int yi = MathHelper.floor(this.getBoundingBox().b) - 1; ++ int zi = MathHelper.floor(this.getBoundingBox().c); ++ int xf = MathHelper.floor(this.getBoundingBox().d); ++ int yf = MathHelper.floor(this.getBoundingBox().e) - 1; ++ int zf = MathHelper.floor(this.getBoundingBox().f); + for (int a = xi; a <= xf; a++) { + for (int c = zi; c <= zf; c++) { + for (int b = yi; b <= yf; b++) { -+ this.world.updateChestAndHoppers(a, b, c); ++ this.world.updateChestAndHoppers(new BlockPosition(a, b, c)); + } + } + } + } -+ super.h(); ++ super.s_(); + } + // Spigot end + - public void bp() { + public void E() { if (this.getControllerMove().a()) { double d0 = this.getControllerMove().b(); diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index ccea0b3..3c5ec6f 100644 +index 80c7937..7cf38ea 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -24,6 +24,40 @@ public class TileEntity { - public int g = -1; - public Block h; +@@ -21,6 +21,41 @@ public abstract class TileEntity { + private int h; + protected Block e; + // Spigot start + // Helper method for scheduleTicks. If the hopper at x0, y0, z0 is pointed + // at this tile entity, then make it active. -+ private void scheduleTick(int x0, int y0, int z0) { -+ TileEntity tileEntity = this.world.getTileEntity(x0, y0, z0); ++ private void scheduleTick(BlockPosition blockposition) { ++ TileEntity tileEntity = this.world.getTileEntity(blockposition); + if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) { + // i is the metadeta assoiated with the direction the hopper faces. -+ int i = BlockHopper.b(tileEntity.p()); ++ EnumDirection dir = BlockHopper.b(tileEntity.u()); ++ + // Facing class provides arrays for direction offset. -+ if (tileEntity.x + Facing.b[i] == this.x && tileEntity.y + Facing.c[i] == this.y && tileEntity.z + Facing.d[i] == this.z) { ++ if (tileEntity.position.shift(dir).equals(position)) { + ((TileEntityHopper) tileEntity).makeTick(); + } + } @@ -188,13 +190,13 @@ index ccea0b3..3c5ec6f 100644 + public void scheduleTicks() { + if (this.world != null && this.world.spigotConfig.altHopperTicking) { + // Check the top -+ this.scheduleTick(this.x, this.y + 1, this.z); ++ this.scheduleTick(position.up()); + // Check the sides + for (int i = 2; i < 6; i++) { -+ this.scheduleTick(this.x + Facing.b[i], this.y, this.z + Facing.d[i]); ++ this.scheduleTick(position.shift(EnumDirection.fromType1(i))); + } + // Check the bottom. -+ TileEntity tileEntity = this.world.getTileEntity(this.x, this.y - 1, this.z); ++ TileEntity tileEntity = this.world.getTileEntity(position.down()); + if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) { + ((TileEntityHopper) tileEntity).makeTick(); + } @@ -202,36 +204,37 @@ index ccea0b3..3c5ec6f 100644 + } + // Spigot end + - public TileEntity() {} - - private static void a(Class oclass, String s) { -@@ -105,6 +139,10 @@ public class TileEntity { - if (this.q() != Blocks.AIR) { - this.world.updateAdjacentComparators(this.x, this.y, this.z, this.q()); + public TileEntity() { + this.position = BlockPosition.ZERO; + this.h = -1; +@@ -105,6 +140,10 @@ public abstract class TileEntity { + if (this.w() != Blocks.AIR) { + this.world.updateAdjacentComparators(this.position, this.w()); } + // Spigot start - Called when the contents have changed, so hoppers around this + // tile need updating. + this.scheduleTicks(); + // Spigot end } - } + } diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index ace3617..65ee96c 100644 +index 280d64f..5355532 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -17,6 +17,43 @@ public class TileEntityHopper extends TileEntity implements IHopper { - private String i; - private int j = -1; - +@@ -16,6 +16,43 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU + private ItemStack[] items = new ItemStack[5]; + private String f; + private int g = -1; ++ + // Spigot start + private long nextTick = -1; // Next tick this hopper will be ticked. + private long lastTick = -1; // Last tick this hopper was polled. + + // If this hopper is not cooling down, assaign a visible tick for next time. + public void makeTick() { -+ if (!this.j()) { -+ this.c(0); ++ if (!this.n()) { ++ this.d(0); + } + } + @@ -246,7 +249,7 @@ index ace3617..65ee96c 100644 + // on from reload. + public void convertToScheduling() { + // j is the cooldown in ticks -+ this.c(this.j); ++ this.d(this.g); + } + + // Called when alt hopper ticking is turned off from the reload command @@ -257,18 +260,17 @@ index ace3617..65ee96c 100644 + } else { + cooldownDiff = this.nextTick - this.world.getTime() + 1; + } -+ this.c((int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); ++ this.d((int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); + } + // Spigot end -+ + // CraftBukkit start - add fields and methods public List transaction = new java.util.ArrayList(); - private int maxStack = MAX_STACK; -@@ -80,7 +117,20 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -81,7 +118,20 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } nbttagcompound.set("Items", nbttaglist); -- nbttagcompound.setInt("TransferCooldown", this.j); +- nbttagcompound.setInt("TransferCooldown", this.g); + // Spigot start - Need to write the correct cooldown to disk. We convert from long to int on saving. + if (this.world != null && this.world.spigotConfig.altHopperTicking) { + long cooldownDiff; @@ -279,14 +281,14 @@ index ace3617..65ee96c 100644 + } + nbttagcompound.setInt("TransferCooldown", (int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE))); + } else { -+ // j is the cooldown in ticks. -+ nbttagcompound.setInt("TransferCooldown", this.j); ++ // g is the cooldown in ticks. ++ nbttagcompound.setInt("TransferCooldown", this.g); + } + // Spigot end - if (this.k_()) { - nbttagcompound.setString("CustomName", this.i); + if (this.hasCustomName()) { + nbttagcompound.setString("CustomName", this.f); } -@@ -88,6 +138,9 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -90,6 +140,9 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU public void update() { super.update(); @@ -296,46 +298,44 @@ index ace3617..65ee96c 100644 } public int getSize() { -@@ -167,11 +220,21 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -170,10 +223,19 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - public void h() { + public void c() { if (this.world != null && !this.world.isStatic) { -- --this.j; -- if (!this.j()) { -- this.c(0); -- this.i(); +- --this.g; +- if (!this.n()) { +- this.d(0); +- this.m(); + // Spigot start + if (this.world.spigotConfig.altHopperTicking) { + this.lastTick = this.world.getTime(); + if (this.nextTick == this.world.getTime()) { + // Method that does the pushing and pulling. -+ this.i(); ++ this.m(); + } + } else { -+ --this.j; -+ if (!this.j()) { -+ this.c(0); -+ this.i(); ++ --this.g; ++ if (!this.n()) { ++ this.d(0); ++ this.m(); + } } -+ // Spigot end - } - } -@@ -196,7 +259,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { + } +@@ -200,7 +262,7 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } // Spigot start -- if ( !this.j() ) -+ if ( !world.spigotConfig.altHopperTicking && !this.j() ) +- if ( !this.n() ) ++ if ( !world.spigotConfig.altHopperTicking && !this.n() ) { - this.c( world.spigotConfig.hopperCheck ); + this.d( world.spigotConfig.hopperCheck ); } -@@ -584,10 +647,34 @@ public class TileEntityHopper extends TileEntity implements IHopper { +@@ -597,11 +659,35 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU } - public void c(int i) { -- this.j = i; + public void d(int i) { +- this.g = i; + // Spigot start - i is the delay for which this hopper will be ticked next. + // i of 1 or below implies a tick next tick. + if (this.world != null && this.world.spigotConfig.altHopperTicking) { @@ -348,13 +348,13 @@ index ace3617..65ee96c 100644 + this.nextTick = this.world.getTime() + i - 1; + } + } else { -+ this.j = i; ++ this.g = i; + } + // Spigot end } - public boolean j() { -- return this.j > 0; + public boolean n() { +- return this.g > 0; + // Spigot start - Return whether this hopper is cooling down. + if (this.world != null && this.world.spigotConfig.altHopperTicking) { + if (this.lastTick == this.world.getTime()) { @@ -363,16 +363,17 @@ index ace3617..65ee96c 100644 + return this.nextTick >= this.world.getTime(); + } + } else { -+ return this.j > 0; ++ return this.g > 0; + } + // Spigot end } - } + + public boolean o() { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c4fb3d8..6100297 100644 +index 2f79c83..296206f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -113,6 +113,7 @@ public abstract class World implements IBlockAccess { +@@ -120,6 +120,7 @@ public abstract class World implements IBlockAccess { private final byte chunkTickRadius; public static boolean haveWeSilencedAPhysicsCrash; public static String blockLocation; @@ -380,7 +381,7 @@ index c4fb3d8..6100297 100644 public static long chunkToKey(int x, int z) { -@@ -130,6 +131,42 @@ public abstract class World implements IBlockAccess { +@@ -137,6 +138,43 @@ public abstract class World implements IBlockAccess { { return (int) ( ( ( k >> 32 ) & 0xFFFF0000L ) | ( ( k >> 16 ) & 0x0000FFFF ) ); } @@ -401,17 +402,18 @@ index c4fb3d8..6100297 100644 + + // Helper method for altHopperTicking. Updates chests at the specified location, + // accounting for double chests. Updating the chest will update adjacent hoppers. -+ public void updateChestAndHoppers(int a, int b, int c) { -+ Block block = this.getType(a, b, c); ++ public void updateChestAndHoppers(BlockPosition blockposition) { ++ Block block = this.getType(blockposition).getBlock(); + if (block instanceof BlockChest) { -+ TileEntity tile = this.getTileEntity(a, b, c); ++ TileEntity tile = this.getTileEntity(blockposition); + if (tile instanceof TileEntityChest) { + tile.scheduleTicks(); + } + for (int i = 2; i < 6; i++) { + // Facing class provides arrays for direction offset. -+ if (this.getType(a + Facing.b[i], b, c + Facing.d[i]) == block) { -+ tile = this.getTileEntity(a + Facing.b[i], b, c + Facing.d[i]); ++ BlockPosition pos = blockposition.shift(EnumDirection.fromType1(i)); ++ if (this.getType(pos) == block) { ++ tile = this.getTileEntity(pos); + if (tile instanceof TileEntityChest) { + tile.scheduleTicks(); + } @@ -422,35 +424,32 @@ index c4fb3d8..6100297 100644 + } // Spigot end - public BiomeBase getBiome(int i, int j) { -@@ -407,6 +444,14 @@ public abstract class World implements IBlockAccess { - this.notifyAndUpdatePhysics(i, j, k, chunk, block1, block, i1); - // CraftBukkit end + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot +@@ -372,6 +410,14 @@ public abstract class World implements IBlockAccess { + // Modularize client and physic updates + notifyAndUpdatePhysics(blockposition, chunk, block1, block, i); } + // Spigot start - If this block is changing to that which a chest beneath it + // becomes able to be opened, then the chest must be updated. + // block1 is the old block. block is the new block. r returns true if the block type + // prevents access to a chest. -+ if (this.spigotConfig.altHopperTicking && block1 != null && block1.r() && !block.r()) { -+ this.updateChestAndHoppers(i, j - 1, k); ++ if (this.spigotConfig.altHopperTicking && block1 != null && block1.isOccluding()&& !block.isOccluding()) { ++ this.updateChestAndHoppers(blockposition.down()); + } + // Spigot end + // CraftBukkit end - return flag; - } -@@ -1433,8 +1478,9 @@ public abstract class World implements IBlockAccess { - this.tileEntityList.removeAll(this.b); - this.b.clear(); + return true; +@@ -1372,6 +1418,7 @@ public abstract class World implements IBlockAccess { } -- // CraftBukkit end -+ // Spigot End + // CraftBukkit end + this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently. Iterator iterator = this.tileEntityList.iterator(); while (iterator.hasNext()) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 2073732..fd79b25 100644 +index df43af5..c3a2d01 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -166,11 +166,35 @@ public class SpigotWorldConfig @@ -498,5 +497,5 @@ index 2073732..fd79b25 100644 } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0142-Fix-explosions-not-moving-invulnerable-entities.patch b/CraftBukkit-Patches/0142-Fix-explosions-not-moving-invulnerable-entities.patch deleted file mode 100644 index 11183df333..0000000000 --- a/CraftBukkit-Patches/0142-Fix-explosions-not-moving-invulnerable-entities.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2bc315f6abd49680751f7809af2f96a2f871f976 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 26 Jun 2014 14:29:11 +0100 -Subject: [PATCH] Fix explosions not moving invulnerable entities - - -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 4502f68..d876a63 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -130,9 +130,9 @@ public class Explosion { - // CraftBukkit start - CraftEventFactory.entityDamage = source; - if (!entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D)))) { -- CraftEventFactory.entityDamage = null; -- continue; -+ - } -+ CraftEventFactory.entityDamage = null; - // CraftBukkit end - double d11 = EnchantmentProtection.a(entity, d10); - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0162-Apply-NBTReadLimiter-to-more-things.patch b/CraftBukkit-Patches/0143-Apply-NBTReadLimiter-to-more-things.patch similarity index 70% rename from CraftBukkit-Patches/0162-Apply-NBTReadLimiter-to-more-things.patch rename to CraftBukkit-Patches/0143-Apply-NBTReadLimiter-to-more-things.patch index b99fe3b11f..c2e8b4a170 100644 --- a/CraftBukkit-Patches/0162-Apply-NBTReadLimiter-to-more-things.patch +++ b/CraftBukkit-Patches/0143-Apply-NBTReadLimiter-to-more-things.patch @@ -1,22 +1,26 @@ -From 6206e7c429a2df75580bf63f48c88f1deaf287b4 Mon Sep 17 00:00:00 2001 +From 6ec7cbafe22bff847aad8ef87f0fbfb7c47218dd Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 27 Jul 2014 20:46:04 +1000 Subject: [PATCH] Apply NBTReadLimiter to more things. diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index 20fe0f1..6defdf5 100644 +index e9d8828..14ba8df 100644 --- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -46,7 +46,7 @@ public class NBTCompressedStreamTools { +@@ -48,6 +48,12 @@ public class NBTCompressedStreamTools { - public static NBTTagCompound a(byte[] abyte, NBTReadLimiter nbtreadlimiter) { + public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) { try { -- DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte)))); -+ DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new org.spigotmc.LimitStream(new GZIPInputStream(new ByteArrayInputStream(abyte)), nbtreadlimiter))); // Spigot - - NBTTagCompound nbttagcompound; ++ // Spigot start ++ if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) ++ { ++ datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); ++ } ++ // Spigot end + NBTBase nbtbase = a(datainput, 0, nbtreadlimiter); + if (nbtbase instanceof NBTTagCompound) { diff --git a/src/main/java/org/spigotmc/LimitStream.java b/src/main/java/org/spigotmc/LimitStream.java new file mode 100644 index 0000000..dcc0548 @@ -63,5 +67,5 @@ index 0000000..dcc0548 + } +} -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0163-Allow-Attribute-Capping.patch b/CraftBukkit-Patches/0144-Allow-Attribute-Capping.patch similarity index 60% rename from CraftBukkit-Patches/0163-Allow-Attribute-Capping.patch rename to CraftBukkit-Patches/0144-Allow-Attribute-Capping.patch index a5c14d0508..61c8e4ff98 100644 --- a/CraftBukkit-Patches/0163-Allow-Attribute-Capping.patch +++ b/CraftBukkit-Patches/0144-Allow-Attribute-Capping.patch @@ -1,4 +1,4 @@ -From d10bd274e5f39919db7b98ac11b7eb8236e1d173 Mon Sep 17 00:00:00 2001 +From 6c29fdc8911a5ec3c82f30560bb44af977bdb5aa Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 28 Jul 2014 16:55:51 +1000 Subject: [PATCH] Allow Attribute Capping. @@ -6,7 +6,7 @@ Subject: [PATCH] Allow Attribute Capping. Apply some sensible defaults and allow server owners to customize the maximum values of selected common attributes. diff --git a/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java -index d424f04..cd613d2 100644 +index 13602f0..838daed 100644 --- a/src/main/java/net/minecraft/server/AttributeRanged.java +++ b/src/main/java/net/minecraft/server/AttributeRanged.java @@ -3,7 +3,7 @@ package net.minecraft.server; @@ -17,41 +17,41 @@ index d424f04..cd613d2 100644 + public double b; // Spigot private String c; - public AttributeRanged(String s, double d0, double d1, double d2) { + public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) { diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java -index 6202bba..7ad88f5 100644 +index 64acbde..ef7a76c 100644 --- a/src/main/java/net/minecraft/server/GenericAttributes.java +++ b/src/main/java/net/minecraft/server/GenericAttributes.java -@@ -10,11 +10,13 @@ import org.apache.logging.log4j.Logger; +@@ -9,11 +9,13 @@ import org.apache.logging.log4j.Logger; public class GenericAttributes { private static final Logger f = LogManager.getLogger(); -- public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); -+ // Spigot Start -+ public static final IAttribute maxHealth = (new AttributeRanged("generic.maxHealth", 20.0D, 0.1D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); // Spigot - public static final IAttribute b = (new AttributeRanged("generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); - public static final IAttribute c = (new AttributeRanged("generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); -- public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); -- public static final IAttribute e = new AttributeRanged("generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); -+ public static final IAttribute d = (new AttributeRanged("generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true); -+ public static final IAttribute e = new AttributeRanged("generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage); -+ // Spigot End +- public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, Double.MAX_VALUE)).a("Max Health").a(true); ++ // Spigot start ++ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.1D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true); + public static final IAttribute b = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range"); + public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance"); +- public static final IAttribute d = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, Double.MAX_VALUE)).a("Movement Speed").a(true); +- public static final IAttribute e = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, Double.MAX_VALUE); ++ public static final IAttribute d = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true); ++ public static final IAttribute e = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage); ++ // Spigot end public static NBTTagList a(AttributeMapBase attributemapbase) { NBTTagList nbttaglist = new NBTTagList(); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 0a63291..4ceeab6 100644 +index 8233de7..4ecb3cd 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -13,6 +13,8 @@ import java.util.List; - import java.util.Map; +@@ -14,6 +14,8 @@ import java.util.Map; import java.util.Set; import java.util.logging.Level; + import gnu.trove.map.hash.TObjectIntHashMap; +import net.minecraft.server.AttributeRanged; +import net.minecraft.server.GenericAttributes; - import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; + import org.bukkit.ChatColor; @@ -345,4 +347,17 @@ public class SpigotConfig { movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D ); @@ -71,5 +71,5 @@ index 0a63291..4ceeab6 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0164-Add-an-option-for-a-global-cache-for-any-request-on-.patch b/CraftBukkit-Patches/0145-Add-an-option-for-a-global-cache-for-any-request-on-.patch similarity index 97% rename from CraftBukkit-Patches/0164-Add-an-option-for-a-global-cache-for-any-request-on-.patch rename to CraftBukkit-Patches/0145-Add-an-option-for-a-global-cache-for-any-request-on-.patch index d140cb670e..f9efeed031 100644 --- a/CraftBukkit-Patches/0164-Add-an-option-for-a-global-cache-for-any-request-on-.patch +++ b/CraftBukkit-Patches/0145-Add-an-option-for-a-global-cache-for-any-request-on-.patch @@ -1,4 +1,4 @@ -From 0621027e2d6a556270557c294fc039a79c9d05de Mon Sep 17 00:00:00 2001 +From 243c5dd2689250db2ab7c7762c90ff3d78497e02 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Mon, 28 Jul 2014 11:42:11 +0100 Subject: [PATCH] Add an option for a global cache for any request on Mojang's @@ -7,7 +7,7 @@ Subject: [PATCH] Add an option for a global cache for any request on Mojang's diff --git a/src/main/java/org/spigotmc/CachedMojangAPIConnection.java b/src/main/java/org/spigotmc/CachedMojangAPIConnection.java new file mode 100644 -index 0000000..42edeba +index 0000000..4eed6fd --- /dev/null +++ b/src/main/java/org/spigotmc/CachedMojangAPIConnection.java @@ -0,0 +1,145 @@ @@ -18,8 +18,8 @@ index 0000000..42edeba +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; -+import net.minecraft.util.com.google.common.cache.Cache; -+import net.minecraft.util.com.google.common.cache.CacheBuilder; ++import com.google.common.cache.Cache; ++import com.google.common.cache.CacheBuilder; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; @@ -280,7 +280,7 @@ index 0000000..b9a8736 + } +} diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 06377b3..6baa678 100644 +index 4ecb3cd..d3abf1f 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -6,6 +6,7 @@ import java.io.IOException; @@ -308,5 +308,5 @@ index 06377b3..6baa678 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0165-Only-fetch-an-online-UUID-in-online-mode.patch b/CraftBukkit-Patches/0146-Only-fetch-an-online-UUID-in-online-mode.patch similarity index 90% rename from CraftBukkit-Patches/0165-Only-fetch-an-online-UUID-in-online-mode.patch rename to CraftBukkit-Patches/0146-Only-fetch-an-online-UUID-in-online-mode.patch index 6943abc9c6..9624fead6e 100644 --- a/CraftBukkit-Patches/0165-Only-fetch-an-online-UUID-in-online-mode.patch +++ b/CraftBukkit-Patches/0146-Only-fetch-an-online-UUID-in-online-mode.patch @@ -1,4 +1,4 @@ -From c00dc48d79a3da46c597c7bc9507de9d3f212cb1 Mon Sep 17 00:00:00 2001 +From e4a37b934d0e6817ded953ab337589b3ec249840 Mon Sep 17 00:00:00 2001 From: Maxim Van de Wynckel Date: Wed, 30 Jul 2014 01:19:51 +0200 Subject: [PATCH] Only fetch an online UUID in online mode @@ -12,10 +12,10 @@ You want to store data for player "Test" who never joined. An online UUID is cr The player Test joins with an offline UUID but that will not match the online UUID of the saved data. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 79d4d99..2c3a140 100644 +index 3332792..fcb22d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1396,8 +1396,14 @@ public final class CraftServer implements Server { +@@ -1273,8 +1273,14 @@ public final class CraftServer implements Server { OfflinePlayer result = getPlayerExact(name); if (result == null) { @@ -33,5 +33,5 @@ index 79d4d99..2c3a140 100644 // Make an OfflinePlayer using an offline mode UUID since the name has no profile result = getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name)); -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0166-Filter-attribute-modifiers-which-cause-the-attribute.patch b/CraftBukkit-Patches/0147-Filter-attribute-modifiers-which-cause-the-attribute.patch similarity index 93% rename from CraftBukkit-Patches/0166-Filter-attribute-modifiers-which-cause-the-attribute.patch rename to CraftBukkit-Patches/0147-Filter-attribute-modifiers-which-cause-the-attribute.patch index 6834eb8944..a99a6db5c4 100644 --- a/CraftBukkit-Patches/0166-Filter-attribute-modifiers-which-cause-the-attribute.patch +++ b/CraftBukkit-Patches/0147-Filter-attribute-modifiers-which-cause-the-attribute.patch @@ -1,4 +1,4 @@ -From 6b1a86ec8fd19b77d214b882ddd1793ce76fc3ca Mon Sep 17 00:00:00 2001 +From 7d73eeac30fe632ade1575f2aa1b080ed731d944 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Thu, 31 Jul 2014 17:48:20 +0100 Subject: [PATCH] Filter attribute modifiers which cause the attribute to go @@ -6,7 +6,7 @@ Subject: [PATCH] Filter attribute modifiers which cause the attribute to go diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index ec37524..bcde85c 100644 +index 53c3f6c..e4ddece 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -38,6 +38,8 @@ import com.google.common.collect.ImmutableMap; @@ -23,8 +23,8 @@ index ec37524..bcde85c 100644 NBTTagList nbttaglist = tag.getList(ATTRIBUTES.NBT, 10); + // Spigot start -+ net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap attributeTracker = new net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap(); -+ net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap attributeTrackerX = new net.minecraft.util.gnu.trove.map.hash.TObjectDoubleHashMap(); ++ gnu.trove.map.hash.TObjectDoubleHashMap attributeTracker = new gnu.trove.map.hash.TObjectDoubleHashMap(); ++ gnu.trove.map.hash.TObjectDoubleHashMap attributeTrackerX = new gnu.trove.map.hash.TObjectDoubleHashMap(); + Map attributesByName = new HashMap(); + attributeTracker.put( "generic.maxHealth", 20.0 ); + attributesByName.put( "generic.maxHealth", GenericAttributes.maxHealth ); @@ -143,5 +143,5 @@ index ec37524..bcde85c 100644 if (!(nbttaglist.get(i) instanceof NBTTagCompound)) { continue; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0148-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch b/CraftBukkit-Patches/0148-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch new file mode 100644 index 0000000000..4715d63a71 --- /dev/null +++ b/CraftBukkit-Patches/0148-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch @@ -0,0 +1,22 @@ +From ce645b7b1daef5b2231977f374ce979af3890224 Mon Sep 17 00:00:00 2001 +From: Thinkofdeath +Date: Thu, 7 Aug 2014 15:48:33 +0100 +Subject: [PATCH] Fix LEFT_CLICK_AIR detection when not in creative + + +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 2bfa289..521e9bc 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -1136,7 +1136,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; +- double d3 = 5.0D; ++ double d3 = player.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5.0D : 4.5D; // Spigot + Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); + +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0169-Plug-WorldMap-Memory-Leak.patch b/CraftBukkit-Patches/0149-Plug-WorldMap-Memory-Leak.patch similarity index 68% rename from CraftBukkit-Patches/0169-Plug-WorldMap-Memory-Leak.patch rename to CraftBukkit-Patches/0149-Plug-WorldMap-Memory-Leak.patch index 4f9e3a7084..9c3eff63f1 100644 --- a/CraftBukkit-Patches/0169-Plug-WorldMap-Memory-Leak.patch +++ b/CraftBukkit-Patches/0149-Plug-WorldMap-Memory-Leak.patch @@ -1,27 +1,34 @@ -From 9e5892607bf08eba04161c8784661cb99f00cdd6 Mon Sep 17 00:00:00 2001 +From 5ebd47227a150a986648e400a4e5a62b34b2002d Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 8 Aug 2014 19:57:03 +1000 Subject: [PATCH] Plug WorldMap Memory Leak diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java -index 4684e89..e9469a5 100644 +index 6bae818..a4e5294 100644 --- a/src/main/java/net/minecraft/server/PersistentCollection.java +++ b/src/main/java/net/minecraft/server/PersistentCollection.java @@ -18,7 +18,7 @@ public class PersistentCollection { - private IDataManager a; - private Map b = new HashMap(); -- private List c = new ArrayList(); -+ public List c = new ArrayList(); // Spigot - private Map d = new HashMap(); + private IDataManager b; + protected Map a = Maps.newHashMap(); +- private List c = Lists.newArrayList(); ++ public List c = Lists.newArrayList(); // Spigot + private Map d = Maps.newHashMap(); public PersistentCollection(IDataManager idatamanager) { +@@ -181,4 +181,4 @@ public class PersistentCollection { + return oshort.shortValue(); + } + } +-} ++} +\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6100297..7a547da 100644 +index 296206f..e6250e1 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1170,6 +1170,23 @@ public abstract class World implements IBlockAccess { +@@ -1068,6 +1068,23 @@ public abstract class World implements IBlockAccess { entity.die(); if (entity instanceof EntityHuman) { this.players.remove(entity); @@ -32,7 +39,7 @@ index 6100297..7a547da 100644 + { + WorldMap map = (WorldMap) o; + map.i.remove( entity ); -+ for ( Iterator iter = (Iterator) map.f.iterator(); iter.hasNext(); ) ++ for ( Iterator iter = (Iterator) map.g.iterator(); iter.hasNext(); ) + { + if ( iter.next().trackee == entity ) + { @@ -43,21 +50,21 @@ index 6100297..7a547da 100644 + } + // Spigot end this.everyoneSleeping(); + this.b(entity); } - } diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java -index bd5cfca..3254b87 100644 +index 49826ae..36fcb15 100644 --- a/src/main/java/net/minecraft/server/WorldMap.java +++ b/src/main/java/net/minecraft/server/WorldMap.java @@ -22,7 +22,7 @@ public class WorldMap extends PersistentBase { public byte scale; public byte[] colors = new byte[16384]; - public List f = new ArrayList(); -- private Map i = new HashMap(); -+ public Map i = new HashMap(); // Spigot - public Map decorations = new LinkedHashMap(); - + public List g = Lists.newArrayList(); +- private Map i = Maps.newHashMap(); ++ public Map i = Maps.newHashMap(); // Spigot + public Map decorations = Maps.newLinkedHashMap(); + // CraftBukkit start -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0170-Fix-Corrupted-Trapped-Chest.patch b/CraftBukkit-Patches/0150-Fix-Corrupted-Trapped-Chest.patch similarity index 69% rename from CraftBukkit-Patches/0170-Fix-Corrupted-Trapped-Chest.patch rename to CraftBukkit-Patches/0150-Fix-Corrupted-Trapped-Chest.patch index b39664ea4f..167d5a77a2 100644 --- a/CraftBukkit-Patches/0170-Fix-Corrupted-Trapped-Chest.patch +++ b/CraftBukkit-Patches/0150-Fix-Corrupted-Trapped-Chest.patch @@ -1,4 +1,4 @@ -From 0617e6f461cf0086a576eb5e2a1a911df7243ea2 Mon Sep 17 00:00:00 2001 +From 1238f3c8a0c4c65e984817c012fcc3e7be8c8267 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 15 Aug 2014 00:56:41 -0400 Subject: [PATCH] Fix Corrupted Trapped Chest @@ -9,18 +9,18 @@ If a Trapped Chest gets its Tile Entity corrupted, it will crash the server ever This will now fix Trapped Chests too. diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d93eb8b..f9dc0fc 100644 +index 9012c9e..508e4ce 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -87,7 +87,7 @@ public class WorldServer extends World { - TileEntity result = super.getTileEntity(i, j, k); - Block type = getType(i, j, k); +@@ -114,7 +114,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + TileEntity result = super.getTileEntity(pos); + Block type = getType(pos).getBlock(); - if (type == Blocks.CHEST) { + if (type == Blocks.CHEST || type == Blocks.TRAPPED_CHEST) { // Spigot if (!(result instanceof TileEntityChest)) { - result = fixTileEntity(i, j, k, type, result); + result = fixTileEntity(pos, type, result); } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0171-Remove-uneeded-validation.patch b/CraftBukkit-Patches/0151-Remove-uneeded-validation.patch similarity index 92% rename from CraftBukkit-Patches/0171-Remove-uneeded-validation.patch rename to CraftBukkit-Patches/0151-Remove-uneeded-validation.patch index 03e0a6b615..57fbbdc6f9 100644 --- a/CraftBukkit-Patches/0171-Remove-uneeded-validation.patch +++ b/CraftBukkit-Patches/0151-Remove-uneeded-validation.patch @@ -1,11 +1,11 @@ -From 638c7537c80856f0b4141e22248a31ee73febfa9 Mon Sep 17 00:00:00 2001 +From 1ff138a853bb1c90b4cd7662b4a0992cd4028e57 Mon Sep 17 00:00:00 2001 From: drXor Date: Fri, 15 Aug 2014 18:11:09 -0400 Subject: [PATCH] Remove uneeded validation diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 5c3aaaa..22df972 100644 +index e4ddece..18d7c96 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -509,7 +509,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -34,5 +34,5 @@ index 5c3aaaa..22df972 100644 public boolean hasEnchants() { -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0172-Add-Hunger-Config-Values.patch b/CraftBukkit-Patches/0152-Add-Hunger-Config-Values.patch similarity index 85% rename from CraftBukkit-Patches/0172-Add-Hunger-Config-Values.patch rename to CraftBukkit-Patches/0152-Add-Hunger-Config-Values.patch index 2a4217a82b..711c4031f4 100644 --- a/CraftBukkit-Patches/0172-Add-Hunger-Config-Values.patch +++ b/CraftBukkit-Patches/0152-Add-Hunger-Config-Values.patch @@ -1,14 +1,14 @@ -From 022e1017cecdb5fe135d7e2336f914d2ccc88736 Mon Sep 17 00:00:00 2001 +From 975fe0899319dc4ae0c48d2af8873f7154b4e21b Mon Sep 17 00:00:00 2001 From: lazertester Date: Sun, 17 Aug 2014 19:56:17 +1000 Subject: [PATCH] Add Hunger Config Values diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index f3e4328..219eb5f 100644 +index 0844b60..4ef5e01 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1006,7 +1006,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -1066,7 +1066,7 @@ public abstract class EntityHuman extends EntityLiving { } } @@ -17,9 +17,9 @@ index f3e4328..219eb5f 100644 } else if (flag1) { entity.extinguish(); } -@@ -1266,9 +1266,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - super.bj(); - this.a(StatisticList.r, 1); +@@ -1312,9 +1312,9 @@ public abstract class EntityHuman extends EntityLiving { + super.bE(); + this.b(StatisticList.u); if (this.isSprinting()) { - this.applyExhaustion(0.8F); + this.applyExhaustion(world.spigotConfig.sprintExhaustion); // Spigot - Change to use configurable value @@ -27,13 +27,13 @@ index f3e4328..219eb5f 100644 - this.applyExhaustion(0.2F); + this.applyExhaustion(world.spigotConfig.walkExhaustion); // Spigot - Change to use configurable value } - } + } diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java -index 4169231..4a7f1e5 100644 +index 23aca22..1b44990 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java -@@ -65,7 +65,7 @@ public class FoodMetaData { +@@ -63,7 +63,7 @@ public class FoodMetaData { if (this.foodTickTimer >= 80) { // CraftBukkit - added RegainReason entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); @@ -43,7 +43,7 @@ index 4169231..4a7f1e5 100644 } } else if (this.foodLevel <= 0) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index fd79b25..3500931 100644 +index c3a2d01..3f145b3 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -326,4 +326,16 @@ public class SpigotWorldConfig @@ -64,5 +64,5 @@ index fd79b25..3500931 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0153-Fix-misnamed-function-from-1.7.10-update.patch b/CraftBukkit-Patches/0153-Fix-misnamed-function-from-1.7.10-update.patch deleted file mode 100644 index 11a763e495..0000000000 --- a/CraftBukkit-Patches/0153-Fix-misnamed-function-from-1.7.10-update.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 70adfe2fcb9fc4fc0c4d464c0f7e1f21547006fc Mon Sep 17 00:00:00 2001 -From: Suddenly -Date: Mon, 14 Jul 2014 23:43:10 +0100 -Subject: [PATCH] Fix misnamed function from 1.7.10 update - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 56b5980..dea5e19 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1406,7 +1406,7 @@ public abstract class Entity { - - public void ac() { - if (this.passenger != null) { -- this.passenger.setPosition(this.locX, this.locY + this.ad() + this.passenger.ad(), this.locZ); -+ this.passenger.setPosition(this.locX, this.locY + this.ae() + this.passenger.ad(), this.locZ); // Spigot - } - } - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0173-Make-debug-logging-togglable.patch b/CraftBukkit-Patches/0153-Make-debug-logging-togglable.patch similarity index 89% rename from CraftBukkit-Patches/0173-Make-debug-logging-togglable.patch rename to CraftBukkit-Patches/0153-Make-debug-logging-togglable.patch index bda0561d62..2407d2d599 100644 --- a/CraftBukkit-Patches/0173-Make-debug-logging-togglable.patch +++ b/CraftBukkit-Patches/0153-Make-debug-logging-togglable.patch @@ -1,16 +1,16 @@ -From f76e9e079cc7ce3361b19ba67a022ecbb8229e4e Mon Sep 17 00:00:00 2001 +From 0b06e1bd0bdc7889c5a52391b410b338d3e44e9f Mon Sep 17 00:00:00 2001 From: Minecrell Date: Sun, 17 Aug 2014 12:42:53 +0200 Subject: [PATCH] Make debug logging togglable. diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 6baa678..3459d87 100644 +index d3abf1f..a8140a5 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -18,6 +18,9 @@ import net.minecraft.server.AttributeRanged; +@@ -18,6 +18,9 @@ import gnu.trove.map.hash.TObjectIntHashMap; + import net.minecraft.server.AttributeRanged; import net.minecraft.server.GenericAttributes; - import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; import net.minecraft.server.MinecraftServer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; @@ -47,7 +47,7 @@ index 6baa678..3459d87 100644 + } } diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml -index e2209b8..65c09a8 100644 +index 08d68aa..f37d1c2 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -18,9 +18,9 @@ @@ -63,5 +63,5 @@ index e2209b8..65c09a8 100644 -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0174-Skip-invalid-enchants-in-CraftMetaItem.patch b/CraftBukkit-Patches/0154-Skip-invalid-enchants-in-CraftMetaItem.patch similarity index 92% rename from CraftBukkit-Patches/0174-Skip-invalid-enchants-in-CraftMetaItem.patch rename to CraftBukkit-Patches/0154-Skip-invalid-enchants-in-CraftMetaItem.patch index 61af21c460..0c9993cd90 100644 --- a/CraftBukkit-Patches/0174-Skip-invalid-enchants-in-CraftMetaItem.patch +++ b/CraftBukkit-Patches/0154-Skip-invalid-enchants-in-CraftMetaItem.patch @@ -1,4 +1,4 @@ -From 842db28944ed631553d61662ecc1df39963a0ccf Mon Sep 17 00:00:00 2001 +From 7aa8aaa72e272ade9dd6f0a6b26cfe3e04981b5d Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Tue, 19 Aug 2014 11:04:21 +0100 Subject: [PATCH] Skip invalid enchants in CraftMetaItem @@ -8,7 +8,7 @@ CraftMetaItem would add a null enchantment into the enchantment map which causes NullPointers later diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 22df972..7a1536f 100644 +index 18d7c96..799b148 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -432,7 +432,11 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -25,5 +25,5 @@ index 22df972..7a1536f 100644 return enchantments; -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0175-Limit-TNT-Detonations-per-tick.patch b/CraftBukkit-Patches/0155-Limit-TNT-Detonations-per-tick.patch similarity index 83% rename from CraftBukkit-Patches/0175-Limit-TNT-Detonations-per-tick.patch rename to CraftBukkit-Patches/0155-Limit-TNT-Detonations-per-tick.patch index 4e8f273bda..b46fc34c75 100644 --- a/CraftBukkit-Patches/0175-Limit-TNT-Detonations-per-tick.patch +++ b/CraftBukkit-Patches/0155-Limit-TNT-Detonations-per-tick.patch @@ -1,4 +1,4 @@ -From 373358b33f3e334518b1863d6ec2d40af3c6ebf5 Mon Sep 17 00:00:00 2001 +From faaf603741ea8bdaa2a4b18872cea8ef7f327a8a Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 20 Aug 2014 18:12:32 -0400 Subject: [PATCH] Limit TNT Detonations per tick @@ -7,31 +7,31 @@ This gives a per-world control on how much TNT will be processed per-tick, preventing a massive TNT detonation from lagging out the server. diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 13cbc79..2214660 100644 +index 98c8d26..3621faf 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -42,6 +42,7 @@ public class EntityTNTPrimed extends Entity { +@@ -41,6 +41,7 @@ public class EntityTNTPrimed extends Entity { } - public void h() { + public void s_() { + if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index f9dc0fc..91f036b 100644 +index 508e4ce..ff9ac1b 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -514,6 +514,7 @@ public class WorldServer extends World { +@@ -575,6 +575,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { } super.tickEntities(); + spigotConfig.currentPrimedTnt = 0; // Spigot } - public void i() { + public void j() { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 3500931..5e3dbf9 100644 +index 3f145b3..46377ab 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -338,4 +338,15 @@ public class SpigotWorldConfig @@ -51,5 +51,5 @@ index 3500931..5e3dbf9 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/CraftBukkit-Patches/0156-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch similarity index 98% rename from CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch rename to CraftBukkit-Patches/0156-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch index ff588b4cbf..13324832f2 100644 --- a/CraftBukkit-Patches/0176-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch +++ b/CraftBukkit-Patches/0156-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch @@ -1,11 +1,11 @@ -From 7ee797407e24876be6dfe593a1173885650f72cd Mon Sep 17 00:00:00 2001 +From e0284f9b22d544d5b8c196a1d62ab13ebe88185b Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 22 Aug 2014 05:35:16 -0400 Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 7a1536f..f7a7adc 100644 +index 799b148..70855f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -201,6 +201,7 @@ class CraftMetaItem implements ItemMeta, Repairable { @@ -126,5 +126,5 @@ index 7a1536f..f7a7adc 100644 @Override -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch b/CraftBukkit-Patches/0157-Configurable-Hanging-Tick.patch similarity index 78% rename from CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch rename to CraftBukkit-Patches/0157-Configurable-Hanging-Tick.patch index 67844502de..6afe14e64c 100644 --- a/CraftBukkit-Patches/0177-Configurable-Hanging-Tick.patch +++ b/CraftBukkit-Patches/0157-Configurable-Hanging-Tick.patch @@ -1,24 +1,24 @@ -From e42ad4133ebcf200241300257916824f62fa736e Mon Sep 17 00:00:00 2001 +From 265a90e2abf27ff89a68af0586fd169cc5f9f21e Mon Sep 17 00:00:00 2001 From: drXor Date: Sat, 9 Aug 2014 13:56:51 -0400 Subject: [PATCH] Configurable Hanging Tick diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java -index eec465b..106a15b 100644 +index 76bc12a..d34e5bf 100644 --- a/src/main/java/net/minecraft/server/EntityHanging.java +++ b/src/main/java/net/minecraft/server/EntityHanging.java -@@ -102,7 +102,7 @@ public abstract class EntityHanging extends Entity { +@@ -81,7 +81,7 @@ public abstract class EntityHanging extends Entity { this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; -- if (this.e++ == 100 && !this.world.isStatic) { -+ if (this.e++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency - this.e = 0; +- if (this.c++ == 100 && !this.world.isStatic) { ++ if (this.c++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency + this.c = 0; if (!this.dead && !this.survives()) { // CraftBukkit start - fire break events diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 5e3dbf9..854ba6d 100644 +index 46377ab..420c584 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -349,4 +349,10 @@ public class SpigotWorldConfig @@ -33,5 +33,5 @@ index 5e3dbf9..854ba6d 100644 + } } -- -1.9.1 +2.1.0 diff --git a/CraftBukkit-Patches/0157-Fix-IP-banning.patch b/CraftBukkit-Patches/0157-Fix-IP-banning.patch deleted file mode 100644 index 8a8a194c5b..0000000000 --- a/CraftBukkit-Patches/0157-Fix-IP-banning.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 6c5b147cc9e9577285000f24c9f971051fc03dc1 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sat, 19 Jul 2014 22:13:44 +0100 -Subject: [PATCH] Fix IP banning - - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index ea9fcd9..75ea5c9 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -380,7 +380,7 @@ public abstract class PlayerList { - } else if (!this.isWhitelisted(gameprofile)) { - // return "You are not white-listed on this server!"; - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot -- } else if (this.k.isBanned(socketaddress) && !this.k.get(gameprofile).hasExpired()) { -+ } else if (this.k.isBanned(socketaddress) && !this.k.get(socketaddress).hasExpired()) { // Spigot - IpBanEntry ipbanentry = this.k.get(socketaddress); - - s = "Your IP address is banned from this server!\nReason: " + ipbanentry.getReason(); --- -1.9.1 - diff --git a/CraftBukkit-Patches/0158-Fix-Some-Memory-Leaks.patch b/CraftBukkit-Patches/0158-Fix-Some-Memory-Leaks.patch new file mode 100644 index 0000000000..4357becb74 --- /dev/null +++ b/CraftBukkit-Patches/0158-Fix-Some-Memory-Leaks.patch @@ -0,0 +1,131 @@ +From c65d254f386c8a1fe9dddd64bf2414fe5f92dcf2 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Sun, 21 Sep 2014 10:06:01 +1000 +Subject: [PATCH] Fix Some Memory Leaks + + +diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java +index c624190..d617228 100644 +--- a/src/main/java/net/minecraft/server/EnchantmentManager.java ++++ b/src/main/java/net/minecraft/server/EnchantmentManager.java +@@ -166,7 +166,10 @@ public class EnchantmentManager { + if (entity instanceof EntityHuman) { + a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz()); + } +- ++ // Spigot start ++ d.b = null; ++ d.a = null; ++ // Spigot end + } + + public static void b(EntityLiving entityliving, Entity entity) { +@@ -179,7 +182,10 @@ public class EnchantmentManager { + if (entityliving instanceof EntityHuman) { + a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz()); + } +- ++ // Spigot start ++ e.a = null; ++ e.b = null; ++ // Spigot end + } + + public static int a(EntityLiving entityliving) { +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index 02eed74..bc7f81e 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import java.lang.ref.WeakReference; // Spigot + import java.util.Iterator; + import java.util.List; + import java.util.UUID; +@@ -24,7 +25,7 @@ public abstract class EntityInsentient extends EntityLiving { + protected NavigationAbstract navigation; + protected final PathfinderGoalSelector goalSelector; + protected final PathfinderGoalSelector targetSelector; +- private EntityLiving goalTarget; ++ private WeakReference goalTarget = new WeakReference(null); + private EntitySenses bi; + private ItemStack[] equipment = new ItemStack[5]; + public float[] dropChances = new float[5]; +@@ -83,7 +84,7 @@ public abstract class EntityInsentient extends EntityLiving { + } + + public EntityLiving getGoalTarget() { +- return this.goalTarget; ++ return this.goalTarget.get(); // Spigot + } + + public void setGoalTarget(EntityLiving entityliving) { +@@ -116,7 +117,7 @@ public abstract class EntityInsentient extends EntityLiving { + entityliving = null; + } + } +- this.goalTarget = entityliving; ++ this.goalTarget = new WeakReference(entityliving); // Spigot + // CraftBukkit end + } + +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index b4eb893..e34f0f1 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -169,6 +169,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + public void close(IChatBaseComponent ichatbasecomponent) { + // Spigot Start + this.preparing = false; ++ this.h.clear(); + // Spigot End + if (this.i.isOpen()) { + this.i.close(); // We can't wait as this may be called from an event loop. +diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +index d1e77a8..d6fc521 100644 +--- a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java ++++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java +@@ -3,7 +3,7 @@ package net.minecraft.server; + public class PathfinderGoalSwell extends PathfinderGoal { + + EntityCreeper a; +- EntityLiving b; ++ // EntityLiving b; // Spigot + + public PathfinderGoalSwell(EntityCreeper entitycreeper) { + this.a = entitycreeper; +@@ -18,22 +18,25 @@ public class PathfinderGoalSwell extends PathfinderGoal { + + public void c() { + this.a.getNavigation().n(); +- this.b = this.a.getGoalTarget(); ++ // this.b = this.a.getGoalTarget(); // Spigot + } + + public void d() { +- this.b = null; ++ // this.b = null; // Spigot + } + + public void e() { +- if (this.b == null) { ++ // Spigot start ++ EntityLiving b = this.a.getGoalTarget(); ++ if (b == null) { + this.a.a(-1); +- } else if (this.a.h(this.b) > 49.0D) { ++ } else if (this.a.h(b) > 49.0D) { + this.a.a(-1); +- } else if (!this.a.getEntitySenses().a(this.b)) { ++ } else if (!this.a.getEntitySenses().a(b)) { + this.a.a(-1); + } else { + this.a.a(1); + } ++ // Spigot end + } + } +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0159-Refactor-ItemDoor-Place.patch b/CraftBukkit-Patches/0159-Refactor-ItemDoor-Place.patch new file mode 100644 index 0000000000..32d700cf5e --- /dev/null +++ b/CraftBukkit-Patches/0159-Refactor-ItemDoor-Place.patch @@ -0,0 +1,29 @@ +From afd4eb42e140af6c14d5cd60fa0cd1e22270fe56 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Tue, 30 Sep 2014 21:43:15 +1000 +Subject: [PATCH] Refactor ItemDoor Place + + +diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java +index 6f0a065..bca1bc9 100644 +--- a/src/main/java/net/minecraft/server/ItemDoor.java ++++ b/src/main/java/net/minecraft/server/ItemDoor.java +@@ -48,9 +48,11 @@ public class ItemDoor extends Item { + BlockPosition blockposition3 = blockposition.up(); + IBlockData iblockdata = block.getBlockData().set(BlockDoor.FACING, enumdirection).set(BlockDoor.HINGE, flag2 ? EnumDoorHinge.RIGHT : EnumDoorHinge.LEFT); + +- world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 2); +- world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 2); +- world.applyPhysics(blockposition, block); +- world.applyPhysics(blockposition3, block); ++ // Spigot start - update physics after the block multi place event ++ world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.LOWER), 3); ++ world.setTypeAndData(blockposition3, iblockdata.set(BlockDoor.HALF, EnumDoorHalf.UPPER), 3); ++ // world.applyPhysics(blockposition, block); ++ // world.applyPhysics(blockposition3, block); ++ // Spigot end + } + } +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0160-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch b/CraftBukkit-Patches/0160-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch new file mode 100644 index 0000000000..481ec769f2 --- /dev/null +++ b/CraftBukkit-Patches/0160-Don-t-Fire-InventoryCloseEvent-Unless-Required.patch @@ -0,0 +1,21 @@ +From 68104d0578657519dab57aa94806d71823686fc1 Mon Sep 17 00:00:00 2001 +From: md_5 +Date: Tue, 30 Sep 2014 21:49:10 +1000 +Subject: [PATCH] Don't Fire InventoryCloseEvent Unless Required + + +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 2f3ff86..5657e00 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -828,6 +828,7 @@ public class CraftEventFactory { + } + + public static void handleInventoryCloseEvent(EntityHuman human) { ++ if (human.activeContainer == human.defaultContainer) return; // Spigot + InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView()); + human.world.getServer().getPluginManager().callEvent(event); + human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity()); +-- +2.1.0 + diff --git a/CraftBukkit-Patches/0167-Fix-missed-diff-from-Minecraft-1.3.1-update.patch b/CraftBukkit-Patches/0167-Fix-missed-diff-from-Minecraft-1.3.1-update.patch deleted file mode 100644 index 13cb3defd5..0000000000 --- a/CraftBukkit-Patches/0167-Fix-missed-diff-from-Minecraft-1.3.1-update.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 4a2adefdc9946ddaf8493ce3aa1f3436ec585f55 Mon Sep 17 00:00:00 2001 -From: mrapple -Date: Thu, 31 Jul 2014 20:05:06 -0500 -Subject: [PATCH] Fix missed diff from Minecraft 1.3.1 update - - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index cc1b095..6f60cac 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -250,7 +250,7 @@ public class PlayerChunkMap { - this.a(pair.x, pair.z, true).a(entityplayer); - } - -- if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) { -+ if (j1 > 1 || j1 < -1 || k1 > 1 || k1 < -1) { // Spigot - missed diff - Collections.sort(entityplayer.chunkCoordIntPairQueue, new ChunkCoordComparator(entityplayer)); - } - // CraftBukkit end --- -1.9.1 - diff --git a/CraftBukkit-Patches/0168-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch b/CraftBukkit-Patches/0168-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch deleted file mode 100644 index c363a6dfa1..0000000000 --- a/CraftBukkit-Patches/0168-Fix-LEFT_CLICK_AIR-detection-when-not-in-creative.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 638e264f4eae6db586e9a0bf232d0c2bb60905e9 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Thu, 7 Aug 2014 15:48:33 +0100 -Subject: [PATCH] Fix LEFT_CLICK_AIR detection when not in creative - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2b764b5..188393c 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1044,7 +1044,7 @@ public class PlayerConnection implements PacketPlayInListener { - float f6 = MathHelper.sin(-f1 * 0.017453292F); - float f7 = f4 * f5; - float f8 = f3 * f5; -- double d3 = 5.0D; -+ double d3 = player.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5.0D : 4.5D; // Spigot - Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); - MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); - --- -1.9.1 - diff --git a/CraftBukkit-Patches/0178-Fix-a-missed-rename-in-WorldGenGroundBush.patch b/CraftBukkit-Patches/0178-Fix-a-missed-rename-in-WorldGenGroundBush.patch deleted file mode 100644 index e7c4e09be5..0000000000 --- a/CraftBukkit-Patches/0178-Fix-a-missed-rename-in-WorldGenGroundBush.patch +++ /dev/null @@ -1,22 +0,0 @@ -From c1a6ff4fb1973247241d1f71a71150c8099ecf17 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Sat, 30 Aug 2014 18:36:32 +0100 -Subject: [PATCH] Fix a missed rename in WorldGenGroundBush - - -diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java -index ea8fdb5..1a82656 100644 ---- a/src/main/java/net/minecraft/server/WorldGenGroundBush.java -+++ b/src/main/java/net/minecraft/server/WorldGenGroundBush.java -@@ -13,7 +13,7 @@ public class WorldGenGroundBush extends WorldGenTrees { - this.a = j; - } - -- public boolean a(World world, Random random, int i, int j, int k) { -+ public boolean generate(World world, Random random, int i, int j, int k) { // Spigot - Block block; - - while (((block = world.getType(i, j, k)).getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) && j > 0) { --- -1.9.1 - diff --git a/CraftBukkit-Patches/0179-Snapshot-imports.patch b/CraftBukkit-Patches/0179-Snapshot-imports.patch deleted file mode 100644 index 8d04866494..0000000000 --- a/CraftBukkit-Patches/0179-Snapshot-imports.patch +++ /dev/null @@ -1,3254 +0,0 @@ -From 7ab42b1266d4c8a7974b16cfdf3715e4891d58fd Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 1 Sep 2014 16:47:48 +1000 -Subject: [PATCH] Snapshot imports - - -diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java -new file mode 100644 -index 0000000..770da8f ---- /dev/null -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java -@@ -0,0 +1,101 @@ -+package net.minecraft.server; -+ -+public class MerchantRecipe { -+ -+ private ItemStack buyingItem1; -+ private ItemStack buyingItem2; -+ private ItemStack sellingItem; -+ private int uses; -+ private int maxUses; -+ -+ public MerchantRecipe(NBTTagCompound nbttagcompound) { -+ this.a(nbttagcompound); -+ } -+ -+ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2) { -+ this.buyingItem1 = itemstack; -+ this.buyingItem2 = itemstack1; -+ this.sellingItem = itemstack2; -+ this.maxUses = 7; -+ } -+ -+ public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1) { -+ this(itemstack, (ItemStack) null, itemstack1); -+ } -+ -+ public MerchantRecipe(ItemStack itemstack, Item item) { -+ this(itemstack, new ItemStack(item)); -+ } -+ -+ public ItemStack getBuyItem1() { -+ return this.buyingItem1; -+ } -+ -+ public ItemStack getBuyItem2() { -+ return this.buyingItem2; -+ } -+ -+ public boolean hasSecondItem() { -+ return this.buyingItem2 != null; -+ } -+ -+ public ItemStack getBuyItem3() { -+ return this.sellingItem; -+ } -+ -+ public boolean a(MerchantRecipe merchantrecipe) { -+ return this.buyingItem1.getItem() == merchantrecipe.buyingItem1.getItem() && this.sellingItem.getItem() == merchantrecipe.sellingItem.getItem() ? this.buyingItem2 == null && merchantrecipe.buyingItem2 == null || this.buyingItem2 != null && merchantrecipe.buyingItem2 != null && this.buyingItem2.getItem() == merchantrecipe.buyingItem2.getItem() : false; -+ } -+ -+ public boolean b(MerchantRecipe merchantrecipe) { -+ return this.a(merchantrecipe) && (this.buyingItem1.count < merchantrecipe.buyingItem1.count || this.buyingItem2 != null && this.buyingItem2.count < merchantrecipe.buyingItem2.count); -+ } -+ -+ public void f() { -+ ++this.uses; -+ } -+ -+ public void a(int i) { -+ this.maxUses += i; -+ } -+ -+ public boolean g() { -+ return this.uses >= this.maxUses; -+ } -+ -+ public void a(NBTTagCompound nbttagcompound) { -+ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("buy"); -+ -+ this.buyingItem1 = ItemStack.createStack(nbttagcompound1); -+ NBTTagCompound nbttagcompound2 = nbttagcompound.getCompound("sell"); -+ -+ this.sellingItem = ItemStack.createStack(nbttagcompound2); -+ if (nbttagcompound.hasKeyOfType("buyB", 10)) { -+ this.buyingItem2 = ItemStack.createStack(nbttagcompound.getCompound("buyB")); -+ } -+ -+ if (nbttagcompound.hasKeyOfType("uses", 99)) { -+ this.uses = nbttagcompound.getInt("uses"); -+ } -+ -+ if (nbttagcompound.hasKeyOfType("maxUses", 99)) { -+ this.maxUses = nbttagcompound.getInt("maxUses"); -+ } else { -+ this.maxUses = 7; -+ } -+ } -+ -+ public NBTTagCompound i() { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ -+ nbttagcompound.set("buy", this.buyingItem1.save(new NBTTagCompound())); -+ nbttagcompound.set("sell", this.sellingItem.save(new NBTTagCompound())); -+ if (this.buyingItem2 != null) { -+ nbttagcompound.set("buyB", this.buyingItem2.save(new NBTTagCompound())); -+ } -+ -+ nbttagcompound.setInt("uses", this.uses); -+ nbttagcompound.setInt("maxUses", this.maxUses); -+ return nbttagcompound; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/MerchantRecipeList.java b/src/main/java/net/minecraft/server/MerchantRecipeList.java -new file mode 100644 -index 0000000..be6ab25 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/MerchantRecipeList.java -@@ -0,0 +1,89 @@ -+package net.minecraft.server; -+ -+import java.util.ArrayList; -+ -+public class MerchantRecipeList extends ArrayList { -+ -+ public MerchantRecipeList() {} -+ -+ public MerchantRecipeList(NBTTagCompound nbttagcompound) { -+ this.a(nbttagcompound); -+ } -+ -+ public MerchantRecipe a(ItemStack itemstack, ItemStack itemstack1, int i) { -+ if (i > 0 && i < this.size()) { -+ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); -+ -+ return itemstack.getItem() == merchantrecipe.getBuyItem1().getItem() && (itemstack1 == null && !merchantrecipe.hasSecondItem() || merchantrecipe.hasSecondItem() && itemstack1 != null && merchantrecipe.getBuyItem2().getItem() == itemstack1.getItem()) && itemstack.count >= merchantrecipe.getBuyItem1().count && (!merchantrecipe.hasSecondItem() || itemstack1.count >= merchantrecipe.getBuyItem2().count) ? merchantrecipe : null; -+ } else { -+ for (int j = 0; j < this.size(); ++j) { -+ MerchantRecipe merchantrecipe1 = (MerchantRecipe) this.get(j); -+ -+ if (itemstack.getItem() == merchantrecipe1.getBuyItem1().getItem() && itemstack.count >= merchantrecipe1.getBuyItem1().count && (!merchantrecipe1.hasSecondItem() && itemstack1 == null || merchantrecipe1.hasSecondItem() && itemstack1 != null && merchantrecipe1.getBuyItem2().getItem() == itemstack1.getItem() && itemstack1.count >= merchantrecipe1.getBuyItem2().count)) { -+ return merchantrecipe1; -+ } -+ } -+ -+ return null; -+ } -+ } -+ -+ public void a(MerchantRecipe merchantrecipe) { -+ for (int i = 0; i < this.size(); ++i) { -+ MerchantRecipe merchantrecipe1 = (MerchantRecipe) this.get(i); -+ -+ if (merchantrecipe.a(merchantrecipe1)) { -+ if (merchantrecipe.b(merchantrecipe1)) { -+ this.set(i, merchantrecipe); -+ } -+ -+ return; -+ } -+ } -+ -+ this.add(merchantrecipe); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte((byte) (this.size() & 255)); -+ -+ for (int i = 0; i < this.size(); ++i) { -+ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); -+ -+ packetdataserializer.a(merchantrecipe.getBuyItem1()); -+ packetdataserializer.a(merchantrecipe.getBuyItem3()); -+ ItemStack itemstack = merchantrecipe.getBuyItem2(); -+ -+ packetdataserializer.writeBoolean(itemstack != null); -+ if (itemstack != null) { -+ packetdataserializer.a(itemstack); -+ } -+ -+ packetdataserializer.writeBoolean(merchantrecipe.g()); -+ } -+ } -+ -+ public void a(NBTTagCompound nbttagcompound) { -+ NBTTagList nbttaglist = nbttagcompound.getList("Recipes", 10); -+ -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i); -+ -+ this.add(new MerchantRecipe(nbttagcompound1)); -+ } -+ } -+ -+ public NBTTagCompound a() { -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ NBTTagList nbttaglist = new NBTTagList(); -+ -+ for (int i = 0; i < this.size(); ++i) { -+ MerchantRecipe merchantrecipe = (MerchantRecipe) this.get(i); -+ -+ nbttaglist.add(merchantrecipe.i()); -+ } -+ -+ nbttagcompound.set("Recipes", nbttaglist); -+ return nbttagcompound; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketDecoder.java b/src/main/java/net/minecraft/server/PacketDecoder.java -new file mode 100644 -index 0000000..71ec28c ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketDecoder.java -@@ -0,0 +1,49 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.List; -+ -+import net.minecraft.util.com.google.common.collect.BiMap; -+import net.minecraft.util.io.netty.buffer.ByteBuf; -+import net.minecraft.util.io.netty.channel.ChannelHandlerContext; -+import net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+import org.apache.logging.log4j.Marker; -+import org.apache.logging.log4j.MarkerManager; -+ -+public class PacketDecoder extends ByteToMessageDecoder { -+ -+ private static final Logger a = LogManager.getLogger(); -+ private static final Marker b = MarkerManager.getMarker("PACKET_RECEIVED", NetworkManager.b); -+ private final NetworkStatistics c; -+ -+ public PacketDecoder(NetworkStatistics networkstatistics) { -+ this.c = networkstatistics; -+ } -+ -+ protected void decode(ChannelHandlerContext channelhandlercontext, ByteBuf bytebuf, List list) throws IOException { -+ int i = bytebuf.readableBytes(); -+ -+ if (i != 0) { -+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); -+ int j = packetdataserializer.a(); -+ Packet packet = Packet.a((BiMap) channelhandlercontext.channel().attr(NetworkManager.e).get(), j); -+ -+ if (packet == null) { -+ throw new IOException("Bad packet id " + j); -+ } else { -+ packet.a(packetdataserializer); -+ if (packetdataserializer.readableBytes() > 0) { -+ throw new IOException("Packet was larger than I expected, found " + packetdataserializer.readableBytes() + " bytes extra whilst reading packet " + j); -+ } else { -+ list.add(packet); -+ this.c.a(j, (long) i); -+ if (a.isDebugEnabled()) { -+ a.debug(b, " IN: [{}:{}] {}[{}]", new Object[] { channelhandlercontext.channel().attr(NetworkManager.d).get(), Integer.valueOf(j), packet.getClass().getName(), packet.b()}); -+ } -+ } -+ } -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -new file mode 100644 -index 0000000..91df585 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -@@ -0,0 +1,35 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInArmAnimation extends Packet { -+ -+ private int a; -+ private int b; -+ -+ public PacketPlayInArmAnimation() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b)}); -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -new file mode 100644 -index 0000000..3c5ed45 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -@@ -0,0 +1,56 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInBlockDig extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int face; -+ private int e; -+ -+ public PacketPlayInBlockDig() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.e = packetdataserializer.readUnsignedByte(); -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.readInt(); -+ this.face = packetdataserializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.face); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public int f() { -+ return this.face; -+ } -+ -+ public int g() { -+ return this.e; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -new file mode 100644 -index 0000000..701b3a2 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -@@ -0,0 +1,77 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInBlockPlace extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private ItemStack e; -+ private float f; -+ private float g; -+ private float h; -+ -+ public PacketPlayInBlockPlace() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.c(); -+ this.f = (float) packetdataserializer.readUnsignedByte() / 16.0F; -+ this.g = (float) packetdataserializer.readUnsignedByte() / 16.0F; -+ this.h = (float) packetdataserializer.readUnsignedByte() / 16.0F; -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.a(this.e); -+ packetdataserializer.writeByte((int) (this.f * 16.0F)); -+ packetdataserializer.writeByte((int) (this.g * 16.0F)); -+ packetdataserializer.writeByte((int) (this.h * 16.0F)); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public int getFace() { -+ return this.d; -+ } -+ -+ public ItemStack getItemStack() { -+ return this.e; -+ } -+ -+ public float h() { -+ return this.f; -+ } -+ -+ public float i() { -+ return this.g; -+ } -+ -+ public float j() { -+ return this.h; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -new file mode 100644 -index 0000000..e05fe07 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -@@ -0,0 +1,38 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInEntityAction extends Packet { -+ -+ private int a; -+ private int animation; -+ private int c; -+ -+ public PacketPlayInEntityAction() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.animation = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.animation); -+ packetdataserializer.writeInt(this.c); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int d() { -+ return this.animation; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -new file mode 100644 -index 0000000..6dab3b9 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -@@ -0,0 +1,32 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInKeepAlive extends Packet { -+ -+ private int a; -+ -+ public PacketPlayInKeepAlive() {} -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ } -+ -+ public boolean a() { -+ return true; -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInPosition.java b/src/main/java/net/minecraft/server/PacketPlayInPosition.java -new file mode 100644 -index 0000000..63b8e4b ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInPosition.java -@@ -0,0 +1,28 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInPosition extends PacketPlayInFlying { -+ -+ public PacketPlayInPosition() { -+ this.hasPos = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.x = packetdataserializer.readDouble(); -+ this.y = packetdataserializer.readDouble(); -+ this.stance = packetdataserializer.readDouble(); -+ this.z = packetdataserializer.readDouble(); -+ super.a(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeDouble(this.x); -+ packetdataserializer.writeDouble(this.y); -+ packetdataserializer.writeDouble(this.stance); -+ packetdataserializer.writeDouble(this.z); -+ super.b(packetdataserializer); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -new file mode 100644 -index 0000000..9a6b726 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -@@ -0,0 +1,33 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInPositionLook extends PacketPlayInFlying { -+ -+ public PacketPlayInPositionLook() { -+ this.hasPos = true; -+ this.hasLook = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.x = packetdataserializer.readDouble(); -+ this.y = packetdataserializer.readDouble(); -+ this.stance = packetdataserializer.readDouble(); -+ this.z = packetdataserializer.readDouble(); -+ this.yaw = packetdataserializer.readFloat(); -+ this.pitch = packetdataserializer.readFloat(); -+ super.a(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeDouble(this.x); -+ packetdataserializer.writeDouble(this.y); -+ packetdataserializer.writeDouble(this.stance); -+ packetdataserializer.writeDouble(this.z); -+ packetdataserializer.writeFloat(this.yaw); -+ packetdataserializer.writeFloat(this.pitch); -+ super.b(packetdataserializer); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -new file mode 100644 -index 0000000..034fd5e ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -@@ -0,0 +1,69 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayInSettings extends Packet { -+ -+ private String a; -+ private int b; -+ private EnumChatVisibility c; -+ private boolean d; -+ private EnumDifficulty e; -+ private boolean f; -+ -+ public PacketPlayInSettings() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(7); -+ this.b = packetdataserializer.readByte(); -+ this.c = EnumChatVisibility.a(packetdataserializer.readByte()); -+ this.d = packetdataserializer.readBoolean(); -+ this.e = EnumDifficulty.getById(packetdataserializer.readByte()); -+ this.f = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c.a()); -+ packetdataserializer.writeBoolean(this.d); -+ packetdataserializer.writeByte(this.e.a()); -+ packetdataserializer.writeBoolean(this.f); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public String c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public EnumChatVisibility e() { -+ return this.c; -+ } -+ -+ public boolean f() { -+ return this.d; -+ } -+ -+ public EnumDifficulty g() { -+ return this.e; -+ } -+ -+ public boolean h() { -+ return this.f; -+ } -+ -+ public String b() { -+ return String.format("lang=\'%s\', view=%d, chat=%s, col=%b, difficulty=%s, cape=%b", new Object[] { this.a, Integer.valueOf(this.b), this.c, Boolean.valueOf(this.d), this.e, Boolean.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -new file mode 100644 -index 0000000..d304284 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -@@ -0,0 +1,49 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInSteerVehicle extends Packet { -+ -+ private float a; -+ private float b; -+ private boolean c; -+ private boolean d; -+ -+ public PacketPlayInSteerVehicle() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readFloat(); -+ this.b = packetdataserializer.readFloat(); -+ this.c = packetdataserializer.readBoolean(); -+ this.d = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeFloat(this.a); -+ packetdataserializer.writeFloat(this.b); -+ packetdataserializer.writeBoolean(this.c); -+ packetdataserializer.writeBoolean(this.d); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public float c() { -+ return this.a; -+ } -+ -+ public float d() { -+ return this.b; -+ } -+ -+ public boolean e() { -+ return this.c; -+ } -+ -+ public boolean f() { -+ return this.d; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -new file mode 100644 -index 0000000..476638e ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -@@ -0,0 +1,40 @@ -+package net.minecraft.server; -+ -+import net.minecraft.util.org.apache.commons.lang3.StringUtils; -+ -+import java.io.IOException; -+ -+public class PacketPlayInTabComplete extends Packet { -+ -+ private String a; -+ -+ public PacketPlayInTabComplete() {} -+ -+ public PacketPlayInTabComplete(String s) { -+ this.a = s; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(32767); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(StringUtils.substring(this.a, 0, 32767)); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public String c() { -+ return this.a; -+ } -+ -+ public String b() { -+ return String.format("message=\'%s\'", new Object[] { this.a}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -new file mode 100644 -index 0000000..3458448 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -@@ -0,0 +1,58 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayInUpdateSign extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private String[] d; -+ -+ public PacketPlayInUpdateSign() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readInt(); -+ this.d = new String[4]; -+ -+ for (int i = 0; i < 4; ++i) { -+ this.d[i] = packetdataserializer.c(15); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeInt(this.c); -+ -+ for (int i = 0; i < 4; ++i) { -+ packetdataserializer.a(this.d[i]); -+ } -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.b; -+ } -+ -+ public int e() { -+ return this.c; -+ } -+ -+ public String[] f() { -+ return this.d; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -new file mode 100644 -index 0000000..39f3037 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -@@ -0,0 +1,35 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInUseEntity extends Packet { -+ -+ private int a; -+ private EnumEntityUseAction action; -+ -+ public PacketPlayInUseEntity() {} -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length]; -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.action.ordinal()); -+ } -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public Entity a(World world) { -+ return world.getEntity(this.a); -+ } -+ -+ public EnumEntityUseAction c() { -+ return this.action; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -new file mode 100644 -index 0000000..2bba639 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -@@ -0,0 +1,67 @@ -+package net.minecraft.server; -+ -+public class PacketPlayInWindowClick extends Packet { -+ -+ private int a; -+ private int slot; -+ private int button; -+ private short d; -+ private ItemStack item; -+ private int shift; -+ -+ public PacketPlayInWindowClick() {} -+ -+ public void a(PacketPlayInListener packetplayinlistener) { -+ packetplayinlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readByte(); -+ this.slot = packetdataserializer.readShort(); -+ this.button = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readShort(); -+ this.shift = packetdataserializer.readByte(); -+ this.item = packetdataserializer.c(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeShort(this.slot); -+ packetdataserializer.writeByte(this.button); -+ packetdataserializer.writeShort(this.d); -+ packetdataserializer.writeByte(this.shift); -+ packetdataserializer.a(this.item); -+ } -+ -+ public String b() { -+ return this.item != null ? String.format("id=%d, slot=%d, button=%d, type=%d, itemid=%d, itemcount=%d, itemaux=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.slot), Integer.valueOf(this.button), Integer.valueOf(this.shift), Integer.valueOf(Item.getId(this.item.getItem())), Integer.valueOf(this.item.count), Integer.valueOf(this.item.getData())}) : String.format("id=%d, slot=%d, button=%d, type=%d, itemid=-1", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.slot), Integer.valueOf(this.button), Integer.valueOf(this.shift)}); -+ } -+ -+ public int c() { -+ return this.a; -+ } -+ -+ public int d() { -+ return this.slot; -+ } -+ -+ public int e() { -+ return this.button; -+ } -+ -+ public short f() { -+ return this.d; -+ } -+ -+ public ItemStack g() { -+ return this.item; -+ } -+ -+ public int h() { -+ return this.shift; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayInListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBed.java b/src/main/java/net/minecraft/server/PacketPlayOutBed.java -new file mode 100644 -index 0000000..d7954ff ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java -@@ -0,0 +1,40 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutBed extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ -+ public PacketPlayOutBed() {} -+ -+ public PacketPlayOutBed(EntityHuman entityhuman, int i, int j, int k) { -+ this.b = i; -+ this.c = j; -+ this.d = k; -+ this.a = entityhuman.getId(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeInt(this.d); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -new file mode 100644 -index 0000000..cdcdfd6 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -@@ -0,0 +1,48 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutBlockAction extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private Block f; -+ -+ public PacketPlayOutBlockAction() {} -+ -+ public PacketPlayOutBlockAction(int i, int j, int k, Block block, int l, int i1) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = i1; -+ this.f = block; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.readUnsignedByte(); -+ this.f = Block.getById(packetdataserializer.a() & 4095); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.b(Block.getId(this.f) & 4095); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -new file mode 100644 -index 0000000..c93e8bc ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -@@ -0,0 +1,44 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutBlockBreakAnimation extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ -+ public PacketPlayOutBlockBreakAnimation() {} -+ -+ public PacketPlayOutBlockBreakAnimation(int i, int j, int k, int l, int i1) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = i1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeByte(this.e); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -new file mode 100644 -index 0000000..f6863bd ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +1,47 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutChat extends Packet { -+ -+ private IChatBaseComponent a; -+ private boolean b; -+ -+ public PacketPlayOutChat() { -+ this.b = true; -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) { -+ this(ichatbasecomponent, true); -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag) { -+ this.b = true; -+ this.a = ichatbasecomponent; -+ this.b = flag; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = ChatSerializer.a(packetdataserializer.c(32767)); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(ChatSerializer.a(this.a)); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("message=\'%s\'", new Object[] { this.a}); -+ } -+ -+ public boolean d() { -+ return this.b; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -new file mode 100644 -index 0000000..0870ac9 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -@@ -0,0 +1,32 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutCollect extends Packet { -+ -+ private int a; -+ private int b; -+ -+ public PacketPlayOutCollect() {} -+ -+ public PacketPlayOutCollect(int i, int j) { -+ this.a = i; -+ this.b = j; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -new file mode 100644 -index 0000000..f2a032e ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -@@ -0,0 +1,45 @@ -+package net.minecraft.server; -+ -+import net.minecraft.util.io.netty.buffer.ByteBuf; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutCustomPayload extends Packet { -+ -+ private String tag; -+ private byte[] data; -+ -+ public PacketPlayOutCustomPayload() {} -+ -+ public PacketPlayOutCustomPayload(String s, ByteBuf bytebuf) { -+ this(s, bytebuf.array()); -+ } -+ -+ public PacketPlayOutCustomPayload(String s, byte[] abyte) { -+ this.tag = s; -+ this.data = abyte; -+ if (abyte.length >= 1048576) { -+ throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes"); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.tag = packetdataserializer.c(20); -+ this.data = new byte[packetdataserializer.readUnsignedShort()]; -+ packetdataserializer.readBytes(this.data); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.tag); -+ packetdataserializer.writeShort(this.data.length); -+ packetdataserializer.writeBytes(this.data); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -new file mode 100644 -index 0000000..dc4259d ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -0,0 +1,42 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntity extends Packet { -+ -+ protected int a; -+ protected byte b; -+ protected byte c; -+ protected byte d; -+ protected byte e; -+ protected byte f; -+ protected boolean g; -+ -+ public PacketPlayOutEntity() {} -+ -+ public PacketPlayOutEntity(int i) { -+ this.a = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d", new Object[] { Integer.valueOf(this.a)}); -+ } -+ -+ public String toString() { -+ return "Entity_" + super.toString(); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -new file mode 100644 -index 0000000..4fa5b82 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -@@ -0,0 +1,50 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityDestroy extends Packet { -+ -+ private int[] a; -+ -+ public PacketPlayOutEntityDestroy() {} -+ -+ public PacketPlayOutEntityDestroy(int... aint) { -+ this.a = aint; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = new int[packetdataserializer.readByte()]; -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ this.a[i] = packetdataserializer.readInt(); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a.length); -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ packetdataserializer.writeInt(this.a[i]); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ StringBuilder stringbuilder = new StringBuilder(); -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ if (i > 0) { -+ stringbuilder.append(", "); -+ } -+ -+ stringbuilder.append(this.a[i]); -+ } -+ -+ return String.format("entities=%d[%s]", new Object[] { Integer.valueOf(this.a.length), stringbuilder}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -new file mode 100644 -index 0000000..97752ca ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -@@ -0,0 +1,44 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityEffect extends Packet { -+ -+ private int a; -+ private byte b; -+ private byte c; -+ private short d; -+ -+ public PacketPlayOutEntityEffect() {} -+ -+ public PacketPlayOutEntityEffect(int i, MobEffect mobeffect) { -+ this.a = i; -+ this.b = (byte) (mobeffect.getEffectId() & 255); -+ this.c = (byte) (mobeffect.getAmplifier() & 255); -+ if (mobeffect.getDuration() > 32767) { -+ this.d = 32767; -+ } else { -+ this.d = (short) mobeffect.getDuration(); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeShort(this.d); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -new file mode 100644 -index 0000000..736e3fd ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -@@ -0,0 +1,40 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityEquipment extends Packet { -+ -+ private int a; -+ private int b; -+ private ItemStack c; -+ -+ public PacketPlayOutEntityEquipment() {} -+ -+ public PacketPlayOutEntityEquipment(int i, int j, ItemStack itemstack) { -+ this.a = i; -+ this.b = j; -+ this.c = itemstack == null ? null : itemstack.cloneItemStack(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.c(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.a(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("entity=%d, slot=%d, item=%s", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), this.c}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -new file mode 100644 -index 0000000..0204062 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -@@ -0,0 +1,36 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityHeadRotation extends Packet { -+ -+ private int a; -+ private byte b; -+ -+ public PacketPlayOutEntityHeadRotation() {} -+ -+ public PacketPlayOutEntityHeadRotation(Entity entity, byte b0) { -+ this.a = entity.getId(); -+ this.b = b0; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, rot=%d", new Object[] { Integer.valueOf(this.a), Byte.valueOf(this.b)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -new file mode 100644 -index 0000000..72243ec ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -@@ -0,0 +1,35 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityLook extends PacketPlayOutEntity { -+ -+ public PacketPlayOutEntityLook() { -+ this.g = true; -+ } -+ -+ public PacketPlayOutEntityLook(int i, byte b0, byte b1) { -+ super(i); -+ this.e = b0; -+ this.f = b1; -+ this.g = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ super.a(packetdataserializer); -+ this.e = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ super.b(packetdataserializer); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeByte(this.f); -+ } -+ -+ public String b() { -+ return super.b() + String.format(", yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.e), Byte.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -new file mode 100644 -index 0000000..a95877f ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -@@ -0,0 +1,38 @@ -+package net.minecraft.server; -+ -+import java.util.List; -+ -+public class PacketPlayOutEntityMetadata extends Packet { -+ -+ private int a; -+ private List b; -+ -+ public PacketPlayOutEntityMetadata() {} -+ -+ public PacketPlayOutEntityMetadata(int i, DataWatcher datawatcher, boolean flag) { -+ this.a = i; -+ if (flag) { -+ this.b = datawatcher.c(); -+ } else { -+ this.b = datawatcher.b(); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = DataWatcher.b(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ DataWatcher.a(this.b, packetdataserializer); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -new file mode 100644 -index 0000000..c988bcc ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -0,0 +1,57 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityTeleport extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private byte e; -+ private byte f; -+ -+ public PacketPlayOutEntityTeleport() {} -+ -+ public PacketPlayOutEntityTeleport(Entity entity) { -+ this.a = entity.getId(); -+ this.b = MathHelper.floor(entity.locX * 32.0D); -+ this.c = MathHelper.floor(entity.locY * 32.0D); -+ this.d = MathHelper.floor(entity.locZ * 32.0D); -+ this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F)); -+ this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F)); -+ } -+ -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = b0; -+ this.f = b1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeByte(this.f); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -new file mode 100644 -index 0000000..46f2543 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -@@ -0,0 +1,74 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutEntityVelocity extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ -+ public PacketPlayOutEntityVelocity() {} -+ -+ public PacketPlayOutEntityVelocity(Entity entity) { -+ this(entity.getId(), entity.motX, entity.motY, entity.motZ); -+ } -+ -+ public PacketPlayOutEntityVelocity(int i, double d0, double d1, double d2) { -+ this.a = i; -+ double d3 = 3.9D; -+ -+ if (d0 < -d3) { -+ d0 = -d3; -+ } -+ -+ if (d1 < -d3) { -+ d1 = -d3; -+ } -+ -+ if (d2 < -d3) { -+ d2 = -d3; -+ } -+ -+ if (d0 > d3) { -+ d0 = d3; -+ } -+ -+ if (d1 > d3) { -+ d1 = d3; -+ } -+ -+ if (d2 > d3) { -+ d2 = d3; -+ } -+ -+ this.b = (int) (d0 * 8000.0D); -+ this.c = (int) (d1 * 8000.0D); -+ this.d = (int) (d2 * 8000.0D); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readShort(); -+ this.d = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeShort(this.c); -+ packetdataserializer.writeShort(this.d); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Float.valueOf((float) this.b / 8000.0F), Float.valueOf((float) this.c / 8000.0F), Float.valueOf((float) this.d / 8000.0F)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -new file mode 100644 -index 0000000..4038cc8 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -@@ -0,0 +1,36 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutExperience extends Packet { -+ -+ private float a; -+ private int b; -+ private int c; -+ -+ public PacketPlayOutExperience() {} -+ -+ public PacketPlayOutExperience(float f, int i, int j) { -+ this.a = f; -+ this.b = i; -+ this.c = j; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readFloat(); -+ this.c = packetdataserializer.readShort(); -+ this.b = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeFloat(this.a); -+ packetdataserializer.writeShort(this.c); -+ packetdataserializer.writeShort(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -new file mode 100644 -index 0000000..456532b ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -@@ -0,0 +1,32 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutKeepAlive extends Packet { -+ -+ private int a; -+ -+ public PacketPlayOutKeepAlive() {} -+ -+ public PacketPlayOutKeepAlive(int i) { -+ this.a = i; -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ } -+ -+ public boolean a() { -+ return true; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -new file mode 100644 -index 0000000..49e0ff5 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -@@ -0,0 +1,70 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutLogin extends Packet { -+ -+ private int a; -+ private boolean b; -+ private EnumGamemode c; -+ private int d; -+ private EnumDifficulty e; -+ private int f; -+ private WorldType g; -+ -+ public PacketPlayOutLogin() {} -+ -+ public PacketPlayOutLogin(int i, EnumGamemode enumgamemode, boolean flag, int j, EnumDifficulty enumdifficulty, int k, WorldType worldtype) { -+ this.a = i; -+ this.d = j; -+ this.e = enumdifficulty; -+ this.c = enumgamemode; -+ this.f = k; -+ this.b = flag; -+ this.g = worldtype; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.readInt(); -+ short short1 = packetdataserializer.readUnsignedByte(); -+ -+ this.b = (short1 & 8) == 8; -+ int i = short1 & -9; -+ -+ this.c = EnumGamemode.getById(i); -+ this.d = packetdataserializer.readByte(); -+ this.e = EnumDifficulty.getById(packetdataserializer.readUnsignedByte()); -+ this.f = packetdataserializer.readUnsignedByte(); -+ this.g = WorldType.getType(packetdataserializer.c(16)); -+ if (this.g == null) { -+ this.g = WorldType.NORMAL; -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.a); -+ int i = this.c.getId(); -+ -+ if (this.b) { -+ i |= 8; -+ } -+ -+ packetdataserializer.writeByte(i); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeByte(this.e.a()); -+ packetdataserializer.writeByte(this.f); -+ packetdataserializer.a(this.g.name()); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("eid=%d, gameType=%d, hardcore=%b, dimension=%d, difficulty=%s, maxplayers=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.c.getId()), Boolean.valueOf(this.b), Integer.valueOf(this.d), this.e, Integer.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMap.java b/src/main/java/net/minecraft/server/PacketPlayOutMap.java -new file mode 100644 -index 0000000..5980c2d ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMap.java -@@ -0,0 +1,38 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutMap extends Packet { -+ -+ private int a; -+ private byte[] b; -+ -+ public PacketPlayOutMap() {} -+ -+ public PacketPlayOutMap(int i, byte[] abyte) { -+ this.a = i; -+ this.b = abyte; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.b = new byte[packetdataserializer.readUnsignedShort()]; -+ packetdataserializer.readBytes(this.b); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeShort(this.b.length); -+ packetdataserializer.writeBytes(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, length=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b.length)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -new file mode 100644 -index 0000000..0a12db5 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -@@ -0,0 +1,81 @@ -+package net.minecraft.server; -+ -+import java.io.ByteArrayOutputStream; -+import java.io.DataOutputStream; -+import java.io.IOException; -+ -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+public class PacketPlayOutMultiBlockChange extends Packet { -+ -+ private static final Logger a = LogManager.getLogger(); -+ private ChunkCoordIntPair b; -+ private byte[] c; -+ private int d; -+ -+ public PacketPlayOutMultiBlockChange() {} -+ -+ public PacketPlayOutMultiBlockChange(int i, short[] ashort, Chunk chunk) { -+ this.b = new ChunkCoordIntPair(chunk.locX, chunk.locZ); -+ this.d = i; -+ int j = 4 * i; -+ -+ try { -+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(j); -+ DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); -+ -+ for (int k = 0; k < i; ++k) { -+ int l = ashort[k] >> 12 & 15; -+ int i1 = ashort[k] >> 8 & 15; -+ int j1 = ashort[k] & 255; -+ -+ dataoutputstream.writeShort(ashort[k]); -+ dataoutputstream.writeShort((short) ((Block.getId(chunk.getType(l, j1, i1)) & 4095) << 4 | chunk.getData(l, j1, i1) & 15)); -+ } -+ -+ this.c = bytearrayoutputstream.toByteArray(); -+ if (this.c.length != j) { -+ throw new RuntimeException("Expected length " + j + " doesn\'t match received length " + this.c.length); -+ } -+ } catch (IOException ioexception) { -+ a.error("Couldn\'t create bulk block update packet", ioexception); -+ this.c = null; -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.b = new ChunkCoordIntPair(packetdataserializer.readInt(), packetdataserializer.readInt()); -+ this.d = packetdataserializer.readShort() & '\uffff'; -+ int i = packetdataserializer.readInt(); -+ -+ if (i > 0) { -+ this.c = new byte[i]; -+ packetdataserializer.readBytes(this.c); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.b.x); -+ packetdataserializer.writeInt(this.b.z); -+ packetdataserializer.writeShort((short) this.d); -+ if (this.c != null) { -+ packetdataserializer.writeInt(this.c.length); -+ packetdataserializer.writeBytes(this.c); -+ } else { -+ packetdataserializer.writeInt(0); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("xc=%d, zc=%d, count=%d", new Object[] { Integer.valueOf(this.b.x), Integer.valueOf(this.b.z), Integer.valueOf(this.d)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -new file mode 100644 -index 0000000..d67a364 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -@@ -0,0 +1,36 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutOpenSignEditor extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ -+ public PacketPlayOutOpenSignEditor() {} -+ -+ public PacketPlayOutOpenSignEditor(int i, int j, int k) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -new file mode 100644 -index 0000000..7cae01e ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -@@ -0,0 +1,38 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutPlayerInfo extends Packet { -+ -+ private String a; -+ private boolean b; -+ private int c; -+ -+ public PacketPlayOutPlayerInfo() {} -+ -+ public PacketPlayOutPlayerInfo(String s, boolean flag, int i) { -+ this.a = s; -+ this.b = flag; -+ this.c = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.b = packetdataserializer.readBoolean(); -+ this.c = packetdataserializer.readShort(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeBoolean(this.b); -+ packetdataserializer.writeShort(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -new file mode 100644 -index 0000000..f2234f0 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -@@ -0,0 +1,48 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutPosition extends Packet { -+ -+ private double a; -+ private double b; -+ private double c; -+ private float d; -+ private float e; -+ private boolean f; -+ -+ public PacketPlayOutPosition() {} -+ -+ public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, boolean flag) { -+ this.a = d0; -+ this.b = d1; -+ this.c = d2; -+ this.d = f; -+ this.e = f1; -+ this.f = flag; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readDouble(); -+ this.b = packetdataserializer.readDouble(); -+ this.c = packetdataserializer.readDouble(); -+ this.d = packetdataserializer.readFloat(); -+ this.e = packetdataserializer.readFloat(); -+ this.f = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeDouble(this.a); -+ packetdataserializer.writeDouble(this.b); -+ packetdataserializer.writeDouble(this.c); -+ packetdataserializer.writeFloat(this.d); -+ packetdataserializer.writeFloat(this.e); -+ packetdataserializer.writeBoolean(this.f); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -new file mode 100644 -index 0000000..d83ae7b ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -@@ -0,0 +1,35 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { -+ -+ public PacketPlayOutRelEntityMove() {} -+ -+ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2) { -+ super(i); -+ this.b = b0; -+ this.c = b1; -+ this.d = b2; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ super.a(packetdataserializer); -+ this.b = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ super.b(packetdataserializer); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeByte(this.d); -+ } -+ -+ public String b() { -+ return super.b() + String.format(", xa=%d, ya=%d, za=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -new file mode 100644 -index 0000000..9155c96 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -@@ -0,0 +1,44 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { -+ -+ public PacketPlayOutRelEntityMoveLook() { -+ this.g = true; -+ } -+ -+ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4) { -+ super(i); -+ this.b = b0; -+ this.c = b1; -+ this.d = b2; -+ this.e = b3; -+ this.f = b4; -+ this.g = true; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ super.a(packetdataserializer); -+ this.b = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readByte(); -+ this.d = packetdataserializer.readByte(); -+ this.e = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ super.b(packetdataserializer); -+ packetdataserializer.writeByte(this.b); -+ packetdataserializer.writeByte(this.c); -+ packetdataserializer.writeByte(this.d); -+ packetdataserializer.writeByte(this.e); -+ packetdataserializer.writeByte(this.f); -+ } -+ -+ public String b() { -+ return super.b() + String.format(", xa=%d, ya=%d, za=%d, yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d), Byte.valueOf(this.e), Byte.valueOf(this.f)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ super.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -new file mode 100644 -index 0000000..9041f82 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -@@ -0,0 +1,32 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutRemoveEntityEffect extends Packet { -+ -+ private int a; -+ private int b; -+ -+ public PacketPlayOutRemoveEntityEffect() {} -+ -+ public PacketPlayOutRemoveEntityEffect(int i, MobEffect mobeffect) { -+ this.a = i; -+ this.b = mobeffect.getEffectId(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeByte(this.b); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -new file mode 100644 -index 0000000..7403dbd ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -@@ -0,0 +1,38 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutScoreboardObjective extends Packet { -+ -+ private String a; -+ private String b; -+ private int c; -+ -+ public PacketPlayOutScoreboardObjective() {} -+ -+ public PacketPlayOutScoreboardObjective(ScoreboardObjective scoreboardobjective, int i) { -+ this.a = scoreboardobjective.getName(); -+ this.b = scoreboardobjective.getDisplayName(); -+ this.c = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.b = packetdataserializer.c(32); -+ this.c = packetdataserializer.readByte(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.a(this.b); -+ packetdataserializer.writeByte(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -new file mode 100644 -index 0000000..f50851b ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -@@ -0,0 +1,53 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutScoreboardScore extends Packet { -+ -+ private String a = ""; -+ private String b = ""; -+ private int c; -+ private int d; -+ -+ public PacketPlayOutScoreboardScore() {} -+ -+ public PacketPlayOutScoreboardScore(ScoreboardScore scoreboardscore, int i) { -+ this.a = scoreboardscore.getPlayerName(); -+ this.b = scoreboardscore.getObjective().getName(); -+ this.c = scoreboardscore.getScore(); -+ this.d = i; -+ } -+ -+ public PacketPlayOutScoreboardScore(String s) { -+ this.a = s; -+ this.b = ""; -+ this.c = 0; -+ this.d = 1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.d = packetdataserializer.readByte(); -+ if (this.d != 1) { -+ this.b = packetdataserializer.c(16); -+ this.c = packetdataserializer.readInt(); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeByte(this.d); -+ if (this.d != 1) { -+ packetdataserializer.a(this.b); -+ packetdataserializer.writeInt(this.c); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -new file mode 100644 -index 0000000..e8f0971 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -@@ -0,0 +1,95 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.ArrayList; -+import java.util.Collection; -+import java.util.Iterator; -+ -+public class PacketPlayOutScoreboardTeam extends Packet { -+ -+ private String a = ""; -+ private String b = ""; -+ private String c = ""; -+ private String d = ""; -+ private Collection e = new ArrayList(); -+ private int f; -+ private int g; -+ -+ public PacketPlayOutScoreboardTeam() {} -+ -+ public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, int i) { -+ this.a = scoreboardteam.getName(); -+ this.f = i; -+ if (i == 0 || i == 2) { -+ this.b = scoreboardteam.getDisplayName(); -+ this.c = scoreboardteam.getPrefix(); -+ this.d = scoreboardteam.getSuffix(); -+ this.g = scoreboardteam.packOptionData(); -+ } -+ -+ if (i == 0) { -+ this.e.addAll(scoreboardteam.getPlayerNameSet()); -+ } -+ } -+ -+ public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, Collection collection, int i) { -+ if (i != 3 && i != 4) { -+ throw new IllegalArgumentException("Method must be join or leave for player constructor"); -+ } else if (collection != null && !collection.isEmpty()) { -+ this.f = i; -+ this.a = scoreboardteam.getName(); -+ this.e.addAll(collection); -+ } else { -+ throw new IllegalArgumentException("Players cannot be null/empty"); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(16); -+ this.f = packetdataserializer.readByte(); -+ if (this.f == 0 || this.f == 2) { -+ this.b = packetdataserializer.c(32); -+ this.c = packetdataserializer.c(16); -+ this.d = packetdataserializer.c(16); -+ this.g = packetdataserializer.readByte(); -+ } -+ -+ if (this.f == 0 || this.f == 3 || this.f == 4) { -+ short short1 = packetdataserializer.readShort(); -+ -+ for (int i = 0; i < short1; ++i) { -+ this.e.add(packetdataserializer.c(40)); -+ } -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeByte(this.f); -+ if (this.f == 0 || this.f == 2) { -+ packetdataserializer.a(this.b); -+ packetdataserializer.a(this.c); -+ packetdataserializer.a(this.d); -+ packetdataserializer.writeByte(this.g); -+ } -+ -+ if (this.f == 0 || this.f == 3 || this.f == 4) { -+ packetdataserializer.writeShort(this.e.size()); -+ Iterator iterator = this.e.iterator(); -+ -+ while (iterator.hasNext()) { -+ String s = (String) iterator.next(); -+ -+ packetdataserializer.a(s); -+ } -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -new file mode 100644 -index 0000000..5aeb4e3 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -@@ -0,0 +1,36 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutSetSlot extends Packet { -+ -+ private int a; -+ private int b; -+ private ItemStack c; -+ -+ public PacketPlayOutSetSlot() {} -+ -+ public PacketPlayOutSetSlot(int i, int j, ItemStack itemstack) { -+ this.a = i; -+ this.b = j; -+ this.c = itemstack == null ? null : itemstack.cloneItemStack(); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readByte(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.c(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.a(this.c); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -new file mode 100644 -index 0000000..17302e0 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -0,0 +1,135 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutSpawnEntity extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private int f; -+ private int g; -+ private int h; -+ private int i; -+ private int j; -+ private int k; -+ -+ public PacketPlayOutSpawnEntity() {} -+ -+ public PacketPlayOutSpawnEntity(Entity entity, int i) { -+ this(entity, i, 0); -+ } -+ -+ public PacketPlayOutSpawnEntity(Entity entity, int i, int j) { -+ this.a = entity.getId(); -+ this.b = MathHelper.floor(entity.locX * 32.0D); -+ this.c = MathHelper.floor(entity.locY * 32.0D); -+ this.d = MathHelper.floor(entity.locZ * 32.0D); -+ this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F); -+ this.i = MathHelper.d(entity.yaw * 256.0F / 360.0F); -+ this.j = i; -+ this.k = j; -+ if (j > 0) { -+ double d0 = entity.motX; -+ double d1 = entity.motY; -+ double d2 = entity.motZ; -+ double d3 = 3.9D; -+ -+ if (d0 < -d3) { -+ d0 = -d3; -+ } -+ -+ if (d1 < -d3) { -+ d1 = -d3; -+ } -+ -+ if (d2 < -d3) { -+ d2 = -d3; -+ } -+ -+ if (d0 > d3) { -+ d0 = d3; -+ } -+ -+ if (d1 > d3) { -+ d1 = d3; -+ } -+ -+ if (d2 > d3) { -+ d2 = d3; -+ } -+ -+ this.e = (int) (d0 * 8000.0D); -+ this.f = (int) (d1 * 8000.0D); -+ this.g = (int) (d2 * 8000.0D); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.j = packetdataserializer.readByte(); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.h = packetdataserializer.readByte(); -+ this.i = packetdataserializer.readByte(); -+ this.k = packetdataserializer.readInt(); -+ if (this.k > 0) { -+ this.e = packetdataserializer.readShort(); -+ this.f = packetdataserializer.readShort(); -+ this.g = packetdataserializer.readShort(); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeByte(this.j); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeByte(this.h); -+ packetdataserializer.writeByte(this.i); -+ packetdataserializer.writeInt(this.k); -+ if (this.k > 0) { -+ packetdataserializer.writeShort(this.e); -+ packetdataserializer.writeShort(this.f); -+ packetdataserializer.writeShort(this.g); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.j), Float.valueOf((float) this.b / 32.0F), Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F)}); -+ } -+ -+ public void a(int i) { -+ this.b = i; -+ } -+ -+ public void b(int i) { -+ this.c = i; -+ } -+ -+ public void c(int i) { -+ this.d = i; -+ } -+ -+ public void d(int i) { -+ this.e = i; -+ } -+ -+ public void e(int i) { -+ this.f = i; -+ } -+ -+ public void f(int i) { -+ this.g = i; -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -new file mode 100644 -index 0000000..435fe8d ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -@@ -0,0 +1,108 @@ -+package net.minecraft.server; -+ -+import java.util.List; -+ -+public class PacketPlayOutSpawnEntityLiving extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private int f; -+ private int g; -+ private int h; -+ private byte i; -+ private byte j; -+ private byte k; -+ private DataWatcher l; -+ private List m; -+ -+ public PacketPlayOutSpawnEntityLiving() {} -+ -+ public PacketPlayOutSpawnEntityLiving(EntityLiving entityliving) { -+ this.a = entityliving.getId(); -+ this.b = (byte) EntityTypes.a(entityliving); -+ this.c = entityliving.as.a(entityliving.locX); -+ this.d = MathHelper.floor(entityliving.locY * 32.0D); -+ this.e = entityliving.as.a(entityliving.locZ); -+ this.i = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F)); -+ this.j = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F)); -+ this.k = (byte) ((int) (entityliving.aO * 256.0F / 360.0F)); -+ double d0 = 3.9D; -+ double d1 = entityliving.motX; -+ double d2 = entityliving.motY; -+ double d3 = entityliving.motZ; -+ -+ if (d1 < -d0) { -+ d1 = -d0; -+ } -+ -+ if (d2 < -d0) { -+ d2 = -d0; -+ } -+ -+ if (d3 < -d0) { -+ d3 = -d0; -+ } -+ -+ if (d1 > d0) { -+ d1 = d0; -+ } -+ -+ if (d2 > d0) { -+ d2 = d0; -+ } -+ -+ if (d3 > d0) { -+ d3 = d0; -+ } -+ -+ this.f = (int) (d1 * 8000.0D); -+ this.g = (int) (d2 * 8000.0D); -+ this.h = (int) (d3 * 8000.0D); -+ this.l = entityliving.getDataWatcher(); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.a(); -+ this.b = packetdataserializer.readByte() & 255; -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readInt(); -+ this.i = packetdataserializer.readByte(); -+ this.j = packetdataserializer.readByte(); -+ this.k = packetdataserializer.readByte(); -+ this.f = packetdataserializer.readShort(); -+ this.g = packetdataserializer.readShort(); -+ this.h = packetdataserializer.readShort(); -+ this.m = DataWatcher.b(packetdataserializer); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.b(this.a); -+ packetdataserializer.writeByte(this.b & 255); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeInt(this.e); -+ packetdataserializer.writeByte(this.i); -+ packetdataserializer.writeByte(this.j); -+ packetdataserializer.writeByte(this.k); -+ packetdataserializer.writeShort(this.f); -+ packetdataserializer.writeShort(this.g); -+ packetdataserializer.writeShort(this.h); -+ this.l.a(packetdataserializer); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f, xd=%.2f, yd=%.2f, zd=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F), Float.valueOf((float) this.e / 32.0F), Float.valueOf((float) this.f / 8000.0F), Float.valueOf((float) this.g / 8000.0F), Float.valueOf((float) this.h / 8000.0F)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -new file mode 100644 -index 0000000..2c86b81 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -@@ -0,0 +1,54 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutSpawnEntityPainting extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private String f; -+ -+ public PacketPlayOutSpawnEntityPainting() {} -+ -+ public PacketPlayOutSpawnEntityPainting(EntityPainting entitypainting) { -+ this.a = entitypainting.getId(); -+ this.b = entitypainting.x; -+ this.c = entitypainting.y; -+ this.d = entitypainting.z; -+ this.e = entitypainting.direction; -+ this.f = entitypainting.art.B; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.a(); -+ this.f = packetdataserializer.c(EnumArt.A); -+ this.b = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.b(this.a); -+ packetdataserializer.a(this.f); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeInt(this.e); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public String b() { -+ return String.format("id=%d, type=%s, x=%d, y=%d, z=%d", new Object[] { Integer.valueOf(this.a), this.f, Integer.valueOf(this.b), Integer.valueOf(this.c), Integer.valueOf(this.d)}); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -new file mode 100644 -index 0000000..3887d15 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -@@ -0,0 +1,44 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutTileEntityData extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private NBTTagCompound e; -+ -+ public PacketPlayOutTileEntityData() {} -+ -+ public PacketPlayOutTileEntityData(int i, int j, int k, int l, NBTTagCompound nbttagcompound) { -+ this.a = i; -+ this.b = j; -+ this.c = k; -+ this.d = l; -+ this.e = nbttagcompound; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readUnsignedByte(); -+ this.e = packetdataserializer.b(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte((byte) this.d); -+ packetdataserializer.a(this.e); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -new file mode 100644 -index 0000000..7b288ad ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -@@ -0,0 +1,79 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+import java.util.ArrayList; -+import java.util.Collection; -+import java.util.Iterator; -+import java.util.List; -+import java.util.UUID; -+ -+public class PacketPlayOutUpdateAttributes extends Packet { -+ -+ private int a; -+ private final List b = new ArrayList(); -+ -+ public PacketPlayOutUpdateAttributes() {} -+ -+ public PacketPlayOutUpdateAttributes(int i, Collection collection) { -+ this.a = i; -+ Iterator iterator = collection.iterator(); -+ -+ while (iterator.hasNext()) { -+ AttributeInstance attributeinstance = (AttributeInstance) iterator.next(); -+ -+ this.b.add(new AttributeSnapshot(this, attributeinstance.getAttribute().getName(), attributeinstance.b(), attributeinstance.c())); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.readInt(); -+ int i = packetdataserializer.readInt(); -+ -+ for (int j = 0; j < i; ++j) { -+ String s = packetdataserializer.c(64); -+ double d0 = packetdataserializer.readDouble(); -+ ArrayList arraylist = new ArrayList(); -+ short short1 = packetdataserializer.readShort(); -+ -+ for (int k = 0; k < short1; ++k) { -+ UUID uuid = new UUID(packetdataserializer.readLong(), packetdataserializer.readLong()); -+ -+ arraylist.add(new AttributeModifier(uuid, "Unknown synced attribute modifier", packetdataserializer.readDouble(), packetdataserializer.readByte())); -+ } -+ -+ this.b.add(new AttributeSnapshot(this, s, d0, arraylist)); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.b.size()); -+ Iterator iterator = this.b.iterator(); -+ -+ while (iterator.hasNext()) { -+ AttributeSnapshot attributesnapshot = (AttributeSnapshot) iterator.next(); -+ -+ packetdataserializer.a(attributesnapshot.a()); -+ packetdataserializer.writeDouble(attributesnapshot.b()); -+ packetdataserializer.writeShort(attributesnapshot.c().size()); -+ Iterator iterator1 = attributesnapshot.c().iterator(); -+ -+ while (iterator1.hasNext()) { -+ AttributeModifier attributemodifier = (AttributeModifier) iterator1.next(); -+ -+ packetdataserializer.writeLong(attributemodifier.a().getMostSignificantBits()); -+ packetdataserializer.writeLong(attributemodifier.a().getLeastSignificantBits()); -+ packetdataserializer.writeDouble(attributemodifier.d()); -+ packetdataserializer.writeByte(attributemodifier.c()); -+ } -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -new file mode 100644 -index 0000000..72b3219 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -@@ -0,0 +1,36 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutUpdateHealth extends Packet { -+ -+ private float a; -+ private int b; -+ private float c; -+ -+ public PacketPlayOutUpdateHealth() {} -+ -+ public PacketPlayOutUpdateHealth(float f, int i, float f1) { -+ this.a = f; -+ this.b = i; -+ this.c = f1; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readFloat(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readFloat(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeFloat(this.a); -+ packetdataserializer.writeShort(this.b); -+ packetdataserializer.writeFloat(this.c); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -new file mode 100644 -index 0000000..7c5d2eb ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -@@ -0,0 +1,49 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutUpdateSign extends Packet { -+ -+ private int x; -+ private int y; -+ private int z; -+ private String[] lines; -+ -+ public PacketPlayOutUpdateSign() {} -+ -+ public PacketPlayOutUpdateSign(int i, int j, int k, String[] astring) { -+ this.x = i; -+ this.y = j; -+ this.z = k; -+ this.lines = new String[] { astring[0], astring[1], astring[2], astring[3]}; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.x = packetdataserializer.readInt(); -+ this.y = packetdataserializer.readShort(); -+ this.z = packetdataserializer.readInt(); -+ this.lines = new String[4]; -+ -+ for (int i = 0; i < 4; ++i) { -+ this.lines[i] = packetdataserializer.c(15); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.writeInt(this.x); -+ packetdataserializer.writeShort(this.y); -+ packetdataserializer.writeInt(this.z); -+ -+ for (int i = 0; i < 4; ++i) { -+ packetdataserializer.a(this.lines[i]); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -new file mode 100644 -index 0000000..7ea6702 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -@@ -0,0 +1,54 @@ -+package net.minecraft.server; -+ -+import java.util.List; -+ -+public class PacketPlayOutWindowItems extends Packet { -+ -+ private int a; -+ private ItemStack[] b; -+ -+ public PacketPlayOutWindowItems() {} -+ -+ public PacketPlayOutWindowItems(int i, List list) { -+ this.a = i; -+ this.b = new ItemStack[list.size()]; -+ -+ for (int j = 0; j < this.b.length; ++j) { -+ ItemStack itemstack = (ItemStack) list.get(j); -+ -+ this.b[j] = itemstack == null ? null : itemstack.cloneItemStack(); -+ } -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readUnsignedByte(); -+ short short1 = packetdataserializer.readShort(); -+ -+ this.b = new ItemStack[short1]; -+ -+ for (int i = 0; i < short1; ++i) { -+ this.b[i] = packetdataserializer.c(); -+ } -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeByte(this.a); -+ packetdataserializer.writeShort(this.b.length); -+ ItemStack[] aitemstack = this.b; -+ int i = aitemstack.length; -+ -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack[j]; -+ -+ packetdataserializer.a(itemstack); -+ } -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -new file mode 100644 -index 0000000..f1001c6 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -@@ -0,0 +1,48 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutWorldEvent extends Packet { -+ -+ private int a; -+ private int b; -+ private int c; -+ private int d; -+ private int e; -+ private boolean f; -+ -+ public PacketPlayOutWorldEvent() {} -+ -+ public PacketPlayOutWorldEvent(int i, int j, int k, int l, int i1, boolean flag) { -+ this.a = i; -+ this.c = j; -+ this.d = k; -+ this.e = l; -+ this.b = i1; -+ this.f = flag; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) { -+ this.a = packetdataserializer.readInt(); -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readByte() & 255; -+ this.e = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readInt(); -+ this.f = packetdataserializer.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) { -+ packetdataserializer.writeInt(this.a); -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeByte(this.d & 255); -+ packetdataserializer.writeInt(this.e); -+ packetdataserializer.writeInt(this.b); -+ packetdataserializer.writeBoolean(this.f); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -new file mode 100644 -index 0000000..29f0c99 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -@@ -0,0 +1,62 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutWorldParticles extends Packet { -+ -+ private String a; -+ private float b; -+ private float c; -+ private float d; -+ private float e; -+ private float f; -+ private float g; -+ private float h; -+ private int i; -+ -+ public PacketPlayOutWorldParticles() {} -+ -+ public PacketPlayOutWorldParticles(String s, float f, float f1, float f2, float f3, float f4, float f5, float f6, int i) { -+ this.a = s; -+ this.b = f; -+ this.c = f1; -+ this.d = f2; -+ this.e = f3; -+ this.f = f4; -+ this.g = f5; -+ this.h = f6; -+ this.i = i; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.c(64); -+ this.b = packetdataserializer.readFloat(); -+ this.c = packetdataserializer.readFloat(); -+ this.d = packetdataserializer.readFloat(); -+ this.e = packetdataserializer.readFloat(); -+ this.f = packetdataserializer.readFloat(); -+ this.g = packetdataserializer.readFloat(); -+ this.h = packetdataserializer.readFloat(); -+ this.i = packetdataserializer.readInt(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.writeFloat(this.b); -+ packetdataserializer.writeFloat(this.c); -+ packetdataserializer.writeFloat(this.d); -+ packetdataserializer.writeFloat(this.e); -+ packetdataserializer.writeFloat(this.f); -+ packetdataserializer.writeFloat(this.g); -+ packetdataserializer.writeFloat(this.h); -+ packetdataserializer.writeInt(this.i); -+ } -+ -+ public void a(PacketPlayOutListener packetplayoutlistener) { -+ packetplayoutlistener.a(this); -+ } -+ -+ public void handle(PacketListener packetlistener) { -+ this.a((PacketPlayOutListener) packetlistener); -+ } -+} --- -1.9.1 - diff --git a/CraftBukkit-Patches/0180-Snapshot-protocol.patch b/CraftBukkit-Patches/0180-Snapshot-protocol.patch deleted file mode 100644 index 671139cad3..0000000000 --- a/CraftBukkit-Patches/0180-Snapshot-protocol.patch +++ /dev/null @@ -1,4468 +0,0 @@ -From 9c66dfb14a3824b06707afff337f81484ca53ecf Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 1 Sep 2014 16:47:48 +1000 -Subject: [PATCH] Snapshot protocol - - -diff --git a/pom.xml b/pom.xml -index 6aeffa8..0d00e79 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -146,6 +146,7 @@ - ${api.version} - Bukkit Team - true -+ ${maven.build.timestamp} - - - -diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index 395d054..96e40ec 100644 ---- a/src/main/java/net/minecraft/server/DataWatcher.java -+++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -9,6 +9,7 @@ import java.util.concurrent.locks.ReadWriteLock; - import java.util.concurrent.locks.ReentrantReadWriteLock; - - import net.minecraft.util.org.apache.commons.lang3.ObjectUtils; -+import org.spigotmc.ProtocolData; // Spigot - protocol patch - - public class DataWatcher { - -@@ -31,6 +32,19 @@ public class DataWatcher { - public void a(int i, Object object) { - int integer = classToId.get(object.getClass()); // Spigot - -+ // Spigot start - protocol patch -+ if ( object instanceof ProtocolData.ByteShort -+ || object instanceof ProtocolData.DualByte -+ || object instanceof ProtocolData.HiddenByte ) -+ { -+ integer = classToId.get( Byte.class ); -+ } -+ if ( object instanceof ProtocolData.IntByte -+ || object instanceof ProtocolData.DualInt ) { -+ integer = classToId.get( Integer.class ); -+ } -+ // Spigot end -+ - if (integer == -1) { // Spigot - throw new IllegalArgumentException("Unknown data type: " + object.getClass()); - } else if (i > 31) { -@@ -57,19 +71,19 @@ public class DataWatcher { - } - - public byte getByte(int i) { -- return ((Byte) this.i(i).b()).byteValue(); -+ return ((Number) this.i(i).b()).byteValue(); // Spigot - protocol patch - } - - public short getShort(int i) { -- return ((Short) this.i(i).b()).shortValue(); -+ return ((Number) this.i(i).b()).shortValue(); // Spigot - protocol patch - } - - public int getInt(int i) { -- return ((Integer) this.i(i).b()).intValue(); -+ return ((Number) this.i(i).b()).intValue(); // Spigot - protocol patch - } - - public float getFloat(int i) { -- return ((Float) this.i(i).b()).floatValue(); -+ return ((Number) this.i(i).b()).floatValue(); // Spigot - protocol patch - } - - public String getString(int i) { -@@ -80,6 +94,18 @@ public class DataWatcher { - return (ItemStack) this.i(i).b(); - } - -+ // Spigot start - protocol patch -+ public ProtocolData.DualByte getDualByte(int i) { -+ return (ProtocolData.DualByte) this.i(i).b(); -+ } -+ public ProtocolData.IntByte getIntByte(int i) { -+ return (ProtocolData.IntByte) this.i(i).b(); -+ } -+ public ProtocolData.DualInt getDualInt(int i) { -+ return (ProtocolData.DualInt) this.i(i).b(); -+ } -+ // Spigot end -+ - private WatchableObject i(int i) { - this.f.readLock().lock(); - -@@ -119,14 +145,20 @@ public class DataWatcher { - return this.e; - } - -+ // Spigot start - protocol patch - public static void a(List list, PacketDataSerializer packetdataserializer) { -+ a(list, packetdataserializer, 5); -+ } -+ -+ public static void a(List list, PacketDataSerializer packetdataserializer, int version) { -+ // Spigot end - protocol patch - if (list != null) { - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { - WatchableObject watchableobject = (WatchableObject) iterator.next(); - -- a(packetdataserializer, watchableobject); -+ a(packetdataserializer, watchableobject, version); // Spigot - protocol patch - } - } - -@@ -171,14 +203,20 @@ public class DataWatcher { - return arraylist; - } - -+ // Spigot start - protocol patch - public void a(PacketDataSerializer packetdataserializer) { -+ a(packetdataserializer, 5); -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer, int version) { -+ // Spigot end - this.f.readLock().lock(); - Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot - - while (iterator.hasNext()) { - WatchableObject watchableobject = (WatchableObject) iterator.next(); - -- a(packetdataserializer, watchableobject); -+ a(packetdataserializer, watchableobject, version); // Spigot - protocol patch - } - - this.f.readLock().unlock(); -@@ -211,25 +249,46 @@ public class DataWatcher { - return arraylist; - } - -- private static void a(PacketDataSerializer packetdataserializer, WatchableObject watchableobject) { -- int i = (watchableobject.c() << 5 | watchableobject.a() & 31) & 255; -+ // Spigot start - protocol patch -+ private static void a(PacketDataSerializer packetdataserializer, WatchableObject watchableobject, int version) { -+ int type = watchableobject.c(); -+ if (watchableobject.b() instanceof ProtocolData.ByteShort && version >= 16) { -+ type = 1; -+ } -+ if (watchableobject.b() instanceof ProtocolData.IntByte && version >= 28) { -+ type = 0; -+ } -+ if ( version < 16 && watchableobject.b() instanceof ProtocolData.HiddenByte ) return; -+ -+ int i = (type << 5 | watchableobject.a() & 31) & 255; - - packetdataserializer.writeByte(i); -- switch (watchableobject.c()) { -+ switch (type) { - case 0: -- packetdataserializer.writeByte(((Byte) watchableobject.b()).byteValue()); -+ if ( watchableobject.b() instanceof ProtocolData.DualByte ) -+ { -+ ProtocolData.DualByte dualByte = (ProtocolData.DualByte) watchableobject.b(); -+ packetdataserializer.writeByte( version >= 16 ? dualByte.value2 : dualByte.value ); -+ } else -+ { -+ packetdataserializer.writeByte( ( (Number) watchableobject.b() ).byteValue() ); -+ } - break; - - case 1: -- packetdataserializer.writeShort(((Short) watchableobject.b()).shortValue()); -+ packetdataserializer.writeShort(((Number) watchableobject.b()).shortValue()); - break; - - case 2: -- packetdataserializer.writeInt(((Integer) watchableobject.b()).intValue()); -+ int val = ((Number) watchableobject.b()).intValue(); -+ if ( watchableobject.b() instanceof ProtocolData.DualInt && version >= 46 ) { -+ val = ((ProtocolData.DualInt) watchableobject.b()).value2; -+ } -+ packetdataserializer.writeInt(val); - break; - - case 3: -- packetdataserializer.writeFloat(((Float) watchableobject.b()).floatValue()); -+ packetdataserializer.writeFloat(((Number) watchableobject.b()).floatValue()); - break; - - case 4: -@@ -254,6 +313,7 @@ public class DataWatcher { - packetdataserializer.writeInt(chunkcoordinates.z); - } - } -+ // Spigot end - - public static List b(PacketDataSerializer packetdataserializer) { - ArrayList arraylist = null; -diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java -index 7ddca48..af73b81 100644 ---- a/src/main/java/net/minecraft/server/EntityAgeable.java -+++ b/src/main/java/net/minecraft/server/EntityAgeable.java -@@ -73,11 +73,11 @@ public abstract class EntityAgeable extends EntityCreature { - - protected void c() { - super.c(); -- this.datawatcher.a(12, new Integer(0)); -+ this.datawatcher.a(12, new org.spigotmc.ProtocolData.IntByte(0, (byte) 0)); // Spigot - protocol patch - } - - public int getAge() { -- return this.datawatcher.getInt(12); -+ return this.datawatcher.getIntByte(12).value; // Spigot - protocol patch - } - - public void a(int i) { -@@ -92,7 +92,7 @@ public abstract class EntityAgeable extends EntityCreature { - } - - public void setAge(int i) { -- this.datawatcher.watch(12, Integer.valueOf(i)); -+ this.datawatcher.watch(12, new org.spigotmc.ProtocolData.IntByte(i, (byte) ( i < 0 ? -1 : (i >= 6000 ? 1 : 0)))); // Spigot - protocol patch - this.a(this.isBaby()); - } - -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index fa6670b..87afc9c 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -7,6 +7,7 @@ import org.bukkit.Location; - import org.bukkit.craftbukkit.event.CraftEventFactory; - import org.bukkit.event.entity.EntityTeleportEvent; - // CraftBukkit end -+import org.spigotmc.ProtocolData; // Spigot - protocol patch - - public class EntityEnderman extends EntityMonster { - -@@ -33,7 +34,7 @@ public class EntityEnderman extends EntityMonster { - - protected void c() { - super.c(); -- this.datawatcher.a(16, new Byte((byte) 0)); -+ this.datawatcher.a( 16, new ProtocolData.ByteShort( (short) 0 ) ); // Spigot - protocol patch, handle metadata change - this.datawatcher.a(17, new Byte((byte) 0)); - this.datawatcher.a(18, new Byte((byte) 0)); - } -@@ -315,11 +316,11 @@ public class EntityEnderman extends EntityMonster { - } - - public void setCarried(Block block) { -- this.datawatcher.watch(16, Byte.valueOf((byte) (Block.getId(block) & 255))); -+ this.datawatcher.watch( 16, new ProtocolData.ByteShort( (short) Block.getId( block ) ) ); // Spigot - protocol patch, handle metadata change - } - - public Block getCarried() { -- return Block.getById(this.datawatcher.getByte(16)); -+ return Block.getById(this.datawatcher.getShort( 16 )); // Spigot - protocol patch, handle metadata change - } - - public void setCarriedData(int i) { -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 219eb5f..5bb7295 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -19,6 +19,7 @@ import org.bukkit.event.player.PlayerBedLeaveEvent; - import org.bukkit.event.player.PlayerDropItemEvent; - import org.bukkit.event.player.PlayerItemConsumeEvent; - // CraftBukkit end -+import org.spigotmc.ProtocolData; // Spigot - protocol patch - - public abstract class EntityHuman extends EntityLiving implements ICommandListener { - -@@ -89,9 +90,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - - protected void c() { - super.c(); -- this.datawatcher.a(16, Byte.valueOf((byte) 0)); -+ this.datawatcher.a( 16, new ProtocolData.DualByte( (byte) 0, (byte) 0 ) ); // Spigot - protocol patch, handle metadata usage change (show cape -> collisions) - this.datawatcher.a(17, Float.valueOf(0.0F)); - this.datawatcher.a(18, Integer.valueOf(0)); -+ this.datawatcher.a( 10, new ProtocolData.HiddenByte( (byte) 0 ) ); // Spigot - protocol patch, handle new metadata value - } - - public boolean by() { -@@ -1224,15 +1226,23 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - return this.sleeping && this.sleepTicks >= 100; - } - -- protected void b(int i, boolean flag) { -- byte b0 = this.datawatcher.getByte(16); -- -+ // Spigot start - protocol patch, handle metadata usage change (show cape -> collisions) -+ protected void b(int i, boolean flag, int version) { -+ ProtocolData.DualByte db = this.datawatcher.getDualByte( 16 ); -+ byte b0 = version >= 16 ? db.value2 : db.value; - if (flag) { -- this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1 << i))); -+ b0 = (byte) ( b0 | 1 << i ); -+ } else { -+ b0 = (byte) (b0 & ~(1 << i)); -+ } -+ if (version >= 16) { -+ db.value2 = b0; - } else { -- this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & ~(1 << i)))); -+ db.value = b0; - } -+ this.datawatcher.watch(16, db); - } -+ // Spigot end - - public void b(IChatBaseComponent ichatbasecomponent) {} - -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index f6c4788..617f7d4 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -93,6 +93,10 @@ public abstract class EntityInsentient extends EntityLiving { - super.c(); - this.datawatcher.a(11, Byte.valueOf((byte) 0)); - this.datawatcher.a(10, ""); -+ // Spigot start - protocol patch -+ this.datawatcher.a(3, Byte.valueOf((byte) 0)); -+ this.datawatcher.a(2, ""); -+ // Spigot end - } - - public int q() { -@@ -733,6 +737,7 @@ public abstract class EntityInsentient extends EntityLiving { - - public void setCustomName(String s) { - this.datawatcher.watch(10, s); -+ this.datawatcher.watch(2, s); // Spigot - protocol patch - } - - public String getCustomName() { -@@ -745,6 +750,7 @@ public abstract class EntityInsentient extends EntityLiving { - - public void setCustomNameVisible(boolean flag) { - this.datawatcher.watch(11, Byte.valueOf((byte) (flag ? 1 : 0))); -+ this.datawatcher.watch(3, Byte.valueOf((byte) (flag ? 1 : 0))); // Spigot - protocol patch - } - - public boolean getCustomNameVisible() { -diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java -index d1d73f9..5109b5d 100644 ---- a/src/main/java/net/minecraft/server/EntityItemFrame.java -+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java -@@ -16,6 +16,10 @@ public class EntityItemFrame extends EntityHanging { - protected void c() { - this.getDataWatcher().add(2, 5); - this.getDataWatcher().a(3, Byte.valueOf((byte) 0)); -+ // Spigot start - protocol patch -+ this.getDataWatcher().add(8, 5); -+ this.getDataWatcher().a(9, Byte.valueOf((byte) 0)); -+ // Spigot end - } - - public boolean damageEntity(DamageSource damagesource, float f) { -@@ -99,6 +103,10 @@ public class EntityItemFrame extends EntityHanging { - - this.getDataWatcher().watch(2, itemstack); - this.getDataWatcher().update(2); -+ // Spigot start - protocol patch -+ this.getDataWatcher().watch(8, itemstack); -+ this.getDataWatcher().update(8); -+ // Spigot end - } - - public int getRotation() { -@@ -107,6 +115,7 @@ public class EntityItemFrame extends EntityHanging { - - public void setRotation(int i) { - this.getDataWatcher().watch(3, Byte.valueOf((byte) (i % 4))); -+ this.getDataWatcher().watch(9, Byte.valueOf((byte) ((i % 4) * 2))); // Spigot - protocol patch - } - - public void b(NBTTagCompound nbttagcompound) { -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index 2a1e69d..0710fcc 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -74,7 +74,7 @@ public abstract class EntityMinecartAbstract extends Entity { - this.datawatcher.a(17, new Integer(0)); - this.datawatcher.a(18, new Integer(1)); - this.datawatcher.a(19, new Float(0.0F)); -- this.datawatcher.a(20, new Integer(0)); -+ this.datawatcher.a(20, new org.spigotmc.ProtocolData.DualInt(0, 0)); // Spigot - protocol patch - this.datawatcher.a(21, new Integer(6)); - this.datawatcher.a(22, Byte.valueOf((byte) 0)); - } -@@ -841,12 +841,22 @@ public abstract class EntityMinecartAbstract extends Entity { - } - - public void k(int i) { -- this.getDataWatcher().watch(20, Integer.valueOf(i & '\uffff' | this.p() << 16)); -+ // Spigot start - protocol patch -+ org.spigotmc.ProtocolData.DualInt val = datawatcher.getDualInt(20); -+ val.value = Integer.valueOf(i & '\uffff' | this.p() << 16); -+ val.value2 = Integer.valueOf(i & '\uffff' | this.p() << 12); -+ this.getDataWatcher().watch(20, val); -+ // Spigot end - this.a(true); - } - - public void l(int i) { -- this.getDataWatcher().watch(20, Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 16)); -+ // Spigot start - protocol patch -+ org.spigotmc.ProtocolData.DualInt val = datawatcher.getDualInt(20); -+ val.value = Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 16); -+ val.value2 = Integer.valueOf(Block.getId(this.n()) & '\uffff' | i << 12); -+ this.getDataWatcher().watch(20, val); -+ // Spigot end - this.a(true); - } - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 413af68..6e80242 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -26,6 +26,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; - import org.bukkit.event.inventory.InventoryType; - import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - // CraftBukkit end -+import org.spigotmc.ProtocolData; // Spigot - protocol patch - - public class EntityPlayer extends EntityHuman implements ICrafting { - -@@ -233,7 +234,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - - if (!arraylist.isEmpty()) { -- this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist)); -+ this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist, this.playerConnection.networkManager.getVersion())); // Spigot - protocol patch - Iterator iterator2 = arraylist1.iterator(); - - while (iterator2.hasNext()) { -@@ -594,7 +595,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // CraftBukkit end - - this.nextContainerCounter(); -- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 9, true)); -+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 0, true)); // Spigot - protocol patch - this.activeContainer = container; // CraftBukkit - Use container we passed to event - this.activeContainer.windowId = this.containerCounter; - this.activeContainer.addSlotListener(this); -@@ -609,7 +610,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // CraftBukkit end - - this.nextContainerCounter(); -- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null)); -+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 0, s != null)); // Spigot - protocol patch - this.activeContainer = container; // CraftBukkit - Use container we passed to event - this.activeContainer.windowId = this.containerCounter; - this.activeContainer.addSlotListener(this); -@@ -624,7 +625,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // CraftBukkit end - - this.nextContainerCounter(); -- this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 9, true)); -+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 0, true)); // Spigot - protocol patch - this.activeContainer = container; // CraftBukkit - Use container we passed to event - this.activeContainer.windowId = this.containerCounter; - this.activeContainer.addSlotListener(this); -@@ -764,7 +765,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - MerchantRecipeList merchantrecipelist = imerchant.getOffers(this); - - if (merchantrecipelist != null) { -- PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer()); -+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer(), playerConnection.networkManager.getVersion()); // Spigot - - try { - packetdataserializer.writeInt(this.containerCounter); -@@ -821,6 +822,22 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - - public void setContainerData(Container container, int i, int j) { -+ // Spigot start - protocol patch -+ if ( container instanceof ContainerFurnace && playerConnection.networkManager.getVersion() >= 47 ) -+ { -+ switch ( i ) { -+ case 0: -+ i = 2; -+ this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, 3, 200)); -+ break; -+ case 1: -+ i = 0; -+ break; -+ case 2: -+ i = 1; -+ } -+ } -+ // Spigot end - this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, i, j)); - } - -@@ -1004,7 +1021,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.server.a(packetplayinsettings.g()); - } - -- this.b(1, !packetplayinsettings.h()); -+ // Spigot start - protocol patch, handle metadata usage change (show cape -> collisions) -+ if (packetplayinsettings.version < 16) -+ { -+ this.b( 1, !packetplayinsettings.h(), packetplayinsettings.version ); -+ } else -+ { -+ this.b( 1, false, packetplayinsettings.version ); -+ datawatcher.watch( 10, new ProtocolData.HiddenByte( (byte) packetplayinsettings.flags ) ); -+ } -+ // Spigot end - } - - public EnumChatVisibility getChatFlags() { -@@ -1013,6 +1039,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - public void setResourcePack(String s) { - this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|RPack", s.getBytes(Charsets.UTF_8))); -+ // Spigot start - protocol patch -+ if ( playerConnection.networkManager.getVersion() >= 36 ) -+ { -+ playerConnection.sendPacket( new org.spigotmc.ProtocolInjector.PacketPlayResourcePackSend( s, "thinkislazy" ) ); -+ } -+ // Spigot end - } - - public ChunkCoordinates getChunkCoordinates() { -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index f654d58..46c4fb8 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -134,11 +134,11 @@ public class EntityTrackerEntry { - if (this.m > 0 || this.tracker instanceof EntityArrow) { - if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x) { - if (flag && flag1) { -- object = new PacketPlayOutRelEntityMoveLook(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1); -+ object = new PacketPlayOutRelEntityMoveLook(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch - } else if (flag) { -- object = new PacketPlayOutRelEntityMove(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1); -+ object = new PacketPlayOutRelEntityMove(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, tracker.onGround); // Spigot - protocol patch - } else if (flag1) { -- object = new PacketPlayOutEntityLook(this.tracker.getId(), (byte) l, (byte) i1); -+ object = new PacketPlayOutEntityLook(this.tracker.getId(), (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch - } - } else { - this.v = 0; -@@ -147,7 +147,7 @@ public class EntityTrackerEntry { - this.scanPlayers(new java.util.ArrayList(this.trackedPlayers)); - } - // CraftBukkit end -- object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1); -+ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch - } - } - -@@ -191,7 +191,7 @@ public class EntityTrackerEntry { - boolean flag2 = Math.abs(i - this.yRot) >= 4 || Math.abs(j - this.xRot) >= 4; - - if (flag2) { -- this.broadcast(new PacketPlayOutEntityLook(this.tracker.getId(), (byte) i, (byte) j)); -+ this.broadcast(new PacketPlayOutEntityLook(this.tracker.getId(), (byte) i, (byte) j, tracker.onGround)); // Spigot - protocol patch - this.yRot = i; - this.xRot = j; - } -@@ -320,6 +320,13 @@ public class EntityTrackerEntry { - this.trackedPlayers.add(entityplayer); - Packet packet = this.c(); - -+ // Spigot start - protocol patch -+ if ( tracker instanceof EntityPlayer ) -+ { -+ entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.addPlayer( (EntityPlayer) tracker ) ); -+ } -+ // Spigot end -+ - entityplayer.playerConnection.sendPacket(packet); - if (!this.tracker.getDataWatcher().d()) { - entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(this.tracker.getId(), this.tracker.getDataWatcher(), true)); -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 09fdb88..e0a1708 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -72,7 +72,7 @@ public class HandshakeListener implements PacketHandshakingInListener { - } - // CraftBukkit end - -- if (packethandshakinginsetprotocol.d() > 5) { -+ if (packethandshakinginsetprotocol.d() > 5 && packethandshakinginsetprotocol.d() != 47) { // Spigot - chatcomponenttext = new ChatComponentText( org.spigotmc.SpigotConfig.outdatedServerMessage ); // Spigot - this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); - this.b.close(chatcomponenttext); -diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java -index c08ccca..881fd4b 100644 ---- a/src/main/java/net/minecraft/server/ItemWorldMap.java -+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java -@@ -199,7 +199,7 @@ public class ItemWorldMap extends ItemWorldMapBase { - public Packet c(ItemStack itemstack, World world, EntityHuman entityhuman) { - byte[] abyte = this.getSavedMap(itemstack, world).getUpdatePacket(itemstack, world, entityhuman); - -- return abyte == null ? null : new PacketPlayOutMap(itemstack.getData(), abyte); -+ return abyte == null ? null : new PacketPlayOutMap(itemstack.getData(), abyte, this.getSavedMap(itemstack, world).scale); // Spigot - protocol patch - } - - public void d(ItemStack itemstack, World world, EntityHuman entityhuman) { -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index e380a70..bd254de 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -10,6 +10,7 @@ import javax.crypto.SecretKey; - import net.minecraft.util.com.google.common.base.Charsets; - import net.minecraft.util.com.mojang.authlib.GameProfile; - import net.minecraft.util.com.mojang.authlib.properties.Property; -+import net.minecraft.util.io.netty.util.concurrent.Future; - import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; - import net.minecraft.util.org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; -@@ -101,6 +102,19 @@ public class LoginListener implements PacketLoginInListener { - // CraftBukkit end - } else { - this.g = EnumProtocolState.e; -+ // Spigot start -+ if ( networkManager.getVersion() >= 27 ) -+ { -+ this.networkManager.handle( new org.spigotmc.ProtocolInjector.PacketLoginCompression( 256 ), new GenericFutureListener() -+ { -+ @Override -+ public void operationComplete(Future future) throws Exception -+ { -+ networkManager.enableCompression(); -+ } -+ } ); -+ } -+ // Spigot end - this.networkManager.handle(new PacketLoginOutSuccess(this.i), new GenericFutureListener[0]); - this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference - } -diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java -index 770da8f..aa6bbf6 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipe.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java -@@ -5,8 +5,8 @@ public class MerchantRecipe { - private ItemStack buyingItem1; - private ItemStack buyingItem2; - private ItemStack sellingItem; -- private int uses; -- private int maxUses; -+ public int uses; // Spigot - protocol patch -+ public int maxUses; // Spigot - protocol patch - - public MerchantRecipe(NBTTagCompound nbttagcompound) { - this.a(nbttagcompound); -diff --git a/src/main/java/net/minecraft/server/MerchantRecipeList.java b/src/main/java/net/minecraft/server/MerchantRecipeList.java -index be6ab25..6ddbf7a 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipeList.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipeList.java -@@ -60,6 +60,13 @@ public class MerchantRecipeList extends ArrayList { - } - - packetdataserializer.writeBoolean(merchantrecipe.g()); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 28 ) -+ { -+ packetdataserializer.writeInt( merchantrecipe.uses ); -+ packetdataserializer.writeInt( merchantrecipe.maxUses ); -+ } -+ // Spigot end - } - } - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b905c6e..8c3950a 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -758,6 +758,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - - public static void main(final OptionSet options) { // CraftBukkit - replaces main(String[] astring) - DispenserRegistry.b(); -+ org.spigotmc.ProtocolInjector.inject(); - - try { - /* CraftBukkit start - Replace everything -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index ae3de2f..0cae021 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -24,6 +24,8 @@ import org.apache.logging.log4j.Marker; - import org.apache.logging.log4j.MarkerManager; - // Spigot start - import com.google.common.collect.ImmutableSet; -+import org.spigotmc.SpigotCompressor; -+import org.spigotmc.SpigotDecompressor; - // Spigot end - - public class NetworkManager extends SimpleChannelInboundHandler { -@@ -53,7 +55,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { - private boolean r; - // Spigot Start - public static final AttributeKey protocolVersion = new AttributeKey("protocol_version"); -- public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5); -+ public static final ImmutableSet SUPPORTED_VERSIONS = ImmutableSet.of(4, 5, 47); - public static final int CURRENT_VERSION = 5; - public static int getVersion(Channel attr) - { -@@ -244,4 +246,18 @@ public class NetworkManager extends SimpleChannelInboundHandler { - return this.m.remoteAddress(); - } - // Spigot End -+ -+ -+ // Spigot start - protocol patch -+ public void enableCompression() { -+ // Fix ProtocolLib compatibility -+ if ( m.pipeline().get("protocol_lib_decoder") != null ) { -+ m.pipeline().addBefore( "protocol_lib_decoder", "decompress", new SpigotDecompressor() ); -+ } else { -+ m.pipeline().addBefore( "decoder", "decompress", new SpigotDecompressor() ); -+ } -+ -+ m.pipeline().addBefore( "encoder", "compress", new SpigotCompressor() ); -+ } -+ // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java -index 592ffc5..7a1e8f0 100644 ---- a/src/main/java/net/minecraft/server/Packet.java -+++ b/src/main/java/net/minecraft/server/Packet.java -@@ -26,12 +26,39 @@ public abstract class Packet { - } - - public static void a(ByteBuf bytebuf, byte[] abyte) { -- bytebuf.writeShort(abyte.length); -+ // Spigot start - protocol patch -+ if (bytebuf instanceof PacketDataSerializer) -+ { -+ PacketDataSerializer packetDataSerializer = (PacketDataSerializer) bytebuf; -+ if (packetDataSerializer.version >= 20) { -+ packetDataSerializer.b( abyte.length ); -+ } else { -+ bytebuf.writeShort( abyte.length ); -+ } -+ } else -+ { -+ bytebuf.writeShort( abyte.length ); -+ } -+ // Spigot end - bytebuf.writeBytes(abyte); - } - - public static byte[] a(ByteBuf bytebuf) throws IOException { // CraftBukkit - added throws -- short short1 = bytebuf.readShort(); -+ // Spigot start - protocol patch -+ short short1 = 0; -+ if (bytebuf instanceof PacketDataSerializer) -+ { -+ PacketDataSerializer packetDataSerializer = (PacketDataSerializer) bytebuf; -+ if (packetDataSerializer.version >= 20) { -+ short1 = (short) packetDataSerializer.a(); -+ } else { -+ short1 = bytebuf.readShort(); -+ } -+ } else -+ { -+ short1 = bytebuf.readShort(); -+ } -+ // Spigot end - - if (short1 < 0) { - throw new IOException("Key was smaller than nothing! Weird key!"); -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index e4df5b3..451f5fd 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -8,6 +8,7 @@ import java.nio.ByteOrder; - import java.nio.channels.GatheringByteChannel; - import java.nio.channels.ScatteringByteChannel; - import java.nio.charset.Charset; -+import java.util.UUID; - - import net.minecraft.util.com.google.common.base.Charsets; - import net.minecraft.util.io.netty.buffer.ByteBuf; -@@ -16,6 +17,15 @@ import net.minecraft.util.io.netty.buffer.ByteBufProcessor; - - import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit - -+// Spigot start - protocol patch -+import java.io.DataInputStream; -+import java.io.DataOutputStream; -+import net.minecraft.util.io.netty.buffer.Unpooled; -+import net.minecraft.util.io.netty.buffer.ByteBufInputStream; -+import net.minecraft.util.io.netty.buffer.ByteBufOutputStream; -+import org.spigotmc.SpigotComponentReverter; -+// Spigot end -+ - public class PacketDataSerializer extends ByteBuf { - - private final ByteBuf a; -@@ -31,6 +41,32 @@ public class PacketDataSerializer extends ByteBuf { - this.a = bytebuf; - this.version = version; - } -+ -+ public void writePosition(int x, int y, int z) { -+ writeLong( ( ( (long) x & 0x3FFFFFFL ) << 38 ) -+ | ( ( (long) y & 0xFFFL ) << 26 ) -+ | ( (long) z & 0x3FFFFFFL ) ); -+ } -+ -+ public int readPositionX(long val) -+ { -+ return (int) ( val >> 38 ); -+ } -+ -+ public int readPositionY(long val) -+ { -+ return (int) (val << 26 >> 52); -+ } -+ -+ public int readPositionZ(long val) -+ { -+ return (int) (val << 38 >> 38); -+ } -+ -+ public void writeUUID(UUID uuid) { -+ writeLong( uuid.getMostSignificantBits() ); -+ writeLong( uuid.getLeastSignificantBits() ); -+ } - // Spigot End - - public static int a(int i) { -@@ -63,35 +99,75 @@ public class PacketDataSerializer extends ByteBuf { - this.writeByte(i); - } - -- public void a(NBTTagCompound nbttagcompound) { -- if (nbttagcompound == null) { -- this.writeShort(-1); -- } else { -- byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound); -- -- this.writeShort((short) abyte.length); -- this.writeBytes(abyte); -+ // Spigot start - protocol patch -+ public void a(NBTTagCompound nbttagcompound) -+ { -+ if ( version < 28 ) -+ { -+ if ( nbttagcompound == null ) -+ { -+ this.writeShort( -1 ); -+ } else -+ { -+ byte[] abyte = NBTCompressedStreamTools.a( nbttagcompound ); -+ -+ this.writeShort( (short) abyte.length ); -+ this.writeBytes( abyte ); -+ } -+ } else -+ { -+ if ( nbttagcompound == null ) -+ { -+ this.writeByte( 0 ); -+ } else -+ { -+ ByteBufOutputStream out = new ByteBufOutputStream( Unpooled.buffer() ); -+ NBTCompressedStreamTools.a( nbttagcompound, (java.io.DataOutput) new DataOutputStream( out ) ); -+ writeBytes( out.buffer() ); -+ out.buffer().release(); -+ } - } - } - - public NBTTagCompound b() { -- short short1 = this.readShort(); -- -- if (short1 < 0) { -- return null; -+ if ( version < 28 ) -+ { -+ short short1 = this.readShort(); -+ -+ if ( short1 < 0 ) -+ { -+ return null; -+ } else -+ { -+ byte[] abyte = new byte[ short1 ]; -+ -+ this.readBytes( abyte ); -+ return NBTCompressedStreamTools.a( abyte, new NBTReadLimiter( 2097152L ) ); -+ } - } else { -- byte[] abyte = new byte[short1]; -- -- this.readBytes(abyte); -- return NBTCompressedStreamTools.a(abyte, new NBTReadLimiter(2097152L)); -+ int index = readerIndex(); -+ if (readByte() == 0) { -+ return null; -+ } -+ readerIndex(index); -+ return NBTCompressedStreamTools.a( new DataInputStream( new ByteBufInputStream( a ) ) ); - } - } -+ // Spigot end - - public void a(ItemStack itemstack) { - if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem() - this.writeShort(-1); - } else { -- this.writeShort(Item.getId(itemstack.getItem())); -+ // Spigot start - protocol patch -+ if ( version >= 47 ) -+ { -+ this.writeShort( org.spigotmc.SpigotDebreakifier.getItemId( Item.getId( itemstack.getItem() ) ) ); -+ } else -+ { -+ this.writeShort( Item.getId( itemstack.getItem() ) ); -+ } -+ // Spigot end - this.writeByte(itemstack.count); - this.writeShort(itemstack.getData()); - NBTTagCompound nbttagcompound = null; -@@ -104,6 +180,31 @@ public class PacketDataSerializer extends ByteBuf { - nbttagcompound = itemstack.tag; - } - -+ // Spigot start - protocol patch -+ if (nbttagcompound != null && version >= 29 ) -+ { -+ if ( itemstack.getItem() == Items.WRITTEN_BOOK && nbttagcompound.hasKeyOfType("pages", 9) ) -+ { -+ nbttagcompound = (NBTTagCompound) nbttagcompound.clone(); -+ NBTTagList nbttaglist = nbttagcompound.getList( "pages", 8 ); -+ NBTTagList newList = new NBTTagList(); -+ for (int i = 0; i < nbttaglist.size(); ++i) -+ { -+ IChatBaseComponent[] parts = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( nbttaglist.getString( i ) ); -+ IChatBaseComponent root = parts[0]; -+ for ( int i1 = 1; i1 < parts.length; i1++ ) -+ { -+ IChatBaseComponent c = parts[ i1 ]; -+ root.a( "\n" ); -+ root.addSibling( c ); -+ } -+ newList.add( new NBTTagString( ChatSerializer.a( root ) ) ); -+ } -+ nbttagcompound.set( "pages", newList ); -+ } -+ } -+ // Spigot end -+ - this.a(nbttagcompound); - } - } -@@ -120,6 +221,24 @@ public class PacketDataSerializer extends ByteBuf { - itemstack.tag = this.b(); - // CraftBukkit start - if (itemstack.tag != null) { -+ -+ // Spigot start - protocol patch -+ if ( version >= 29 -+ && itemstack.getItem() == Items.WRITTEN_BOOK -+ && itemstack.tag.hasKeyOfType("pages", 9) ) -+ { -+ NBTTagList nbttaglist = itemstack.tag.getList( "pages", 8 ); -+ NBTTagList newList = new NBTTagList(); -+ for (int i = 0; i < nbttaglist.size(); ++i) -+ { -+ IChatBaseComponent s = ChatSerializer.a( nbttaglist.getString( i ) ); -+ String newString = SpigotComponentReverter.toLegacy( s ); -+ newList.add( new NBTTagString( newString ) ); -+ } -+ itemstack.tag.set( "pages", newList ); -+ } -+ // Spigot end -+ - CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); - } - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PacketDecoder.java b/src/main/java/net/minecraft/server/PacketDecoder.java -index 71ec28c..5213f1f 100644 ---- a/src/main/java/net/minecraft/server/PacketDecoder.java -+++ b/src/main/java/net/minecraft/server/PacketDecoder.java -@@ -26,7 +26,7 @@ public class PacketDecoder extends ByteToMessageDecoder { - int i = bytebuf.readableBytes(); - - if (i != 0) { -- PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); -+ PacketDataSerializer packetdataserializer = new PacketDataSerializer( bytebuf, NetworkManager.getVersion( channelhandlercontext.channel() ) ); // Spigot - int j = packetdataserializer.a(); - Packet packet = Packet.a((BiMap) channelhandlercontext.channel().attr(NetworkManager.e).get(), j); - -diff --git a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -index 91df585..91d9e58 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInArmAnimation.java -@@ -8,8 +8,15 @@ public class PacketPlayInArmAnimation extends Packet { - public PacketPlayInArmAnimation() {} - - public void a(PacketDataSerializer packetdataserializer) { -- this.a = packetdataserializer.readInt(); -- this.b = packetdataserializer.readByte(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readByte(); -+ } else { -+ b = 1; -+ } -+ // Spigot end - } - - public void b(PacketDataSerializer packetdataserializer) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -index 3c5ed45..e85ba8c 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java -@@ -12,9 +12,20 @@ public class PacketPlayInBlockDig extends Packet { - - public void a(PacketDataSerializer packetdataserializer) { - this.e = packetdataserializer.readUnsignedByte(); -- this.a = packetdataserializer.readInt(); -- this.b = packetdataserializer.readUnsignedByte(); -- this.c = packetdataserializer.readInt(); -+ // Spigot start -+ if ( packetdataserializer.version < 16) -+ { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.readInt(); -+ } else -+ { -+ long position = packetdataserializer.readLong(); -+ a = packetdataserializer.readPositionX( position ); -+ b = packetdataserializer.readPositionY( position ); -+ c = packetdataserializer.readPositionZ( position ); -+ } -+ // Spigot end - this.face = packetdataserializer.readUnsignedByte(); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -index 701b3a2..b9cea4c 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java -@@ -14,9 +14,20 @@ public class PacketPlayInBlockPlace extends Packet { - public PacketPlayInBlockPlace() {} - - public void a(PacketDataSerializer packetdataserializer) { -- this.a = packetdataserializer.readInt(); -- this.b = packetdataserializer.readUnsignedByte(); -- this.c = packetdataserializer.readInt(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readUnsignedByte(); -+ this.c = packetdataserializer.readInt(); -+ } else -+ { -+ long position = packetdataserializer.readLong(); -+ a = packetdataserializer.readPositionX( position ); -+ b = packetdataserializer.readPositionY( position ); -+ c = packetdataserializer.readPositionZ( position ); -+ } -+ // Spigot end - this.d = packetdataserializer.readUnsignedByte(); - this.e = packetdataserializer.c(); - this.f = (float) packetdataserializer.readUnsignedByte() / 16.0F; -diff --git a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java -index 5df99a4..54ac5b7 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java -@@ -12,7 +12,15 @@ public class PacketPlayInCustomPayload extends Packet { - - public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws - this.tag = packetdataserializer.c(20); -- this.length = packetdataserializer.readShort(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 29 ) -+ { -+ this.length = packetdataserializer.readShort(); -+ } else -+ { -+ this.length = packetdataserializer.readableBytes(); -+ } -+ // Spigot end - if (this.length > 0 && this.length < 32767) { - this.data = new byte[this.length]; - packetdataserializer.readBytes(this.data); -diff --git a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -index e05fe07..5e4a377 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java -@@ -9,9 +9,19 @@ public class PacketPlayInEntityAction extends Packet { - public PacketPlayInEntityAction() {} - - public void a(PacketDataSerializer packetdataserializer) { -- this.a = packetdataserializer.readInt(); -- this.animation = packetdataserializer.readByte(); -- this.c = packetdataserializer.readInt(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.a = packetdataserializer.readInt(); -+ this.animation = packetdataserializer.readByte(); -+ this.c = packetdataserializer.readInt(); -+ } else -+ { -+ a = packetdataserializer.a(); -+ animation = packetdataserializer.readUnsignedByte() + 1; -+ c = packetdataserializer.a(); -+ } -+ // Spigot end - } - - public void b(PacketDataSerializer packetdataserializer) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -index 6dab3b9..5c88cf1 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInKeepAlive.java -@@ -11,7 +11,15 @@ public class PacketPlayInKeepAlive extends Packet { - } - - public void a(PacketDataSerializer packetdataserializer) { -- this.a = packetdataserializer.readInt(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.a = packetdataserializer.readInt(); -+ } else -+ { -+ this.a = packetdataserializer.a(); -+ } -+ // Spigot end - } - - public void b(PacketDataSerializer packetdataserializer) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInPosition.java b/src/main/java/net/minecraft/server/PacketPlayInPosition.java -index 63b8e4b..2f3a2ec 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInPosition.java -@@ -8,8 +8,17 @@ public class PacketPlayInPosition extends PacketPlayInFlying { - - public void a(PacketDataSerializer packetdataserializer) { - this.x = packetdataserializer.readDouble(); -- this.y = packetdataserializer.readDouble(); -- this.stance = packetdataserializer.readDouble(); -+ // Spigot start - protocol patch -+ if (packetdataserializer.version < 16) -+ { -+ this.y = packetdataserializer.readDouble(); -+ this.stance = packetdataserializer.readDouble(); -+ } else -+ { -+ this.y = packetdataserializer.readDouble(); -+ this.stance = y + 1.62; -+ } -+ // Spigot end - this.z = packetdataserializer.readDouble(); - super.a(packetdataserializer); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -index 9a6b726..0266592 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInPositionLook.java -@@ -9,8 +9,17 @@ public class PacketPlayInPositionLook extends PacketPlayInFlying { - - public void a(PacketDataSerializer packetdataserializer) { - this.x = packetdataserializer.readDouble(); -- this.y = packetdataserializer.readDouble(); -- this.stance = packetdataserializer.readDouble(); -+ // Spigot start - protocol patch -+ if (packetdataserializer.version < 16) -+ { -+ this.y = packetdataserializer.readDouble(); -+ this.stance = packetdataserializer.readDouble(); -+ } else -+ { -+ this.y = packetdataserializer.readDouble(); -+ this.stance = y + 1.62; -+ } -+ // Spigot end - this.z = packetdataserializer.readDouble(); - this.yaw = packetdataserializer.readFloat(); - this.pitch = packetdataserializer.readFloat(); -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -index 034fd5e..ea51d91 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -@@ -11,6 +11,11 @@ public class PacketPlayInSettings extends Packet { - private EnumDifficulty e; - private boolean f; - -+ // Spigot start - protocol patch -+ public int version; -+ public int flags; -+ // Spigot end -+ - public PacketPlayInSettings() {} - - public void a(PacketDataSerializer packetdataserializer) throws IOException { -@@ -18,8 +23,17 @@ public class PacketPlayInSettings extends Packet { - this.b = packetdataserializer.readByte(); - this.c = EnumChatVisibility.a(packetdataserializer.readByte()); - this.d = packetdataserializer.readBoolean(); -- this.e = EnumDifficulty.getById(packetdataserializer.readByte()); -- this.f = packetdataserializer.readBoolean(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.e = EnumDifficulty.getById( packetdataserializer.readByte() ); -+ this.f = packetdataserializer.readBoolean(); -+ } else -+ { -+ flags = packetdataserializer.readUnsignedByte(); -+ } -+ version = packetdataserializer.version; -+ // Spigot end - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -index d304284..c26bf77 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInSteerVehicle.java -@@ -12,8 +12,17 @@ public class PacketPlayInSteerVehicle extends Packet { - public void a(PacketDataSerializer packetdataserializer) { - this.a = packetdataserializer.readFloat(); - this.b = packetdataserializer.readFloat(); -- this.c = packetdataserializer.readBoolean(); -- this.d = packetdataserializer.readBoolean(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.c = packetdataserializer.readBoolean(); -+ this.d = packetdataserializer.readBoolean(); -+ } else { -+ int flags = packetdataserializer.readUnsignedByte(); -+ c = (flags & 0x1) != 0; -+ d = (flags & 0x2) != 0; -+ } -+ // Spigot end - } - - public void b(PacketDataSerializer packetdataserializer) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -index 476638e..5909876 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -@@ -16,6 +16,14 @@ public class PacketPlayInTabComplete extends Packet { - - public void a(PacketDataSerializer packetdataserializer) throws IOException { - this.a = packetdataserializer.c(32767); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 37 ) -+ { -+ if (packetdataserializer.readBoolean()) { -+ long position = packetdataserializer.readLong(); -+ } -+ } -+ // Spigot end - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -index 3458448..f6cf5c8 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInUpdateSign.java -@@ -12,13 +12,35 @@ public class PacketPlayInUpdateSign extends Packet { - public PacketPlayInUpdateSign() {} - - public void a(PacketDataSerializer packetdataserializer) throws IOException { -- this.a = packetdataserializer.readInt(); -- this.b = packetdataserializer.readShort(); -- this.c = packetdataserializer.readInt(); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.a = packetdataserializer.readInt(); -+ this.b = packetdataserializer.readShort(); -+ this.c = packetdataserializer.readInt(); -+ } else -+ { -+ long position = packetdataserializer.readLong(); -+ a = packetdataserializer.readPositionX( position ); -+ b = packetdataserializer.readPositionY( position ); -+ c = packetdataserializer.readPositionZ( position ); -+ } -+ // Spigot end - this.d = new String[4]; - - for (int i = 0; i < 4; ++i) { -- this.d[i] = packetdataserializer.c(15); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 21 ) -+ { -+ this.d[ i ] = packetdataserializer.c( 15 ); -+ } else -+ { -+ this.d[ i ] = ChatSerializer.a( packetdataserializer.c( Short.MAX_VALUE ) ).c(); -+ } -+ if (this.d[i].length() > 15) { -+ this.d[i] = this.d[i].substring( 0, 15 ); -+ } -+ // Spigot end - } - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -index 39f3037..3f12453 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -@@ -8,8 +8,24 @@ public class PacketPlayInUseEntity extends Packet { - public PacketPlayInUseEntity() {} - - public void a(PacketDataSerializer packetdataserializer) { -- this.a = packetdataserializer.readInt(); -- this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length]; -+ // Spigot start -+ if ( packetdataserializer.version < 16 ) -+ { -+ this.a = packetdataserializer.readInt(); -+ this.action = EnumEntityUseAction.values()[packetdataserializer.readByte() % EnumEntityUseAction.values().length]; -+ } else { -+ this.a = packetdataserializer.a(); -+ int val = packetdataserializer.a(); -+ if ( val == 2 ) { -+ packetdataserializer.readFloat(); -+ packetdataserializer.readFloat(); -+ packetdataserializer.readFloat(); -+ } else -+ { -+ this.action = EnumEntityUseAction.values()[ val % EnumEntityUseAction.values().length ]; -+ } -+ } -+ // Spigot end - } - - public void b(PacketDataSerializer packetdataserializer) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -index 2bba639..87daa8e 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInWindowClick.java -@@ -3,7 +3,7 @@ package net.minecraft.server; - public class PacketPlayInWindowClick extends Packet { - - private int a; -- private int slot; -+ public int slot; // Spigot - private int button; - private short d; - private ItemStack item; -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBed.java b/src/main/java/net/minecraft/server/PacketPlayOutBed.java -index d7954ff..b361f38 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBed.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java -@@ -24,10 +24,19 @@ public class PacketPlayOutBed extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- packetdataserializer.writeInt(this.b); -- packetdataserializer.writeByte(this.c); -- packetdataserializer.writeInt(this.d); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ packetdataserializer.writeInt( this.b ); -+ packetdataserializer.writeByte( this.c ); -+ packetdataserializer.writeInt( this.d ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ packetdataserializer.writePosition( b, c, d ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -index cdcdfd6..959d052 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java -@@ -30,9 +30,17 @@ public class PacketPlayOutBlockAction extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- packetdataserializer.writeShort(this.b); -- packetdataserializer.writeInt(this.c); -+ // Spigot start -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ packetdataserializer.writeShort( this.b ); -+ packetdataserializer.writeInt( this.c ); -+ } else -+ { -+ packetdataserializer.writePosition( a, b, c ); -+ } -+ // Spigot end - packetdataserializer.writeByte(this.d); - packetdataserializer.writeByte(this.e); - packetdataserializer.b(Block.getId(this.f) & 4095); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -index c93e8bc..1d70129 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java -@@ -28,9 +28,17 @@ public class PacketPlayOutBlockBreakAnimation extends Packet { - - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.b(this.a); -- packetdataserializer.writeInt(this.b); -- packetdataserializer.writeInt(this.c); -- packetdataserializer.writeInt(this.d); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.b ); -+ packetdataserializer.writeInt( this.c ); -+ packetdataserializer.writeInt( this.d ); -+ } else -+ { -+ packetdataserializer.writePosition( b, c, d ); -+ } -+ // Spigot end - packetdataserializer.writeByte(this.e); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java -index 4c622e2..dfa68b0 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java -@@ -27,11 +27,22 @@ public class PacketPlayOutBlockChange extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- packetdataserializer.writeByte(this.b); -- packetdataserializer.writeInt(this.c); -- packetdataserializer.b(Block.getId(this.block)); -- packetdataserializer.writeByte(this.data); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 25 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ packetdataserializer.writeByte( this.b ); -+ packetdataserializer.writeInt( this.c ); -+ packetdataserializer.b( Block.getId( this.block ) ); -+ packetdataserializer.writeByte(this.data); -+ } else -+ { -+ packetdataserializer.writePosition( a, b, c ); -+ int id = Block.getId( this.block ); -+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( id, data ); -+ packetdataserializer.b( (id << 4) | this.data ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index f6863bd..fdbdcc6 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -27,6 +27,12 @@ public class PacketPlayOutChat extends Packet { - - public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.a(ChatSerializer.a(this.a)); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 16 ) -+ { -+ packetdataserializer.writeByte(0); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -index 0870ac9..8eff9e5 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCollect.java -@@ -18,8 +18,17 @@ public class PacketPlayOutCollect extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- packetdataserializer.writeInt(this.b); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ packetdataserializer.writeInt( this.b ); -+ } else -+ { -+ packetdataserializer.b( this.a ); -+ packetdataserializer.b( this.b ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -index f2a032e..e6d9165 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutCustomPayload.java -@@ -31,8 +31,22 @@ public class PacketPlayOutCustomPayload extends Packet { - - public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.a(this.tag); -- packetdataserializer.writeShort(this.data.length); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 29 ) -+ { -+ packetdataserializer.writeShort( this.data.length ); -+ } -+ if ( packetdataserializer.version >= 47 && tag.equals( "MC|Brand" ) ) -+ { -+ packetdataserializer.a( new String( data, "UTF-8" ) ); -+ return; -+ } - packetdataserializer.writeBytes(this.data); -+ if ( packetdataserializer.version >= 29 && tag.equals( "MC|AdvCdm" ) ) -+ { -+ packetdataserializer.writeBoolean( true ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -index dc4259d..749b32d 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -21,7 +21,15 @@ public class PacketPlayOutEntity extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -index 4fa5b82..bef5ae3 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java -@@ -19,11 +19,22 @@ public class PacketPlayOutEntityDestroy extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeByte(this.a.length); -- -- for (int i = 0; i < this.a.length; ++i) { -- packetdataserializer.writeInt(this.a[i]); -+ // Spigot start - protocol lib -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeByte( this.a.length ); -+ -+ for ( int i = 0; i < this.a.length; ++i ) -+ { -+ packetdataserializer.writeInt( this.a[ i ] ); -+ } -+ } else { -+ packetdataserializer.b( a.length ); -+ for ( int i : a ) { -+ packetdataserializer.b( i ); -+ } - } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -index 97752ca..3693850 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEffect.java -@@ -28,10 +28,22 @@ public class PacketPlayOutEntityEffect extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- packetdataserializer.writeByte(this.b); -- packetdataserializer.writeByte(this.c); -- packetdataserializer.writeShort(this.d); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ packetdataserializer.writeByte( this.b ); -+ packetdataserializer.writeByte( this.c ); -+ packetdataserializer.writeShort( this.d ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ packetdataserializer.writeByte( b ); -+ packetdataserializer.writeByte( c ); -+ packetdataserializer.b( d ); -+ packetdataserializer.writeBoolean( false ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -index 736e3fd..1ca4f08 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -@@ -21,7 +21,14 @@ public class PacketPlayOutEntityEquipment extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt(this.a); -+ } else { -+ packetdataserializer.b( this.a ); -+ } -+ // Spigot end - packetdataserializer.writeShort(this.b); - packetdataserializer.a(this.c); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -index 0204062..2e4abe1 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java -@@ -18,7 +18,15 @@ public class PacketPlayOutEntityHeadRotation extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ } -+ // Spigot end - packetdataserializer.writeByte(this.b); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -index 72243ec..617adb3 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityLook.java -@@ -2,15 +2,18 @@ package net.minecraft.server; - - public class PacketPlayOutEntityLook extends PacketPlayOutEntity { - -+ private boolean onGround; // Spigot - protocol patch -+ - public PacketPlayOutEntityLook() { - this.g = true; - } - -- public PacketPlayOutEntityLook(int i, byte b0, byte b1) { -+ public PacketPlayOutEntityLook(int i, byte b0, byte b1, boolean onGround) { // Spigot - protocol patch - super(i); - this.e = b0; - this.f = b1; - this.g = true; -+ this.onGround = onGround; // Spigot - protocol patch - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -23,6 +26,12 @@ public class PacketPlayOutEntityLook extends PacketPlayOutEntity { - super.b(packetdataserializer); - packetdataserializer.writeByte(this.e); - packetdataserializer.writeByte(this.f); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 22 ) -+ { -+ packetdataserializer.writeBoolean( onGround ); -+ } -+ // Spigot end - } - - public String b() { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -index a95877f..c937f59 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -@@ -24,8 +24,16 @@ public class PacketPlayOutEntityMetadata extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- DataWatcher.a(this.b, packetdataserializer); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ } -+ DataWatcher.a(this.b, packetdataserializer, packetdataserializer.version); -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -index c988bcc..87260d5 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -8,6 +8,7 @@ public class PacketPlayOutEntityTeleport extends Packet { - private int d; - private byte e; - private byte f; -+ private boolean onGround; // Spigot - protocol patch - - public PacketPlayOutEntityTeleport() {} - -@@ -20,13 +21,14 @@ public class PacketPlayOutEntityTeleport extends Packet { - this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F)); - } - -- public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) { -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround) { // Spigot - protocol patch - this.a = i; - this.b = j; - this.c = k; - this.d = l; - this.e = b0; - this.f = b1; -+ this.onGround = onGround; // Spigot - protocol patch - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -39,12 +41,26 @@ public class PacketPlayOutEntityTeleport extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -+ // Spigot start - protocol -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ } -+ // Spigot end - packetdataserializer.writeInt(this.b); - packetdataserializer.writeInt(this.c); - packetdataserializer.writeInt(this.d); - packetdataserializer.writeByte(this.e); - packetdataserializer.writeByte(this.f); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 22 ) -+ { -+ packetdataserializer.writeBoolean( onGround ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -index 46f2543..170f27f 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -@@ -54,7 +54,15 @@ public class PacketPlayOutEntityVelocity extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ } -+ // Spigot end - packetdataserializer.writeShort(this.b); - packetdataserializer.writeShort(this.c); - packetdataserializer.writeShort(this.d); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -index 4038cc8..35788b2 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutExperience.java -@@ -22,8 +22,17 @@ public class PacketPlayOutExperience extends Packet { - - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.writeFloat(this.a); -- packetdataserializer.writeShort(this.c); -- packetdataserializer.writeShort(this.b); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeShort( this.c ); -+ packetdataserializer.writeShort( this.b ); -+ } else -+ { -+ packetdataserializer.b( c ); -+ packetdataserializer.b( b ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -index 456532b..e9ff5ee 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java -@@ -19,7 +19,15 @@ public class PacketPlayOutKeepAlive extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -+ // Spigot start -+ if ( packetdataserializer.version >= 32 ) -+ { -+ packetdataserializer.b( this.a ); -+ } else -+ { -+ packetdataserializer.writeInt( this.a ); -+ } -+ // Spigot end - } - - public boolean a() { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -index 49e0ff5..9ebf9b5 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutLogin.java -@@ -54,6 +54,13 @@ public class PacketPlayOutLogin extends Packet { - packetdataserializer.writeByte(this.e.a()); - packetdataserializer.writeByte(this.f); - packetdataserializer.a(this.g.name()); -+ -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 29 ) -+ { -+ packetdataserializer.writeBoolean( false ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMap.java b/src/main/java/net/minecraft/server/PacketPlayOutMap.java -index 5980c2d..b45a9ce 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMap.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMap.java -@@ -1,13 +1,19 @@ - package net.minecraft.server; - -+import java.util.Arrays; -+ - public class PacketPlayOutMap extends Packet { - - private int a; - private byte[] b; -+ private byte scale; // Spigot - protocol patch - - public PacketPlayOutMap() {} - -- public PacketPlayOutMap(int i, byte[] abyte) { -+ // Spigot start - protocol patch -+ public PacketPlayOutMap(int i, byte[] abyte, byte scale) { -+ this.scale = scale; -+ // Spigot end - this.a = i; - this.b = abyte; - } -@@ -20,8 +26,35 @@ public class PacketPlayOutMap extends Packet { - - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.b(this.a); -- packetdataserializer.writeShort(this.b.length); -- packetdataserializer.writeBytes(this.b); -+ if ( packetdataserializer.version < 27 ) -+ { -+ packetdataserializer.writeShort( this.b.length ); -+ packetdataserializer.writeBytes( this.b ); -+ } else { -+ packetdataserializer.writeByte( scale ); -+ if (b[0] == 1) { -+ int count = (b.length - 1) / 3; -+ packetdataserializer.b( count ); -+ for (int i = 0; i < count; i++) { -+ packetdataserializer.writeByte( b[1 + i * 3] ); -+ packetdataserializer.writeByte( b[2 + i * 3] ); -+ packetdataserializer.writeByte( b[3 + i * 3] ); -+ } -+ } else { -+ packetdataserializer.b( 0 ); -+ } -+ -+ if (b[0] == 0) { -+ packetdataserializer.writeByte( 1 ); -+ int rows = (b.length - 3); -+ packetdataserializer.writeByte( rows ); -+ packetdataserializer.writeByte( b[1] ); -+ packetdataserializer.writeByte( b[2] ); -+ a( packetdataserializer, Arrays.copyOfRange(b, 3, b.length) ); -+ } else { -+ packetdataserializer.writeByte( 0 ); -+ } -+ } - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 7479600..fcd126b 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -17,28 +17,24 @@ public class PacketPlayOutMapChunk extends Packet { - private int h; - private static byte[] i = new byte[196864]; - -+ private Chunk chunk; // Spigot -+ private int mask; // Spigot -+ - public PacketPlayOutMapChunk() {} - -- public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i) { -+ // Spigot start - protocol patch -+ public PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i, int version) { -+ this.chunk = chunk; -+ this.mask = i; - this.a = chunk.locX; - this.b = chunk.locZ; - this.g = flag; -- ChunkMap chunkmap = a(chunk, flag, i); -- Deflater deflater = new Deflater(4); // Spigot -+ ChunkMap chunkmap = a(chunk, flag, i, version); - - this.d = chunkmap.c; - this.c = chunkmap.b; -- chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, i, chunkmap.a, chunk.world); // Spigot - -- try { -- this.f = chunkmap.a; -- deflater.setInput(chunkmap.a, 0, chunkmap.a.length); -- deflater.finish(); -- this.e = new byte[chunkmap.a.length]; -- this.h = deflater.deflate(this.e); -- } finally { -- deflater.end(); -- } -+ this.f = chunkmap.a; - } - - public static int c() { -@@ -89,9 +85,28 @@ public class PacketPlayOutMapChunk extends Packet { - packetdataserializer.writeInt(this.b); - packetdataserializer.writeBoolean(this.g); - packetdataserializer.writeShort((short) (this.c & '\uffff')); -- packetdataserializer.writeShort((short) (this.d & '\uffff')); -- packetdataserializer.writeInt(this.h); -- packetdataserializer.writeBytes(this.e, 0, this.h); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 27 ) -+ { -+ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, mask, this.f, chunk.world, false); // Spigot -+ Deflater deflater = new Deflater(4); // Spigot -+ try { -+ deflater.setInput(this.f, 0, this.f.length); -+ deflater.finish(); -+ this.e = new byte[this.f.length]; -+ this.h = deflater.deflate(this.e); -+ } finally { -+ deflater.end(); -+ } -+ packetdataserializer.writeShort( (short) ( this.d & '\uffff' ) ); -+ packetdataserializer.writeInt( this.h ); -+ packetdataserializer.writeBytes( this.e, 0, this.h ); -+ } else -+ { -+ chunk.world.spigotConfig.antiXrayInstance.obfuscate(chunk.locX, chunk.locZ, mask, this.f, chunk.world, true); // Spigot -+ a( packetdataserializer, this.f ); -+ } -+ // Spigot end - protocol patch - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -@@ -102,7 +117,8 @@ public class PacketPlayOutMapChunk extends Packet { - return String.format("x=%d, z=%d, full=%b, sects=%d, add=%d, size=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Boolean.valueOf(this.g), Integer.valueOf(this.c), Integer.valueOf(this.d), Integer.valueOf(this.h)}); - } - -- public static ChunkMap a(Chunk chunk, boolean flag, int i) { -+ // Spigot start - protocol patch -+ public static ChunkMap a(Chunk chunk, boolean flag, int i, int version) { - int j = 0; - ChunkSection[] achunksection = chunk.getSections(); - int k = 0; -@@ -125,22 +141,59 @@ public class PacketPlayOutMapChunk extends Packet { - } - } - -- for (l = 0; l < achunksection.length; ++l) { -- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -- byte[] abyte1 = achunksection[l].getIdArray(); -+ if ( version < 24 ) -+ { -+ for ( l = 0; l < achunksection.length; ++l ) -+ { -+ if ( achunksection[ l ] != null && ( !flag || !achunksection[ l ].isEmpty() ) && ( i & 1 << l ) != 0 ) -+ { -+ byte[] abyte1 = achunksection[ l ].getIdArray(); - -- System.arraycopy(abyte1, 0, abyte, j, abyte1.length); -- j += abyte1.length; -+ System.arraycopy( abyte1, 0, abyte, j, abyte1.length ); -+ j += abyte1.length; -+ } -+ } -+ } else { -+ for ( l = 0; l < achunksection.length; ++l ) -+ { -+ if ( achunksection[ l ] != null && ( !flag || !achunksection[ l ].isEmpty() ) && ( i & 1 << l ) != 0 ) -+ { -+ byte[] abyte1 = achunksection[ l ].getIdArray(); -+ NibbleArray nibblearray = achunksection[ l ].getDataArray(); -+ for ( int ind = 0; ind < abyte1.length; ind++ ) -+ { -+ int id = abyte1[ ind ] & 0xFF; -+ int px = ind & 0xF; -+ int py = ( ind >> 8 ) & 0xF; -+ int pz = ( ind >> 4 ) & 0xF; -+ int data = nibblearray.a( px, py, pz ); -+ if ( id == 90 && data == 0 ) -+ { -+ Blocks.PORTAL.updateShape( chunk.world, ( chunk.locX << 4 ) + px, ( l << 4 ) + py, ( chunk.locZ << 4 ) + pz ); -+ } else -+ { -+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( id, data ); -+ } -+ char val = (char) ( id << 4 | data ); -+ abyte[ j++ ] = (byte) ( val & 0xFF ); -+ abyte[ j++ ] = (byte) ( ( val >> 8 ) & 0xFF ); -+ } -+ } - } - } - - NibbleArray nibblearray; - -- for (l = 0; l < achunksection.length; ++l) { -- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { -- nibblearray = achunksection[l].getDataArray(); -- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -- j += nibblearray.a.length; -+ if ( version < 24 ) -+ { -+ for ( l = 0; l < achunksection.length; ++l ) -+ { -+ if ( achunksection[ l ] != null && ( !flag || !achunksection[ l ].isEmpty() ) && ( i & 1 << l ) != 0 ) -+ { -+ nibblearray = achunksection[ l ].getDataArray(); -+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); -+ j += nibblearray.a.length; -+ } - } - } - -@@ -162,7 +215,7 @@ public class PacketPlayOutMapChunk extends Packet { - } - } - -- if (k > 0) { -+ if (k > 0 && version < 24) { - for (l = 0; l < achunksection.length; ++l) { - if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) { - nibblearray = achunksection[l].getExtendedIdArray(); -@@ -183,7 +236,9 @@ public class PacketPlayOutMapChunk extends Packet { - System.arraycopy(abyte, 0, chunkmap.a, 0, j); - return chunkmap; - } -+ // Spigot end - protocol patch - -+ @Override - public void handle(PacketListener packetlistener) { - this.a((PacketPlayOutListener) packetlistener); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -index 30bf8a7..b9db43c 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -30,7 +30,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { - - public PacketPlayOutMapChunkBulk() {} - -- public PacketPlayOutMapChunkBulk(List list) { -+ public PacketPlayOutMapChunkBulk(List list, int version) { - int i = list.size(); - - this.a = new int[i]; -@@ -43,7 +43,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { - - for (int k = 0; k < i; ++k) { - Chunk chunk = (Chunk) list.get(k); -- ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff'); -+ ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff', version); - - // Spigot start - world = chunk.world; -@@ -89,7 +89,7 @@ public class PacketPlayOutMapChunkBulk extends Packet { - int finalBufferSize = 0; - // Obfuscate all sections - for (int i = 0; i < a.length; i++) { -- world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world); -+ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world, false); - finalBufferSize += inflatedBuffers[i].length; - } - -@@ -174,17 +174,34 @@ public class PacketPlayOutMapChunkBulk extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - throws IOException -- compress(); // CraftBukkit -- packetdataserializer.writeShort(this.a.length); -- packetdataserializer.writeInt(this.size); -- packetdataserializer.writeBoolean(this.h); -- packetdataserializer.writeBytes(this.buffer, 0, this.size); -- -- for (int i = 0; i < this.a.length; ++i) { -- packetdataserializer.writeInt(this.a[i]); -- packetdataserializer.writeInt(this.b[i]); -- packetdataserializer.writeShort((short) (this.c[i] & '\uffff')); -- packetdataserializer.writeShort((short) (this.d[i] & '\uffff')); -+ if ( packetdataserializer.version < 27 ) -+ { -+ compress(); // CraftBukkit -+ packetdataserializer.writeShort( this.a.length ); -+ packetdataserializer.writeInt( this.size ); -+ packetdataserializer.writeBoolean( this.h ); -+ packetdataserializer.writeBytes( this.buffer, 0, this.size ); -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ packetdataserializer.writeInt(this.a[i]); -+ packetdataserializer.writeInt(this.b[i]); -+ packetdataserializer.writeShort((short) (this.c[i] & '\uffff')); -+ packetdataserializer.writeShort( (short) ( this.d[i] & '\uffff' ) ); -+ } -+ } else -+ { -+ packetdataserializer.writeBoolean( this.h ); -+ packetdataserializer.b( this.a.length ); -+ -+ for (int i = 0; i < this.a.length; ++i) { -+ packetdataserializer.writeInt(this.a[i]); -+ packetdataserializer.writeInt(this.b[i]); -+ packetdataserializer.writeShort((short) (this.c[i] & '\uffff')); -+ } -+ for (int i = 0; i < this.a.length; ++i) { -+ world.spigotConfig.antiXrayInstance.obfuscate(a[i], b[i], c[i], inflatedBuffers[i], world, true); -+ packetdataserializer.writeBytes( inflatedBuffers[i] ); -+ } - } - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -index 0a12db5..1e86a8f 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java -@@ -13,26 +13,44 @@ public class PacketPlayOutMultiBlockChange extends Packet { - private ChunkCoordIntPair b; - private byte[] c; - private int d; -+ // Spigot start - protocol patch -+ private short[] ashort; -+ private int[] blocks; -+ private Chunk chunk; -+ // Spigot end - - public PacketPlayOutMultiBlockChange() {} - - public PacketPlayOutMultiBlockChange(int i, short[] ashort, Chunk chunk) { -+ // Spigot start -+ this.ashort = ashort; -+ this.chunk = chunk; -+ // Spigot end - this.b = new ChunkCoordIntPair(chunk.locX, chunk.locZ); - this.d = i; - int j = 4 * i; - -- try { -- ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(j); -- DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); -+ try -+ { -+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream( j ); -+ DataOutputStream dataoutputstream = new DataOutputStream( bytearrayoutputstream ); - -+ // Spigot start -+ blocks = new int[i]; - for (int k = 0; k < i; ++k) { - int l = ashort[k] >> 12 & 15; - int i1 = ashort[k] >> 8 & 15; - int j1 = ashort[k] & 255; - - dataoutputstream.writeShort(ashort[k]); -- dataoutputstream.writeShort((short) ((Block.getId(chunk.getType(l, j1, i1)) & 4095) << 4 | chunk.getData(l, j1, i1) & 15)); -+ int blockId = Block.getId( chunk.getType( l, j1, i1 ) ); -+ int data = chunk.getData( l, j1, i1 ); -+ data = org.spigotmc.SpigotDebreakifier.getCorrectedData( blockId, data ); -+ int id = ( blockId & 4095 ) << 4 | data & 15; -+ dataoutputstream.writeShort((short) id); -+ blocks[k] = id; - } -+ // Spigot end - - this.c = bytearrayoutputstream.toByteArray(); - if (this.c.length != j) { -@@ -56,15 +74,31 @@ public class PacketPlayOutMultiBlockChange extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.b.x); -- packetdataserializer.writeInt(this.b.z); -- packetdataserializer.writeShort((short) this.d); -- if (this.c != null) { -- packetdataserializer.writeInt(this.c.length); -- packetdataserializer.writeBytes(this.c); -+ // Spigot start - protocol patch -+ if (packetdataserializer.version < 25) -+ { -+ packetdataserializer.writeInt( this.b.x ); -+ packetdataserializer.writeInt( this.b.z ); -+ packetdataserializer.writeShort( (short) this.d ); -+ if ( this.c != null ) -+ { -+ packetdataserializer.writeInt( this.c.length ); -+ packetdataserializer.writeBytes( this.c ); -+ } else -+ { -+ packetdataserializer.writeInt( 0 ); -+ } - } else { -- packetdataserializer.writeInt(0); -+ packetdataserializer.writeInt( this.b.x ); -+ packetdataserializer.writeInt( this.b.z ); -+ packetdataserializer.b( this.d ); -+ for ( int i = 0; i < d; i++ ) -+ { -+ packetdataserializer.writeShort( ashort[ i ] ); -+ packetdataserializer.b( blocks[ i ] ); -+ } - } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -index ccd4cec..80857c9 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -@@ -64,8 +64,10 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { - - public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws - packetdataserializer.b(this.a); -- UUID uuid = this.b.getId(); - -+ UUID uuid = this.b.getId(); -+ // Spigot start - protocol patch -+ if (packetdataserializer.version < 20) { - packetdataserializer.a( uuid == null ? "" : ( ( packetdataserializer.version >= 5 ) ? uuid.toString() : uuid.toString().replaceAll( "-", "" ) ) ); // Spigot - packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters - if (packetdataserializer.version >= 5 ) { // Spigot -@@ -79,14 +81,26 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { - packetdataserializer.a(property.getValue()); - packetdataserializer.a(property.getSignature()); - } -- } // Spigot -+ } -+ } else -+ { -+ packetdataserializer.writeUUID( uuid ); -+ } -+ // Spigot end - - packetdataserializer.writeInt(this.c); - packetdataserializer.writeInt(this.d); - packetdataserializer.writeInt(this.e); - packetdataserializer.writeByte(this.f); - packetdataserializer.writeByte(this.g); -- packetdataserializer.writeShort(this.h); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 47 ) -+ { -+ packetdataserializer.writeShort( org.spigotmc.SpigotDebreakifier.getItemId( this.h ) ); -+ } else -+ { -+ packetdataserializer.writeShort( this.h ); -+ } - this.i.a(packetdataserializer); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -index d67a364..052da02 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenSignEditor.java -@@ -25,9 +25,17 @@ public class PacketPlayOutOpenSignEditor extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- packetdataserializer.writeInt(this.b); -- packetdataserializer.writeInt(this.c); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ packetdataserializer.writeInt( this.b ); -+ packetdataserializer.writeInt( this.c ); -+ } else -+ { -+ packetdataserializer.writePosition( a, b, c ); -+ } -+ // Spigot end - } - - public void handle(PacketListener packetlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -index 860592d..8e9ea33 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import org.bukkit.craftbukkit.util.CraftChatMessage; -+ - import java.io.IOException; - - public class PacketPlayOutOpenWindow extends Packet { -@@ -43,15 +45,68 @@ public class PacketPlayOutOpenWindow extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.writeByte(this.a); -- packetdataserializer.writeByte(this.b); -- packetdataserializer.a(this.c); -- packetdataserializer.writeByte(this.d); -- packetdataserializer.writeBoolean(this.e); -- if (this.b == 11) { -- packetdataserializer.writeInt(this.f); -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeByte( this.a ); -+ packetdataserializer.writeByte( this.b ); -+ packetdataserializer.a( this.c ); -+ packetdataserializer.writeByte( this.d ); -+ packetdataserializer.writeBoolean( this.e ); -+ if ( this.b == 11 ) -+ { -+ packetdataserializer.writeInt( this.f ); -+ } -+ } else -+ { -+ packetdataserializer.writeByte( a ); -+ packetdataserializer.a( getInventoryString( b ) ); -+ if ( e ) -+ { -+ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( c )[ 0 ] ) ); -+ } else -+ { -+ packetdataserializer.a( ChatSerializer.a( new ChatMessage( c ) ) ); -+ } -+ packetdataserializer.writeByte( d ); -+ if ( this.b == 11 ) -+ { -+ packetdataserializer.writeInt( this.f ); -+ } -+ } -+ } -+ -+ // Spigot start - protocol patch -+ private String getInventoryString(int b) -+ { -+ switch ( b ) { -+ case 0: -+ return "minecraft:chest"; -+ case 1: -+ return "minecraft:crafting_table"; -+ case 2: -+ return "minecraft:furnace"; -+ case 3: -+ return "minecraft:dispenser"; -+ case 4: -+ return "minecraft:enchanting_table"; -+ case 5: -+ return "minecraft:brewing_stand"; -+ case 6: -+ return "minecraft:villager"; -+ case 7: -+ return "minecraft:beacon"; -+ case 8: -+ return "minecraft:anvil"; -+ case 9: -+ return "minecraft:hopper"; -+ case 10: -+ return "minecraft:dropper"; -+ case 11: -+ return "EntityHorse"; - } -+ throw new IllegalArgumentException( "Unknown type " + b ); - } -+ // Spigot end - - public void handle(PacketListener packetlistener) { - this.a((PacketPlayOutListener) packetlistener); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -index 7cae01e..adb8e8f 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -@@ -1,31 +1,138 @@ - package net.minecraft.server; - - import java.io.IOException; -+// Spigot start - protocol patch -+import net.minecraft.util.com.mojang.authlib.GameProfile; -+import net.minecraft.util.com.mojang.authlib.properties.Property; -+import net.minecraft.util.com.mojang.authlib.properties.PropertyMap; -+import org.bukkit.craftbukkit.util.CraftChatMessage; - - public class PacketPlayOutPlayerInfo extends Packet { - -- private String a; -- private boolean b; -- private int c; -+ private static final int ADD_PLAYER = 0; -+ private static final int UPDATE_GAMEMODE = 1; -+ private static final int UPDATE_LATENCY = 2; -+ private static final int UPDATE_DISPLAY_NAME = 3; -+ private static final int REMOVE_PLAYER = 4; -+ -+ private int action; -+ // private int length; We don't batch (yet) -+ private GameProfile player; -+ -+ private int gamemode; -+ private int ping; -+ private String username; - - public PacketPlayOutPlayerInfo() {} - -+ /* removed to force breaking - public PacketPlayOutPlayerInfo(String s, boolean flag, int i) { - this.a = s; - this.b = flag; - this.c = i; - } -+ */ -+ -+ public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) { -+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); -+ packet.action = ADD_PLAYER; -+ packet.username = player.listName; -+ packet.player = player.getProfile(); -+ packet.ping = player.ping; -+ packet.gamemode = player.playerInteractManager.getGameMode().getId(); -+ return packet; -+ } -+ -+ public static PacketPlayOutPlayerInfo updatePing(EntityPlayer player) { -+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); -+ packet.action = UPDATE_LATENCY; -+ packet.username = player.listName; -+ packet.player = player.getProfile(); -+ packet.ping = player.ping; -+ return packet; -+ } -+ -+ public static PacketPlayOutPlayerInfo updateGamemode(EntityPlayer player) { -+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); -+ packet.action = UPDATE_GAMEMODE; -+ packet.username = player.listName; -+ packet.player = player.getProfile(); -+ packet.gamemode = player.playerInteractManager.getGameMode().getId(); -+ return packet; -+ } -+ -+ public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) { -+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); -+ packet.action = UPDATE_DISPLAY_NAME; -+ packet.username = player.listName; -+ packet.player = player.getProfile(); -+ return packet; -+ } -+ -+ public static PacketPlayOutPlayerInfo removePlayer(EntityPlayer player) { -+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); -+ packet.action = REMOVE_PLAYER; -+ packet.username = player.listName; -+ packet.player = player.getProfile(); -+ return packet; -+ } - - public void a(PacketDataSerializer packetdataserializer) throws IOException { -- this.a = packetdataserializer.c(16); -- this.b = packetdataserializer.readBoolean(); -- this.c = packetdataserializer.readShort(); -+ // Not needed - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a(this.a); -- packetdataserializer.writeBoolean(this.b); -- packetdataserializer.writeShort(this.c); -+ if ( packetdataserializer.version >= 20 ) -+ { -+ packetdataserializer.b( action ); -+ packetdataserializer.b( 1 ); -+ packetdataserializer.writeUUID( player.getId() ); -+ switch ( action ) -+ { -+ case ADD_PLAYER: -+ packetdataserializer.a( player.getName() ); -+ PropertyMap properties = player.getProperties(); -+ packetdataserializer.b( properties.size() ); -+ for ( Property property : properties.values() ) -+ { -+ packetdataserializer.a( property.getName() ); -+ packetdataserializer.a( property.getValue() ); -+ packetdataserializer.writeBoolean( property.hasSignature() ); -+ if ( property.hasSignature() ) -+ { -+ packetdataserializer.a( property.getSignature() ); -+ } -+ } -+ packetdataserializer.b( gamemode ); -+ packetdataserializer.b( ping ); -+ packetdataserializer.writeBoolean( username != null ); -+ if ( username != null ) -+ { -+ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( username )[0] ) ); -+ } -+ break; -+ case UPDATE_GAMEMODE: -+ packetdataserializer.b( gamemode ); -+ break; -+ case UPDATE_LATENCY: -+ packetdataserializer.b( ping ); -+ break; -+ case UPDATE_DISPLAY_NAME: -+ packetdataserializer.writeBoolean( username != null ); -+ if ( username != null ) -+ { -+ packetdataserializer.a( ChatSerializer.a( CraftChatMessage.fromString( username )[0] ) ); -+ } -+ break; -+ case REMOVE_PLAYER: -+ break; -+ -+ } -+ } else { -+ packetdataserializer.a( username ); -+ packetdataserializer.writeBoolean( action != REMOVE_PLAYER ); -+ packetdataserializer.writeShort( ping ); -+ } - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -@@ -36,3 +143,4 @@ public class PacketPlayOutPlayerInfo extends Packet { - this.a((PacketPlayOutListener) packetlistener); - } - } -+// Spigot end -\ No newline at end of file -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -index f2234f0..b3c0ccf 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -@@ -30,12 +30,20 @@ public class PacketPlayOutPosition extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -+ // Spigot start - protocol patch - packetdataserializer.writeDouble(this.a); -- packetdataserializer.writeDouble(this.b); -+ packetdataserializer.writeDouble(this.b - (packetdataserializer.version >= 16 ? 1.62 : 0)); - packetdataserializer.writeDouble(this.c); - packetdataserializer.writeFloat(this.d); - packetdataserializer.writeFloat(this.e); -- packetdataserializer.writeBoolean(this.f); -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeBoolean( this.f ); -+ } else -+ { -+ packetdataserializer.writeByte( 0 ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -index d83ae7b..37e5a38 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java -@@ -2,13 +2,16 @@ package net.minecraft.server; - - public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { - -+ private boolean onGround; // Spigot - protocol patch -+ - public PacketPlayOutRelEntityMove() {} - -- public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2) { -+ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2, boolean onGround) { // Spigot - protocol patch - super(i); - this.b = b0; - this.c = b1; - this.d = b2; -+ this.onGround = onGround; // Spigot - protocol patch - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -23,6 +26,12 @@ public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { - packetdataserializer.writeByte(this.b); - packetdataserializer.writeByte(this.c); - packetdataserializer.writeByte(this.d); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 22 ) -+ { -+ packetdataserializer.writeBoolean( onGround ); -+ } -+ // Spigot end - } - - public String b() { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -index 9155c96..2ad234b 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMoveLook.java -@@ -2,11 +2,13 @@ package net.minecraft.server; - - public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { - -+ private boolean onGround; // Spigot - protocol patch -+ - public PacketPlayOutRelEntityMoveLook() { - this.g = true; - } - -- public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4) { -+ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4, boolean onGround) { // Spigot - protocol patch - super(i); - this.b = b0; - this.c = b1; -@@ -14,6 +16,7 @@ public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { - this.e = b3; - this.f = b4; - this.g = true; -+ this.onGround = onGround; // Spigot - protocol patch - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -32,6 +35,12 @@ public class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { - packetdataserializer.writeByte(this.d); - packetdataserializer.writeByte(this.e); - packetdataserializer.writeByte(this.f); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 22 ) -+ { -+ packetdataserializer.writeBoolean( onGround ); -+ } -+ // Spigot end - } - - public String b() { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -index 9041f82..f2c38c5 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutRemoveEntityEffect.java -@@ -18,7 +18,14 @@ public class PacketPlayOutRemoveEntityEffect extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ } else { -+ packetdataserializer.b( a ); -+ } -+ // Spigot end - packetdataserializer.writeByte(this.b); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -index 7403dbd..700e94e 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java -@@ -23,9 +23,22 @@ public class PacketPlayOutScoreboardObjective extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a(this.a); -- packetdataserializer.a(this.b); -- packetdataserializer.writeByte(this.c); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.a( this.a ); -+ packetdataserializer.a( this.b ); -+ packetdataserializer.writeByte( this.c ); -+ } else -+ { -+ packetdataserializer.a( a ); -+ packetdataserializer.writeByte( c ); -+ if ( c == 0 || c == 2 ) { -+ packetdataserializer.a( b ); -+ packetdataserializer.a( "integer" ); -+ } -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -index f50851b..446e308 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java -@@ -35,12 +35,25 @@ public class PacketPlayOutScoreboardScore extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a(this.a); -- packetdataserializer.writeByte(this.d); -- if (this.d != 1) { -- packetdataserializer.a(this.b); -- packetdataserializer.writeInt(this.c); -+ packetdataserializer.a( this.a ); -+ packetdataserializer.writeByte( this.d ); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ if ( this.d != 1 ) -+ { -+ packetdataserializer.a( this.b ); -+ packetdataserializer.writeInt( this.c ); -+ } -+ } else -+ { -+ packetdataserializer.a( this.b ); -+ if ( this.d != 1 ) -+ { -+ packetdataserializer.b( c ); -+ } - } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -index e8f0971..abba46c 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -@@ -71,10 +71,25 @@ public class PacketPlayOutScoreboardTeam extends Packet { - packetdataserializer.a(this.c); - packetdataserializer.a(this.d); - packetdataserializer.writeByte(this.g); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 16 ) -+ { -+ packetdataserializer.a( "always" ); -+ packetdataserializer.writeByte( EnumChatFormat.WHITE.ordinal() ); -+ } -+ // Spigot end - } - - if (this.f == 0 || this.f == 3 || this.f == 4) { -- packetdataserializer.writeShort(this.e.size()); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeShort( this.e.size() ); -+ } else -+ { -+ packetdataserializer.b( e.size() ); -+ } -+ // Spigot end - Iterator iterator = this.e.iterator(); - - while (iterator.hasNext()) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -index 5aeb4e3..8893b61 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java -@@ -2,8 +2,8 @@ package net.minecraft.server; - - public class PacketPlayOutSetSlot extends Packet { - -- private int a; -- private int b; -+ public int a; // Spigot -+ public int b; // Spigot - private ItemStack c; - - public PacketPlayOutSetSlot() {} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -index 17302e0..dcf1204 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -84,6 +84,39 @@ public class PacketPlayOutSpawnEntity extends Packet { - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.b(this.a); - packetdataserializer.writeByte(this.j); -+ // Spigot start - protocol patch -+ if ( j == 71 && packetdataserializer.version >= 28 ) -+ { -+ // North: 0 256 -+ // West: 64 192 -+ // South: 128 128 -+ // East: 192 320 -+ switch ( k ) { -+ case 0: -+ d += 32; -+ i = 0; -+ break; -+ case 1: -+ b -= 32; -+ i = 64; -+ break; -+ case 2: -+ d -= 32; -+ i = 128; -+ break; -+ case 3: -+ b += 32; -+ i = 192; -+ break; -+ } -+ } -+ if ( j == 70 && packetdataserializer.version >= 36 ) -+ { -+ int id = k & 0xFFFF; -+ int data = k >> 16; -+ k = id | ( data << 12 ); -+ } -+ // Spigot end - packetdataserializer.writeInt(this.b); - packetdataserializer.writeInt(this.c); - packetdataserializer.writeInt(this.d); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -index 435fe8d..98b4d97 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -@@ -91,7 +91,7 @@ public class PacketPlayOutSpawnEntityLiving extends Packet { - packetdataserializer.writeShort(this.f); - packetdataserializer.writeShort(this.g); - packetdataserializer.writeShort(this.h); -- this.l.a(packetdataserializer); -+ this.l.a(packetdataserializer, packetdataserializer.version); // Spigot - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -index 2c86b81..47efb16 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityPainting.java -@@ -34,10 +34,40 @@ public class PacketPlayOutSpawnEntityPainting extends Packet { - public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.b(this.a); - packetdataserializer.a(this.f); -- packetdataserializer.writeInt(this.b); -- packetdataserializer.writeInt(this.c); -- packetdataserializer.writeInt(this.d); -- packetdataserializer.writeInt(this.e); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version >= 28 ) -+ { -+ // North: 0 256 -+ // West: 64 192 -+ // South: 128 128 -+ // East: 192 320 -+ switch ( e ) { -+ case 0: -+ d += 1; -+ break; -+ case 1: -+ b -= 1; -+ break; -+ case 2: -+ d -= 1; -+ break; -+ case 3: -+ b += 1; -+ break; -+ } -+ } -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.b ); -+ packetdataserializer.writeInt( this.c ); -+ packetdataserializer.writeInt( this.d ); -+ packetdataserializer.writeInt( this.e ); -+ } else -+ { -+ packetdataserializer.writePosition( b, c, d ); -+ packetdataserializer.writeByte( e ); -+ } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java -index 92e4036..191d213 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java -@@ -21,9 +21,16 @@ public class PacketPlayOutSpawnPosition extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.x); -- packetdataserializer.writeInt(this.y); -- packetdataserializer.writeInt(this.z); -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.x ); -+ packetdataserializer.writeInt( this.y ); -+ packetdataserializer.writeInt( this.z ); -+ -+ } else -+ { -+ packetdataserializer.writePosition( x, y, z ); -+ } - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -index 3887d15..ed54ddd 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java -@@ -27,9 +27,17 @@ public class PacketPlayOutTileEntityData extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) { -- packetdataserializer.writeInt(this.a); -- packetdataserializer.writeShort(this.b); -- packetdataserializer.writeInt(this.c); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.a ); -+ packetdataserializer.writeShort( this.b ); -+ packetdataserializer.writeInt( this.c ); -+ } else -+ { -+ packetdataserializer.writePosition( a, b, c ); -+ } -+ // Spigot end - packetdataserializer.writeByte((byte) this.d); - packetdataserializer.a(this.e); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -index 7b288ad..0c38297 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java -@@ -46,7 +46,15 @@ public class PacketPlayOutUpdateAttributes extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.writeInt(this.a); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16) -+ { -+ packetdataserializer.writeInt( this.a ); -+ } else -+ { -+ packetdataserializer.b( a ); -+ } -+ // Spigot end - packetdataserializer.writeInt(this.b.size()); - Iterator iterator = this.b.iterator(); - -@@ -55,7 +63,14 @@ public class PacketPlayOutUpdateAttributes extends Packet { - - packetdataserializer.a(attributesnapshot.a()); - packetdataserializer.writeDouble(attributesnapshot.b()); -- packetdataserializer.writeShort(attributesnapshot.c().size()); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeShort( attributesnapshot.c().size() ); -+ } else { -+ packetdataserializer.b( attributesnapshot.c().size() ); -+ } -+ // Spigot end - Iterator iterator1 = attributesnapshot.c().iterator(); - - while (iterator1.hasNext()) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -index 72b3219..37ede05 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java -@@ -22,7 +22,15 @@ public class PacketPlayOutUpdateHealth extends Packet { - - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.writeFloat(this.a); -- packetdataserializer.writeShort(this.b); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeShort( this.b ); -+ } else -+ { -+ packetdataserializer.b( this.b ); -+ } -+ // Spigot end - packetdataserializer.writeFloat(this.c); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -index 7c5d2eb..e68fc18 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateSign.java -@@ -2,6 +2,8 @@ package net.minecraft.server; - - import java.io.IOException; - -+import org.bukkit.craftbukkit.util.CraftChatMessage; // Spigot - protocol patch -+ - public class PacketPlayOutUpdateSign extends Packet { - - private int x; -@@ -30,13 +32,28 @@ public class PacketPlayOutUpdateSign extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.writeInt(this.x); -- packetdataserializer.writeShort(this.y); -- packetdataserializer.writeInt(this.z); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.x ); -+ packetdataserializer.writeShort( this.y ); -+ packetdataserializer.writeInt( this.z ); -+ } else -+ { -+ packetdataserializer.writePosition( x, y, z ); -+ } - - for (int i = 0; i < 4; ++i) { -- packetdataserializer.a(this.lines[i]); -+ if ( packetdataserializer.version < 21 ) -+ { -+ packetdataserializer.a( this.lines[ i ] ); -+ } else -+ { -+ String line = ChatSerializer.a( CraftChatMessage.fromString( this.lines[ i ] )[ 0 ] ); -+ packetdataserializer.a( line ); -+ } - } -+ // Spigot end - } - - public void a(PacketPlayOutListener packetplayoutlistener) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -index 7ea6702..2a96e2d 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -@@ -4,8 +4,8 @@ import java.util.List; - - public class PacketPlayOutWindowItems extends Packet { - -- private int a; -- private ItemStack[] b; -+ public int a; // Spigot -+ public ItemStack[] b; // Spigot - - public PacketPlayOutWindowItems() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -index f1001c6..a9577b8 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldEvent.java -@@ -31,9 +31,17 @@ public class PacketPlayOutWorldEvent extends Packet { - - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.writeInt(this.a); -- packetdataserializer.writeInt(this.c); -- packetdataserializer.writeByte(this.d & 255); -- packetdataserializer.writeInt(this.e); -+ // Spigot start - protocol patch -+ if ( packetdataserializer.version < 16 ) -+ { -+ packetdataserializer.writeInt( this.c ); -+ packetdataserializer.writeByte( this.d & 255 ); -+ packetdataserializer.writeInt( this.e ); -+ } else -+ { -+ packetdataserializer.writePosition( c, d, e ); -+ } -+ // Spigot end - packetdataserializer.writeInt(this.b); - packetdataserializer.writeBoolean(this.f); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -index 29f0c99..07b564f 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWorldParticles.java -@@ -1,6 +1,7 @@ - package net.minecraft.server; - - import java.io.IOException; -+import java.util.HashMap; // Spigot - - public class PacketPlayOutWorldParticles extends Packet { - -@@ -40,8 +41,19 @@ public class PacketPlayOutWorldParticles extends Packet { - this.i = packetdataserializer.readInt(); - } - -+ // Spigot start - protocol patch - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a(this.a); -+ String[] parts = this.a.split( "_" ); -+ Particle particle = Particle.find( parts[ 0 ] ); -+ if (particle == null) particle = Particle.CRIT; -+ if ( packetdataserializer.version < 17 ) -+ { -+ packetdataserializer.a( this.a ); -+ } else -+ { -+ packetdataserializer.writeInt( particle.ordinal() ); -+ packetdataserializer.writeBoolean( false ); -+ } - packetdataserializer.writeFloat(this.b); - packetdataserializer.writeFloat(this.c); - packetdataserializer.writeFloat(this.d); -@@ -50,7 +62,31 @@ public class PacketPlayOutWorldParticles extends Packet { - packetdataserializer.writeFloat(this.g); - packetdataserializer.writeFloat(this.h); - packetdataserializer.writeInt(this.i); -+ if ( packetdataserializer.version >= 17 ) -+ { -+ for ( int i = 0; i < particle.extra; i++ ) -+ { -+ int toWrite = 0; -+ if ( parts.length - 1 > i ) -+ { -+ try -+ { -+ toWrite = Integer.parseInt( parts[i + 1] ); -+ if ( particle.extra == 1 && parts.length == 3 ) -+ { -+ i++; -+ toWrite = toWrite | (Integer.parseInt( parts[i + 1] ) << 12); -+ } -+ } catch ( NumberFormatException e ) -+ { -+ -+ } -+ } -+ packetdataserializer.b( toWrite ); -+ } -+ } - } -+ // Spigot end - - public void a(PacketPlayOutListener packetplayoutlistener) { - packetplayoutlistener.a(this); -@@ -59,4 +95,80 @@ public class PacketPlayOutWorldParticles extends Packet { - public void handle(PacketListener packetlistener) { - this.a((PacketPlayOutListener) packetlistener); - } -+ -+ // Spigot start - protocol patch -+ private enum Particle -+ { -+ EXPLOSION_NORMAL( "explode" ), -+ EXPLOSION_LARGE( "largeexplode" ), -+ EXPLOSION_HUGE( "hugeexplosion" ), -+ FIREWORKS_SPARK( "fireworksSpark" ), -+ WATER_BUBBLE( "bubble" ), -+ WATER_SPLASH( "splash" ), -+ WATER_WAKE( "wake" ), -+ SUSPENDED( "suspended" ), -+ SUSPENDED_DEPTH( "depthsuspend" ), -+ CRIT( "crit" ), -+ CRIT_MAGIC( "magicCrit" ), -+ SMOKE_NORMAL( "smoke" ), -+ SMOKE_LARGE( "largesmoke" ), -+ SPELL( "spell" ), -+ SPELL_INSTANT( "instantSpell" ), -+ SPELL_MOB( "mobSpell" ), -+ SPELL_MOB_AMBIENT( "mobSpellAmbient" ), -+ SPELL_WITCH( "witchMagic" ), -+ DRIP_WATER( "dripWater" ), -+ DRIP_LAVA( "dripLava" ), -+ VILLAGER_ANGRY( "angryVillager" ), -+ VILLAGER_HAPPY( "happyVillager" ), -+ TOWN_AURA( "townaura" ), -+ NOTE( "note" ), -+ PORTAL( "portal" ), -+ ENCHANTMENT_TABLE( "enchantmenttable" ), -+ FLAME( "flame" ), -+ LAVA( "lava" ), -+ FOOTSTEP( "footstep" ), -+ CLOUD( "cloud" ), -+ REDSTONE( "reddust" ), -+ SNOWBALL( "snowballpoof" ), -+ SNOW_SHOVEL( "snowshovel" ), -+ SLIME( "slime" ), -+ HEART( "heart" ), -+ BARRIER( "barrier" ), -+ ICON_CRACK( "iconcrack", 2 ), -+ BLOCK_CRACK( "blockcrack", 1 ), -+ BLOCK_DUST( "blockdust", 1 ), -+ WATER_DROP( "droplet" ), -+ ITEM_TAKE( "take" ), -+ MOB_APPEARANCE( "mobappearance" ); -+ -+ public final String name; -+ public final int extra; -+ private final static HashMap particleMap = new HashMap(); -+ -+ Particle(String name) -+ { -+ this( name, 0 ); -+ } -+ -+ Particle(String name, int extra) -+ { -+ this.name = name; -+ this.extra = extra; -+ } -+ -+ public static Particle find(String part) -+ { -+ return particleMap.get( part ); -+ } -+ -+ static -+ { -+ for ( Particle particle : values() ) -+ { -+ particleMap.put( particle.name, particle ); -+ } -+ } -+ } -+ // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index f5afcb7..07b9d35 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -85,7 +85,7 @@ class PlayerChunk { - Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z); - - if (chunk.isReady()) { -- entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0)); -+ entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0, entityplayer.playerConnection.networkManager.getVersion())); // Spigot - protocol patch - } - - this.players.remove(entityplayer); // CraftBukkit -@@ -164,8 +164,21 @@ class PlayerChunk { - if (this.dirtyCount == 64) { - i = this.location.x * 16; - j = this.location.z * 16; -- this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged -+ // Spigot start - protocol patch -+ //this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged - -+ Chunk chunk = PlayerChunkMap.a( this.playerChunkMap ).getChunkAt( this.location.x, this.location.z ); -+ for (int idx = 0; idx < this.b.size(); ++idx) { -+ EntityPlayer entityplayer = (EntityPlayer) this.b.get(idx); -+ -+ if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) { -+ entityplayer.playerConnection.sendPacket( -+ new PacketPlayOutMapChunk( chunk, (this.f == 0xFFFF), this.f, entityplayer.playerConnection.networkManager.getVersion()) -+ ); -+ } -+ } -+ -+ // Spigot end - protocol patch - for (k = 0; k < 16; ++k) { - if ((this.f & 1 << k) != 0) { - l = k << 4; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 188393c..10faa8c 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -747,6 +747,36 @@ public class PlayerConnection implements PacketPlayInListener { - } - - public void sendPacket(Packet packet) { -+ // Spigot start - protocol patch -+ if ( NetworkManager.a( networkManager ).attr( NetworkManager.protocolVersion ).get() >= 17 ) -+ { -+ if ( packet instanceof PacketPlayOutWindowItems ) -+ { -+ PacketPlayOutWindowItems items = (PacketPlayOutWindowItems) packet; -+ if ( player.activeContainer instanceof ContainerEnchantTable -+ && player.activeContainer.windowId == items.a ) -+ { -+ ItemStack[] old = items.b; -+ items.b = new ItemStack[ old.length + 1 ]; -+ items.b[ 0 ] = old[ 0 ]; -+ System.arraycopy( old, 1, items.b, 2, old.length - 1 ); -+ items.b[ 1 ] = new ItemStack( Items.INK_SACK, 3, 4 ); -+ -+ } -+ } else if ( packet instanceof PacketPlayOutSetSlot ) -+ { -+ PacketPlayOutSetSlot items = (PacketPlayOutSetSlot) packet; -+ if ( player.activeContainer instanceof ContainerEnchantTable -+ && player.activeContainer.windowId == items.a ) -+ { -+ if ( items.b >= 1 ) -+ { -+ items.b++; -+ } -+ } -+ } -+ } -+ // Spigot end - if (packet instanceof PacketPlayOutChat) { - PacketPlayOutChat packetplayoutchat = (PacketPlayOutChat) packet; - EnumChatVisibility enumchatvisibility = this.player.getChatFlags(); -@@ -1108,6 +1138,7 @@ public class PlayerConnection implements PacketPlayInListener { - } - - public void a(PacketPlayInUseEntity packetplayinuseentity) { -+ if ( packetplayinuseentity.c() == null ) return; // Spigot - protocol patch - if (this.player.dead) return; // CraftBukkit - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -1237,6 +1268,21 @@ public class PlayerConnection implements PacketPlayInListener { - } - - InventoryView inventory = this.player.activeContainer.getBukkitView(); -+ // Spigot start - protocol patch -+ if ( NetworkManager.a( networkManager ).attr( NetworkManager.protocolVersion ).get() >= 17 ) -+ { -+ if ( player.activeContainer instanceof ContainerEnchantTable ) -+ { -+ if ( packetplayinwindowclick.slot == 1 ) -+ { -+ return; -+ } else if ( packetplayinwindowclick.slot > 1 ) -+ { -+ packetplayinwindowclick.slot--; -+ } -+ } -+ } -+ // Spigot end - SlotType type = CraftInventoryView.getSlotType(inventory, packetplayinwindowclick.d()); - - InventoryClickEvent event = null; -@@ -1587,7 +1633,20 @@ public class PlayerConnection implements PacketPlayInListener { - if (entityitem != null) { - entityitem.e(); - } -+ // Spigot start - protocol patch -+ } else -+ { -+ if ( flag1 ) -+ { -+ player.playerConnection.sendPacket( -+ new PacketPlayOutSetSlot( 0, -+ packetplayinsetcreativeslot.c(), -+ player.defaultContainer.getSlot( packetplayinsetcreativeslot.c() ).getItem() -+ ) -+ ); -+ } - } -+ // Spigot end - } - } - -@@ -1721,7 +1780,7 @@ public class PlayerConnection implements PacketPlayInListener { - // CraftBukkit end - - if ("MC|BEdit".equals(packetplayincustompayload.c())) { -- packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e())); -+ packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()), networkManager.getVersion()); // Spigot - protocol patch - - try { - itemstack = packetdataserializer.c(); -@@ -1753,7 +1812,7 @@ public class PlayerConnection implements PacketPlayInListener { - - return; - } else if ("MC|BSign".equals(packetplayincustompayload.c())) { -- packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e())); -+ packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()), networkManager.getVersion()); // Spigot - protocol patch - - try { - itemstack = packetdataserializer.c(); -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index b4461b9..036be30 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -328,6 +328,13 @@ public class PlayerInteractManager { - int j = itemstack.getData(); - ItemStack itemstack1 = itemstack.a(world, entityhuman); - -+ // Spigot start - protocol patch -+ if ( itemstack1 != null && itemstack1.getItem() == Items.WRITTEN_BOOK ) -+ { -+ player.playerConnection.sendPacket( new PacketPlayOutCustomPayload( "MC|BOpen", new byte[0] ) ); -+ } -+ // Spigot end -+ - if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i && itemstack1.n() <= 0 && itemstack1.getData() == j)) { - return false; - } else { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 75ea5c9..0359cb3 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -284,7 +284,7 @@ public abstract class PlayerList { - // CraftBukkit end - - // CraftBukkit start - sendAll above replaced with this loop -- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, true, 1000); -+ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer( entityplayer ); // Spigot - protocol patch - for (int i = 0; i < this.players.size(); ++i) { - EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); - -@@ -302,7 +302,7 @@ public abstract class PlayerList { - continue; - } - // .name -> .listName -- entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(entityplayer1.listName, true, entityplayer1.ping)); -+ entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( entityplayer1 )); // Spigot - protocol patch - // CraftBukkit end - } - } -@@ -338,7 +338,7 @@ public abstract class PlayerList { - - // CraftBukkit start - .name -> .listName, replace sendAll with loop - // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), false, 9999)); -- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, false, 9999); -+ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.removePlayer( entityplayer ); // Spigot - protocol patch - for (int i = 0; i < this.players.size(); ++i) { - EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); - -@@ -830,7 +830,7 @@ public abstract class PlayerList { - EntityPlayer player = (EntityPlayer) this.players.get( currentPing ); - if ( player.lastPing == -1 || Math.abs( player.ping - player.lastPing ) > 20 ) - { -- Packet packet = new PacketPlayOutPlayerInfo( player.listName, true, player.ping ); -+ Packet packet = PacketPlayOutPlayerInfo.updatePing( player ); // Spigot - protocol patch - for ( EntityPlayer splayer : (List) this.players ) - { - if ( splayer.getBukkitEntity().canSee( player.getBukkitEntity() ) ) -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e5f73fc..0c4976d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -1,13 +1,16 @@ - package org.bukkit.craftbukkit; - --import java.io.BufferedReader; - import java.io.File; - import java.io.IOException; --import java.io.InputStreamReader; -+import java.net.URL; - import java.text.SimpleDateFormat; - import java.util.Arrays; -+import java.util.Calendar; -+import java.util.Date; -+import java.util.Enumeration; - import java.util.List; - import java.util.concurrent.TimeUnit; -+import java.util.jar.Manifest; - import java.util.logging.Level; - import java.util.logging.Logger; - import joptsimple.OptionParser; -@@ -18,7 +21,7 @@ public class Main { - public static boolean useJline = true; - public static boolean useConsole = true; - -- public static void main(String[] args) throws IOException { -+ public static void main(String[] args) throws Exception { - // Spigot Start - File lock = new File( ".update-lock" ); - if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null ) -@@ -39,6 +42,32 @@ public class Main { - { - } - } -+ -+ System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n" -+ + "*** It is imperative that backups be taken before running this build on your server! ***\n" -+ + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n" -+ + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" ); -+ -+ Enumeration resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" ); -+ while ( resources.hasMoreElements() ) -+ { -+ Manifest manifest = new Manifest( resources.nextElement().openStream() ); -+ String ts = manifest.getMainAttributes().getValue( "Timestamp" ); -+ if ( ts != null ) -+ { -+ Date buildDate = new SimpleDateFormat( "yyyyMMdd-hhmm" ).parse( ts ); -+ -+ Calendar cal = Calendar.getInstance(); -+ cal.add( Calendar.DAY_OF_YEAR, -2 ); -+ if ( buildDate.before(cal.getTime() ) ) -+ { -+ System.err.println( "WARNING: This build is more than 2 days old and there are likely updates available!" ); -+ System.err.println( "You will get no support with this build unless you update from http://ci.md-5.net/job/Spigot/" ); -+ System.err.println( "The server will start in 10 seconds!" ); -+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -+ } -+ } -+ } - // Spigot End - // Todo: Installation script - OptionParser parser = new OptionParser() { -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e7569c6..35f2bfa 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -203,17 +203,29 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getHandle().listName = name; - - // Change the name on the client side -- PacketPlayOutPlayerInfo oldpacket = new PacketPlayOutPlayerInfo(oldName, false, 9999); -- PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(name, true, getHandle().ping); -+ // Spigot start - protocol patch -+ String temp = getHandle().listName; -+ getHandle().listName = oldName; -+ PacketPlayOutPlayerInfo oldpacket = PacketPlayOutPlayerInfo.removePlayer(getHandle()); -+ getHandle().listName = temp; -+ PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer(getHandle()); -+ PacketPlayOutPlayerInfo newPacket = PacketPlayOutPlayerInfo.updateDisplayName(getHandle()); - for (int i = 0; i < server.getHandle().players.size(); ++i) { - EntityPlayer entityplayer = (EntityPlayer) server.getHandle().players.get(i); - if (entityplayer.playerConnection == null) continue; - - if (entityplayer.getBukkitEntity().canSee(this)) { -- entityplayer.playerConnection.sendPacket(oldpacket); -- entityplayer.playerConnection.sendPacket(packet); -+ if (entityplayer.playerConnection.networkManager.getVersion() < 28) -+ { -+ entityplayer.playerConnection.sendPacket( oldpacket ); -+ entityplayer.playerConnection.sendPacket( packet ); -+ } else { -+ entityplayer.playerConnection.sendPacket( newPacket ); -+ } - } - } -+ -+ // Spigot end - } - - @Override -@@ -442,7 +454,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - for (int y = 0; y < 128; ++y) { - bytes[y + 3] = data.buffer[y * 128 + x]; - } -- PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), bytes); -+ PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), bytes, map.getScale().getValue()); // Spigot - protocol patch - getHandle().playerConnection.sendPacket(packet); - } - } -@@ -894,7 +906,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - - //remove the hidden player from this player user list -- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), false, 9999)); -+ getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.removePlayer( ( (CraftPlayer) player ).getHandle ())); // Spigot - protocol patch - } - - public void showPlayer(Player player) { -@@ -911,7 +923,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - entry.updatePlayer(getHandle()); - } - -- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), true, getHandle().ping)); -+ getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( ( (CraftPlayer) player ).getHandle ())); // Spigot - protocol patch - } - - public void removeDisconnectingPlayer(Player player) { -diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java -index fad22e2..80e538c 100644 ---- a/src/main/java/org/spigotmc/AntiXray.java -+++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -65,7 +65,7 @@ public class AntiXray - if ( world.spigotConfig.antiXray ) - { - obfuscate.startTiming(); -- obfuscate( chunkX, chunkY, bitmask, buffer, world ); -+ obfuscate( chunkX, chunkY, bitmask, buffer, world, false ); - obfuscate.stopTiming(); - } - } -@@ -73,7 +73,7 @@ public class AntiXray - /** - * Removes all non exposed ores from the chunk buffer. - */ -- public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world) -+ public void obfuscate(int chunkX, int chunkY, int bitmask, byte[] buffer, World world, boolean newFormat) - { - // If the world is marked as obfuscated - if ( world.spigotConfig.antiXray ) -@@ -120,11 +120,22 @@ public class AntiXray - if ( index >= buffer.length ) - { - index++; -+ if ( newFormat ) index++; - continue; - } - // Grab the block ID in the buffer. - // TODO: extended IDs are not yet supported -- int blockId = buffer[index] & 0xFF; -+ int blockId; -+ int data = 0; -+ if ( newFormat ) -+ { -+ blockId = (buffer[ index ] & 0xFF) | ( ( buffer[ index + 1 ] & 0xFF ) << 8 ); -+ data = blockId & 0xF; -+ blockId >>>= 4; // Remove data value -+ } else -+ { -+ blockId = buffer[ index ] & 0xFF; -+ } - // Check if the block should be obfuscated - if ( obfuscateBlocks[blockId] ) - { -@@ -132,6 +143,7 @@ public class AntiXray - if ( !isLoaded( world, startX + x, ( i << 4 ) + y, startZ + z, initialRadius ) ) - { - index++; -+ if ( newFormat ) index++; - continue; - } - // On the otherhand, if radius is 0, or the nearby blocks are all non air, we can obfuscate -@@ -141,7 +153,15 @@ public class AntiXray - { - case 1: - // Replace with replacement material -- buffer[index] = replaceWithTypeId; -+ if ( newFormat ) -+ { -+ char replace = (char) ((replaceWithTypeId << 4) | data); -+ buffer[ index ] = (byte) ( replace & 0xFF ); -+ buffer[ index + 1 ] = (byte) ( ( replace >> 8 ) & 0xFF ); -+ } else -+ { -+ buffer[ index ] = replaceWithTypeId; -+ } - break; - case 2: - // Replace with random ore. -@@ -149,13 +169,23 @@ public class AntiXray - { - randomOre = 0; - } -- buffer[index] = replacementOres[randomOre++]; -+ if ( newFormat ) -+ { -+ char replace = (char) (replacementOres[ randomOre++ ] & 0xFF); -+ replace = (char) ((replace << 4) | data); -+ buffer[ index ] = (byte) ( replace & 0xFF ); -+ buffer[ index + 1 ] = (byte) ( ( replace >> 8 ) & 0xFF ); -+ } else -+ { -+ buffer[ index ] = replacementOres[ randomOre++ ]; -+ } - break; - } - } - } - - index++; -+ if (newFormat) index++; - } - } - } -diff --git a/src/main/java/org/spigotmc/ProtocolData.java b/src/main/java/org/spigotmc/ProtocolData.java -new file mode 100644 -index 0000000..ff93cbe ---- /dev/null -+++ b/src/main/java/org/spigotmc/ProtocolData.java -@@ -0,0 +1,190 @@ -+package org.spigotmc; -+ -+public class ProtocolData -+{ -+ public static class ByteShort extends Number -+ { -+ -+ private short value; -+ -+ public ByteShort(short value) -+ { -+ this.value = value; -+ } -+ -+ @Override -+ public int intValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public long longValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public float floatValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public double doubleValue() -+ { -+ return value; -+ } -+ } -+ -+ public static class DualByte extends Number -+ { -+ -+ public byte value; -+ public byte value2; -+ -+ public DualByte(byte value, byte value2) -+ { -+ this.value = value; -+ this.value2 = value2; -+ } -+ -+ @Override -+ public int intValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public long longValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public float floatValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public double doubleValue() -+ { -+ return value; -+ } -+ } -+ -+ public static class HiddenByte extends Number -+ { -+ -+ private byte value; -+ -+ public HiddenByte(byte value) -+ { -+ this.value = value; -+ } -+ -+ @Override -+ public int intValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public long longValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public float floatValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public double doubleValue() -+ { -+ return value; -+ } -+ } -+ public static class IntByte extends Number -+ { -+ -+ public int value; -+ public byte value2; -+ -+ public IntByte(int value, byte value2) -+ { -+ this.value = value; -+ this.value2 = value2; -+ } -+ -+ @Override -+ public byte byteValue() -+ { -+ return value2; -+ } -+ -+ @Override -+ public int intValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public long longValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public float floatValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public double doubleValue() -+ { -+ return value; -+ } -+ } -+ -+ public static class DualInt extends Number -+ { -+ -+ public int value; -+ public int value2; -+ -+ public DualInt(int value, int value2) -+ { -+ this.value = value; -+ this.value2 = value2; -+ } -+ -+ @Override -+ public int intValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public long longValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public float floatValue() -+ { -+ return value; -+ } -+ -+ @Override -+ public double doubleValue() -+ { -+ return value; -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/ProtocolInjector.java b/src/main/java/org/spigotmc/ProtocolInjector.java -new file mode 100644 -index 0000000..3b2df91 ---- /dev/null -+++ b/src/main/java/org/spigotmc/ProtocolInjector.java -@@ -0,0 +1,253 @@ -+package org.spigotmc; -+ -+import net.minecraft.server.ChatSerializer; -+import net.minecraft.server.EnumProtocol; -+import net.minecraft.server.IChatBaseComponent; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListener; -+import net.minecraft.util.com.google.common.collect.BiMap; -+ -+import java.io.IOException; -+import java.lang.reflect.Field; -+import java.util.Map; -+ -+public class ProtocolInjector -+{ -+ public static void inject() -+ { -+ try -+ { -+ addPacket( EnumProtocol.LOGIN, true, 0x3, PacketLoginCompression.class ); -+ -+ addPacket( EnumProtocol.PLAY, true, 0x45, PacketTitle.class ); -+ addPacket( EnumProtocol.PLAY, true, 0x47, PacketTabHeader.class ); -+ addPacket( EnumProtocol.PLAY, true, 0x48, PacketPlayResourcePackSend.class ); -+ addPacket( EnumProtocol.PLAY, false, 0x19, PacketPlayResourcePackStatus.class ); -+ } catch ( NoSuchFieldException e ) -+ { -+ e.printStackTrace(); -+ } catch ( IllegalAccessException e ) -+ { -+ e.printStackTrace(); -+ } -+ } -+ -+ private static void addPacket(EnumProtocol protocol, boolean clientbound, int id, Class packet) throws NoSuchFieldException, IllegalAccessException -+ { -+ Field packets; -+ if (!clientbound) { -+ packets = EnumProtocol.class.getDeclaredField( "h" ); -+ } else { -+ packets = EnumProtocol.class.getDeclaredField( "i" ); -+ } -+ packets.setAccessible( true ); -+ BiMap> pMap = (BiMap>) packets.get( protocol ); -+ pMap.put( id, packet ); -+ Field map = EnumProtocol.class.getDeclaredField( "f" ); -+ map.setAccessible( true ); -+ Map, EnumProtocol> protocolMap = (Map, EnumProtocol>) map.get( null ); -+ protocolMap.put( packet, protocol ); -+ } -+ -+ public static class PacketPlayResourcePackStatus extends Packet { -+ -+ @Override -+ public void a(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ packetdataserializer.c( 255 ); // Hash -+ packetdataserializer.a(); // Result -+ } -+ -+ @Override -+ public void b(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ -+ } -+ -+ @Override -+ public void handle(PacketListener packetlistener) -+ { -+ -+ } -+ } -+ -+ public static class PacketPlayResourcePackSend extends Packet { -+ -+ private String url; -+ private String hash; -+ -+ public PacketPlayResourcePackSend(String url, String hash) -+ { -+ this.url = url; -+ this.hash = hash; -+ } -+ -+ @Override -+ public void a(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ -+ } -+ -+ @Override -+ public void b(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ packetdataserializer.a( url ); -+ packetdataserializer.a( hash ); -+ } -+ -+ @Override -+ public void handle(PacketListener packetlistener) -+ { -+ -+ } -+ } -+ -+ public static class PacketLoginCompression extends Packet { -+ -+ private int threshold; -+ -+ public PacketLoginCompression(int threshold) -+ { -+ this.threshold = threshold; -+ } -+ -+ @Override -+ public void a(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ -+ } -+ -+ @Override -+ public void b(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ packetdataserializer.b( threshold ); -+ } -+ -+ @Override -+ public void handle(PacketListener packetlistener) -+ { -+ -+ } -+ } -+ -+ public static class PacketTabHeader extends Packet -+ { -+ -+ private IChatBaseComponent header; -+ private IChatBaseComponent footer; -+ -+ public PacketTabHeader() -+ { -+ } -+ -+ public PacketTabHeader(IChatBaseComponent header, IChatBaseComponent footer) -+ { -+ this.header = header; -+ this.footer = footer; -+ } -+ -+ @Override -+ public void a(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ this.header = ChatSerializer.a( packetdataserializer.c( 32767 ) ); -+ this.footer = ChatSerializer.a( packetdataserializer.c( 32767 ) ); -+ } -+ -+ @Override -+ public void b(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ packetdataserializer.a( ChatSerializer.a( this.header ) ); -+ packetdataserializer.a( ChatSerializer.a( this.footer ) ); -+ } -+ -+ @Override -+ public void handle(PacketListener packetlistener) -+ { -+ } -+ } -+ -+ public static class PacketTitle extends Packet -+ { -+ private Action action; -+ -+ // TITLE & SUBTITLE -+ private IChatBaseComponent text; -+ -+ // TIMES -+ private int fadeIn = -1; -+ private int stay = -1; -+ private int fadeOut = -1; -+ -+ public PacketTitle() {} -+ -+ public PacketTitle(Action action) -+ { -+ this.action = action; -+ } -+ -+ public PacketTitle(Action action, IChatBaseComponent text) -+ { -+ this( action ); -+ this.text = text; -+ } -+ -+ public PacketTitle(Action action, int fadeIn, int stay, int fadeOut) -+ { -+ this( action ); -+ this.fadeIn = fadeIn; -+ this.stay = stay; -+ this.fadeOut = fadeOut; -+ } -+ -+ -+ @Override -+ public void a(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ this.action = Action.values()[packetdataserializer.a()]; -+ switch ( action ) -+ { -+ case TITLE: -+ case SUBTITLE: -+ this.text = ChatSerializer.a( packetdataserializer.c(32767) ); -+ break; -+ case TIMES: -+ this.fadeIn = packetdataserializer.readInt(); -+ this.stay = packetdataserializer.readInt(); -+ this.fadeOut = packetdataserializer.readInt(); -+ break; -+ } -+ } -+ -+ @Override -+ public void b(PacketDataSerializer packetdataserializer) throws IOException -+ { -+ packetdataserializer.b( action.ordinal() ); -+ switch ( action ) -+ { -+ case TITLE: -+ case SUBTITLE: -+ packetdataserializer.a( ChatSerializer.a( this.text ) ); -+ break; -+ case TIMES: -+ packetdataserializer.writeInt( this.fadeIn ); -+ packetdataserializer.writeInt( this.stay ); -+ packetdataserializer.writeInt( this.fadeOut ); -+ break; -+ } -+ } -+ -+ @Override -+ public void handle(PacketListener packetlistener) -+ { -+ } -+ -+ public static enum Action { -+ TITLE, -+ SUBTITLE, -+ TIMES, -+ CLEAR, -+ RESET -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotComponentReverter.java b/src/main/java/org/spigotmc/SpigotComponentReverter.java -new file mode 100644 -index 0000000..6093d62 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotComponentReverter.java -@@ -0,0 +1,105 @@ -+package org.spigotmc; -+ -+import net.minecraft.server.ChatComponentText; -+import net.minecraft.server.ChatModifier; -+import net.minecraft.server.EnumChatFormat; -+import net.minecraft.server.IChatBaseComponent; -+import org.bukkit.ChatColor; -+ -+import java.util.Iterator; -+import java.util.List; -+ -+public class SpigotComponentReverter -+{ -+ public static String toLegacy(IChatBaseComponent s) -+ { -+ StringBuilder builder = new StringBuilder(); -+ legacy( builder, s ); -+ return builder.toString(); -+ } -+ -+ private static void legacy(StringBuilder builder, IChatBaseComponent s) -+ { -+ ChatModifier modifier = s.getChatModifier(); -+ colorize( builder, modifier ); -+ if ( s instanceof ChatComponentText ) -+ { -+ builder.append( s.e() ); -+ } else { -+ throw new RuntimeException( "Unhandled type: " + s.getClass().getSimpleName() ); -+ } -+ -+ for ( IChatBaseComponent c : getExtra( s ) ) { -+ legacy( builder, c ); -+ } -+ } -+ -+ private static void colorize(StringBuilder builder, ChatModifier modifier) -+ { -+ if ( modifier == null ) return; -+ // Color first -+ EnumChatFormat color = getColor( modifier ); -+ if ( color == null ) -+ { -+ color = EnumChatFormat.BLACK; -+ } -+ builder.append( color.toString() ); -+ -+ if ( isBold( modifier ) ) -+ { -+ builder.append( ChatColor.BOLD ); -+ } -+ if ( isItalic( modifier ) ) -+ { -+ builder.append( ChatColor.ITALIC ); -+ } -+ if ( isRandom( modifier ) ) -+ { -+ builder.append( ChatColor.MAGIC ); -+ } -+ if ( isStrikethrough( modifier ) ) -+ { -+ builder.append( ChatColor.STRIKETHROUGH ); -+ } -+ if ( isUnderline( modifier ) ) -+ { -+ builder.append( ChatColor.UNDERLINE ); -+ } -+ } -+ -+ // Helpers -+ private static List getExtra(IChatBaseComponent c) -+ { -+ return c.a(); -+ } -+ -+ private static EnumChatFormat getColor(ChatModifier c) -+ { -+ return c.a(); -+ } -+ -+ private static boolean isBold(ChatModifier c) -+ { -+ return c.b(); -+ } -+ -+ private static boolean isItalic(ChatModifier c) -+ { -+ return c.c(); -+ } -+ -+ private static boolean isStrikethrough(ChatModifier c) -+ { -+ return c.d(); -+ } -+ -+ private static boolean isUnderline(ChatModifier c) -+ { -+ return c.e(); -+ } -+ -+ private static boolean isRandom(ChatModifier c) -+ { -+ return c.f(); -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotCompressor.java b/src/main/java/org/spigotmc/SpigotCompressor.java -new file mode 100644 -index 0000000..2e0857e ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotCompressor.java -@@ -0,0 +1,43 @@ -+package org.spigotmc; -+ -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.util.io.netty.buffer.ByteBuf; -+import net.minecraft.util.io.netty.channel.ChannelHandlerContext; -+import net.minecraft.util.io.netty.handler.codec.MessageToByteEncoder; -+ -+import java.util.zip.Deflater; -+ -+public class SpigotCompressor extends MessageToByteEncoder -+{ -+ -+ private final byte[] buffer = new byte[8192]; -+ private final Deflater deflater = new Deflater(); -+ -+ @Override -+ protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception -+ { -+ ByteBuf in = (ByteBuf) msg; -+ int origSize = in.readableBytes(); -+ PacketDataSerializer serializer = new PacketDataSerializer( out ); -+ -+ if ( origSize < 256 ) -+ { -+ serializer.b( 0 ); -+ serializer.writeBytes( in ); -+ } else -+ { -+ byte[] data = new byte[ origSize ]; -+ in.readBytes( data ); -+ -+ serializer.b( data.length ); -+ -+ deflater.setInput( data ); -+ deflater.finish(); -+ while (!deflater.finished()) { -+ int count = deflater.deflate( buffer ); -+ serializer.writeBytes( buffer, 0, count ); -+ } -+ deflater.reset(); -+ } -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotDebreakifier.java b/src/main/java/org/spigotmc/SpigotDebreakifier.java -new file mode 100644 -index 0000000..d811f55 ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotDebreakifier.java -@@ -0,0 +1,102 @@ -+package org.spigotmc; -+ -+import com.google.common.base.Charsets; -+import com.google.gson.JsonArray; -+import com.google.gson.JsonElement; -+import com.google.gson.JsonParser; -+import net.minecraft.server.Block; -+import net.minecraft.server.Blocks; -+import net.minecraft.server.Item; -+import net.minecraft.server.Items; -+import net.minecraft.util.gnu.trove.map.hash.TIntIntHashMap; -+ -+import java.io.IOException; -+import java.io.InputStream; -+import java.io.InputStreamReader; -+import java.util.Arrays; -+ -+public class SpigotDebreakifier -+{ -+ -+ private static final boolean[] validBlocks = new boolean[ 198 << 4 ]; -+ private static final int[] correctedValues = new int[ 198 ]; -+ -+ static -+ { -+ Arrays.fill( correctedValues, -1 ); -+ InputStream in = SpigotDebreakifier.class.getResourceAsStream( "/blocks.json" ); -+ try -+ { -+ JsonArray e = new JsonParser().parse( new InputStreamReader( in, Charsets.UTF_8 ) ).getAsJsonArray(); -+ for ( JsonElement entry : e ) -+ { -+ String[] parts = entry.getAsString().split( ":" ); -+ int id = Integer.parseInt( parts[ 0 ] ); -+ int data = Integer.parseInt( parts[ 1 ] ); -+ validBlocks[ ( id << 4 ) | data ] = true; -+ if ( correctedValues[ id ] == -1 || data < correctedValues[ id ] ) -+ { -+ correctedValues[ id ] = data; -+ } -+ } -+ } finally -+ { -+ try -+ { -+ in.close(); -+ } catch ( IOException e ) -+ { -+ throw new RuntimeException( e ); -+ } -+ } -+ } -+ -+ public static int getCorrectedData(int id, int data) -+ { -+ if ( id > 197 ) return data; -+ if ( id == 175 && data > 8 ) -+ { -+ data = 8; -+ } -+ if ( validBlocks[ ( id << 4 ) | data ] ) -+ { -+ return data; -+ } else -+ { -+ return correctedValues[ id ] & 0xF; -+ } -+ } -+ -+ private static TIntIntHashMap invalidItems = new TIntIntHashMap(); -+ static { -+ replace( Blocks.WATER, Items.WATER_BUCKET ); -+ replace( Blocks.STATIONARY_WATER, Items.WATER_BUCKET ); -+ replace( Blocks.LAVA, Items.LAVA_BUCKET ); -+ replace( Blocks.STATIONARY_LAVA, Items.LAVA_BUCKET ); -+ replace( Blocks.PORTAL, Items.NETHER_BRICK ); -+ replace( Blocks.DOUBLE_STEP, Blocks.STEP ); -+ replace( Blocks.FIRE, Items.FLINT_AND_STEEL ); -+ replace( Blocks.ENDER_PORTAL, Blocks.ENDER_PORTAL_FRAME ); -+ replace( Blocks.WOOD_DOUBLE_STEP, Blocks.WOOD_STEP ); -+ replace( Blocks.COCOA, Items.SEEDS ); -+ replace( Blocks.CARROTS, Items.CARROT ); -+ replace( Blocks.POTATOES, Items.POTATO ); -+ } -+ -+ public static int getItemId(int id) -+ { -+ return invalidItems.containsKey( id ) ? invalidItems.get( id ) : id; -+ } -+ -+ private static void replace(Block block, Block other) { -+ replace( Block.getId( block ), Block.getId( other ) ); -+ } -+ -+ private static void replace(Block block, Item other) { -+ replace( Block.getId( block ), Item.getId( other ) ); -+ } -+ -+ private static void replace(int block, int other) { -+ invalidItems.put( block, other ); -+ } -+} -diff --git a/src/main/java/org/spigotmc/SpigotDecompressor.java b/src/main/java/org/spigotmc/SpigotDecompressor.java -new file mode 100644 -index 0000000..ffebf5d ---- /dev/null -+++ b/src/main/java/org/spigotmc/SpigotDecompressor.java -@@ -0,0 +1,42 @@ -+package org.spigotmc; -+ -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.util.io.netty.buffer.ByteBuf; -+import net.minecraft.util.io.netty.buffer.Unpooled; -+import net.minecraft.util.io.netty.channel.ChannelHandlerContext; -+import net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder; -+ -+import java.util.List; -+import java.util.zip.Inflater; -+ -+public class SpigotDecompressor extends ByteToMessageDecoder -+{ -+ -+ private final Inflater inflater = new Inflater(); -+ -+ @Override -+ protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List objects) throws Exception -+ { -+ if ( byteBuf.readableBytes() == 0 ) -+ { -+ return; -+ } -+ -+ PacketDataSerializer serializer = new PacketDataSerializer( byteBuf ); -+ int size = serializer.a(); -+ if ( size == 0 ) -+ { -+ objects.add( serializer.readBytes( serializer.readableBytes() ) ); -+ } else -+ { -+ byte[] compressedData = new byte[ serializer.readableBytes() ]; -+ serializer.readBytes( compressedData ); -+ inflater.setInput( compressedData ); -+ -+ byte[] data = new byte[ size ]; -+ inflater.inflate( data ); -+ objects.add( Unpooled.wrappedBuffer( data ) ); -+ inflater.reset(); -+ } -+ } -+} -diff --git a/src/main/resources/blocks.json b/src/main/resources/blocks.json -new file mode 100644 -index 0000000..8dd484d ---- /dev/null -+++ b/src/main/resources/blocks.json -@@ -0,0 +1 @@ -+["0:0","1:0","1:1","1:2","1:3","1:4","1:5","1:6","2:0","3:0","3:1","3:2","4:0","5:0","5:1","5:2","5:3","5:4","5:5","6:0","6:1","6:2","6:3","6:4","6:5","6:8","6:9","6:10","6:11","6:12","6:13","7:0","8:0","8:1","8:2","8:3","8:4","8:5","8:6","8:7","8:8","8:9","8:10","8:11","8:12","8:13","8:14","8:15","9:0","9:1","9:2","9:3","9:4","9:5","9:6","9:7","9:8","9:9","9:10","9:11","9:12","9:13","9:14","9:15","10:0","10:1","10:2","10:3","10:4","10:5","10:6","10:7","10:8","10:9","10:10","10:11","10:12","10:13","10:14","10:15","11:0","11:1","11:2","11:3","11:4","11:5","11:6","11:7","11:8","11:9","11:10","11:11","11:12","11:13","11:14","11:15","12:0","12:1","13:0","14:0","15:0","16:0","17:0","17:1","17:2","17:3","17:4","17:5","17:6","17:7","17:8","17:9","17:10","17:11","17:12","17:13","17:14","17:15","18:0","18:1","18:2","18:3","18:4","18:5","18:6","18:7","18:8","18:9","18:10","18:11","18:12","18:13","18:14","18:15","19:0","19:1","20:0","21:0","22:0","23:0","23:1","23:2","23:3","23:4","23:5","23:8","23:9","23:10","23:11","23:12","23:13","24:0","24:1","24:2","25:0","26:0","26:1","26:2","26:3","26:8","26:9","26:10","26:11","26:12","26:13","26:14","26:15","27:0","27:1","27:2","27:3","27:4","27:5","27:8","27:9","27:10","27:11","27:12","27:13","28:0","28:1","28:2","28:3","28:4","28:5","28:8","28:9","28:10","28:11","28:12","28:13","29:0","29:1","29:2","29:3","29:4","29:5","29:8","29:9","29:10","29:11","29:12","29:13","30:0","31:0","31:1","31:2","32:0","33:0","33:1","33:2","33:3","33:4","33:5","33:8","33:9","33:10","33:11","33:12","33:13","34:0","34:1","34:2","34:3","34:4","34:5","34:8","34:9","34:10","34:11","34:12","34:13","35:0","35:1","35:2","35:3","35:4","35:5","35:6","35:7","35:8","35:9","35:10","35:11","35:12","35:13","35:14","35:15","36:0","36:1","36:2","36:3","36:4","36:5","36:8","36:9","36:10","36:11","36:12","36:13","37:0","38:0","38:1","38:2","38:3","38:4","38:5","38:6","38:7","38:8","39:0","40:0","41:0","42:0","43:0","43:1","43:2","43:3","43:4","43:5","43:6","43:7","43:8","43:9","43:10","43:11","43:12","43:13","43:14","43:15","44:0","44:1","44:2","44:3","44:4","44:5","44:6","44:7","44:8","44:9","44:10","44:11","44:12","44:13","44:14","44:15","45:0","46:0","46:1","47:0","48:0","49:0","50:1","50:2","50:3","50:4","50:5","51:0","51:1","51:2","51:3","51:4","51:5","51:6","51:7","51:8","51:9","51:10","51:11","51:12","51:13","51:14","51:15","52:0","53:0","53:1","53:2","53:3","53:4","53:5","53:6","53:7","54:2","54:3","54:4","54:5","55:0","55:1","55:2","55:3","55:4","55:5","55:6","55:7","55:8","55:9","55:10","55:11","55:12","55:13","55:14","55:15","56:0","57:0","58:0","59:0","59:1","59:2","59:3","59:4","59:5","59:6","59:7","60:0","60:1","60:2","60:3","60:4","60:5","60:6","60:7","61:2","61:3","61:4","61:5","62:2","62:3","62:4","62:5","63:0","63:1","63:2","63:3","63:4","63:5","63:6","63:7","63:8","63:9","63:10","63:11","63:12","63:13","63:14","63:15","64:0","64:1","64:2","64:3","64:4","64:5","64:6","64:7","64:8","64:9","64:10","64:11","65:2","65:3","65:4","65:5","66:0","66:1","66:2","66:3","66:4","66:5","66:6","66:7","66:8","66:9","67:0","67:1","67:2","67:3","67:4","67:5","67:6","67:7","68:2","68:3","68:4","68:5","69:0","69:1","69:2","69:3","69:4","69:5","69:6","69:7","69:8","69:9","69:10","69:11","69:12","69:13","69:14","69:15","70:0","70:1","71:0","71:1","71:2","71:3","71:4","71:5","71:6","71:7","71:8","71:9","71:10","71:11","72:0","72:1","73:0","74:0","75:1","75:2","75:3","75:4","75:5","76:1","76:2","76:3","76:4","76:5","77:0","77:1","77:2","77:3","77:4","77:5","77:8","77:9","77:10","77:11","77:12","77:13","78:0","78:1","78:2","78:3","78:4","78:5","78:6","78:7","79:0","80:0","81:0","81:1","81:2","81:3","81:4","81:5","81:6","81:7","81:8","81:9","81:10","81:11","81:12","81:13","81:14","81:15","82:0","83:0","83:1","83:2","83:3","83:4","83:5","83:6","83:7","83:8","83:9","83:10","83:11","83:12","83:13","83:14","83:15","84:0","84:1","85:0","86:0","86:1","86:2","86:3","87:0","88:0","89:0","90:1","90:2","91:0","91:1","91:2","91:3","92:0","92:1","92:2","92:3","92:4","92:5","92:6","93:0","93:1","93:2","93:3","93:4","93:5","93:6","93:7","93:8","93:9","93:10","93:11","93:12","93:13","93:14","93:15","94:0","94:1","94:2","94:3","94:4","94:5","94:6","94:7","94:8","94:9","94:10","94:11","94:12","94:13","94:14","94:15","95:0","95:1","95:2","95:3","95:4","95:5","95:6","95:7","95:8","95:9","95:10","95:11","95:12","95:13","95:14","95:15","96:0","96:1","96:2","96:3","96:4","96:5","96:6","96:7","96:8","96:9","96:10","96:11","96:12","96:13","96:14","96:15","97:0","97:1","97:2","97:3","97:4","97:5","98:0","98:1","98:2","98:3","99:0","99:1","99:2","99:3","99:4","99:5","99:6","99:7","99:8","99:9","99:10","99:14","99:15","100:0","100:1","100:2","100:3","100:4","100:5","100:6","100:7","100:8","100:9","100:10","100:14","100:15","101:0","102:0","103:0","104:0","104:1","104:2","104:3","104:4","104:5","104:6","104:7","105:0","105:1","105:2","105:3","105:4","105:5","105:6","105:7","106:0","106:1","106:2","106:3","106:4","106:5","106:6","106:7","106:8","106:9","106:10","106:11","106:12","106:13","106:14","106:15","107:0","107:1","107:2","107:3","107:4","107:5","107:6","107:7","107:8","107:9","107:10","107:11","107:12","107:13","107:14","107:15","108:0","108:1","108:2","108:3","108:4","108:5","108:6","108:7","109:0","109:1","109:2","109:3","109:4","109:5","109:6","109:7","110:0","111:0","112:0","113:0","114:0","114:1","114:2","114:3","114:4","114:5","114:6","114:7","115:0","115:1","115:2","115:3","116:0","117:0","117:1","117:2","117:3","117:4","117:5","117:6","117:7","118:0","118:1","118:2","118:3","119:0","120:0","120:1","120:2","120:3","120:4","120:5","120:6","120:7","121:0","122:0","123:0","124:0","125:0","125:1","125:2","125:3","125:4","125:5","126:0","126:1","126:2","126:3","126:4","126:5","126:8","126:9","126:10","126:11","126:12","126:13","127:0","127:1","127:2","127:3","127:4","127:5","127:6","127:7","127:8","127:9","127:10","127:11","128:0","128:1","128:2","128:3","128:4","128:5","128:6","128:7","129:0","130:2","130:3","130:4","130:5","131:0","131:1","131:2","131:3","131:4","131:5","131:6","131:7","131:8","131:9","131:10","131:11","131:12","131:13","131:14","131:15","132:0","132:1","132:2","132:3","132:4","132:5","132:6","132:7","132:8","132:9","132:10","132:11","132:12","132:13","132:14","132:15","133:0","134:0","134:1","134:2","134:3","134:4","134:5","134:6","134:7","135:0","135:1","135:2","135:3","135:4","135:5","135:6","135:7","136:0","136:1","136:2","136:3","136:4","136:5","136:6","136:7","137:0","137:1","138:0","139:0","139:1","140:0","140:1","140:2","140:3","140:4","140:5","140:6","140:7","140:8","140:9","140:10","140:11","140:12","140:13","140:14","140:15","141:0","141:1","141:2","141:3","141:4","141:5","141:6","141:7","142:0","142:1","142:2","142:3","142:4","142:5","142:6","142:7","143:0","143:1","143:2","143:3","143:4","143:5","143:8","143:9","143:10","143:11","143:12","143:13","144:0","144:1","144:2","144:3","144:4","144:5","144:8","144:9","144:10","144:11","144:12","144:13","145:0","145:1","145:2","145:3","145:4","145:5","145:6","145:7","145:8","145:9","145:10","145:11","146:2","146:3","146:4","146:5","147:0","147:1","147:2","147:3","147:4","147:5","147:6","147:7","147:8","147:9","147:10","147:11","147:12","147:13","147:14","147:15","148:0","148:1","148:2","148:3","148:4","148:5","148:6","148:7","148:8","148:9","148:10","148:11","148:12","148:13","148:14","148:15","149:0","149:1","149:2","149:3","149:4","149:5","149:6","149:7","149:8","149:9","149:10","149:11","149:12","149:13","149:14","149:15","150:0","150:1","150:2","150:3","150:4","150:5","150:6","150:7","150:8","150:9","150:10","150:11","150:12","150:13","150:14","150:15","151:0","151:1","151:2","151:3","151:4","151:5","151:6","151:7","151:8","151:9","151:10","151:11","151:12","151:13","151:14","151:15","152:0","153:0","154:0","154:2","154:3","154:4","154:5","154:8","154:10","154:11","154:12","154:13","155:0","155:1","155:2","155:3","155:4","156:0","156:1","156:2","156:3","156:4","156:5","156:6","156:7","157:0","157:1","157:2","157:3","157:4","157:5","157:8","157:9","157:10","157:11","157:12","157:13","158:0","158:1","158:2","158:3","158:4","158:5","158:8","158:9","158:10","158:11","158:12","158:13","159:0","159:1","159:2","159:3","159:4","159:5","159:6","159:7","159:8","159:9","159:10","159:11","159:12","159:13","159:14","159:15","160:0","160:1","160:2","160:3","160:4","160:5","160:6","160:7","160:8","160:9","160:10","160:11","160:12","160:13","160:14","160:15","161:0","161:1","161:4","161:5","161:8","161:9","161:12","161:13","162:0","162:1","162:4","162:5","162:8","162:9","162:12","162:13","163:0","163:1","163:2","163:3","163:4","163:5","163:6","163:7","164:0","164:1","164:2","164:3","164:4","164:5","164:6","164:7","165:0","166:0","167:0","167:1","167:2","167:3","167:4","167:5","167:6","167:7","167:8","167:9","167:10","167:11","167:12","167:13","167:14","167:15","168:0","168:1","168:2","169:0","170:0","170:4","170:8","171:0","171:1","171:2","171:3","171:4","171:5","171:6","171:7","171:8","171:9","171:10","171:11","171:12","171:13","171:14","171:15","172:0","173:0","174:0","175:0","175:1","175:2","175:3","175:4","175:5","175:8","176:0","176:1","176:2","176:3","176:4","176:5","176:6","176:7","176:8","176:9","176:10","176:11","176:12","176:13","176:14","176:15","177:2","177:3","177:4","177:5","178:0","178:1","178:2","178:3","178:4","178:5","178:6","178:7","178:8","178:9","178:10","178:11","178:12","178:13","178:14","178:15","179:0","179:1","179:2","180:0","180:1","180:2","180:3","180:4","180:5","180:6","180:7","181:0","181:8","182:0","182:8","183:0","183:1","183:2","183:3","183:4","183:5","183:6","183:7","183:8","183:9","183:10","183:11","183:12","183:13","183:14","183:15","184:0","184:1","184:2","184:3","184:4","184:5","184:6","184:7","184:8","184:9","184:10","184:11","184:12","184:13","184:14","184:15","185:0","185:1","185:2","185:3","185:4","185:5","185:6","185:7","185:8","185:9","185:10","185:11","185:12","185:13","185:14","185:15","186:0","186:1","186:2","186:3","186:4","186:5","186:6","186:7","186:8","186:9","186:10","186:11","186:12","186:13","186:14","186:15","187:0","187:1","187:2","187:3","187:4","187:5","187:6","187:7","187:8","187:9","187:10","187:11","187:12","187:13","187:14","187:15","188:0","189:0","190:0","191:0","192:0","193:0","193:1","193:2","193:3","193:4","193:5","193:6","193:7","193:8","193:9","193:10","193:11","194:0","194:1","194:2","194:3","194:4","194:5","194:6","194:7","194:8","194:9","194:10","194:11","195:0","195:1","195:2","195:3","195:4","195:5","195:6","195:7","195:8","195:9","195:10","195:11","196:0","196:1","196:2","196:3","196:4","196:5","196:6","196:7","196:8","196:9","196:10","196:11","197:0","197:1","197:2","197:3","197:4","197:5","197:6","197:7","197:8","197:9","197:10","197:11"] --- -1.9.1 - diff --git a/CraftBukkit-Patches/0181-Spigot-Update-20140909a.patch b/CraftBukkit-Patches/0181-Spigot-Update-20140909a.patch deleted file mode 100644 index 92b3c901cb..0000000000 --- a/CraftBukkit-Patches/0181-Spigot-Update-20140909a.patch +++ /dev/null @@ -1,40 +0,0 @@ -From a473134c498e6ffbfe6a89288f9510b99718fed2 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 11 Sep 2014 01:07:52 -0700 -Subject: [PATCH] Spigot Update - 20140909a - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0c4976d..a993b1d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -48,26 +48,6 @@ public class Main { - + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n" - + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" ); - -- Enumeration resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" ); -- while ( resources.hasMoreElements() ) -- { -- Manifest manifest = new Manifest( resources.nextElement().openStream() ); -- String ts = manifest.getMainAttributes().getValue( "Timestamp" ); -- if ( ts != null ) -- { -- Date buildDate = new SimpleDateFormat( "yyyyMMdd-hhmm" ).parse( ts ); -- -- Calendar cal = Calendar.getInstance(); -- cal.add( Calendar.DAY_OF_YEAR, -2 ); -- if ( buildDate.before(cal.getTime() ) ) -- { -- System.err.println( "WARNING: This build is more than 2 days old and there are likely updates available!" ); -- System.err.println( "You will get no support with this build unless you update from http://ci.md-5.net/job/Spigot/" ); -- System.err.println( "The server will start in 10 seconds!" ); -- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -- } -- } -- } - // Spigot End - // Todo: Installation script - OptionParser parser = new OptionParser() { --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0182-Spigot-Update-20140909b.patch b/CraftBukkit-Patches/0182-Spigot-Update-20140909b.patch deleted file mode 100644 index 91cedab6ec..0000000000 --- a/CraftBukkit-Patches/0182-Spigot-Update-20140909b.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 8d77dcd164e3f844c3bda9310b37aa857f50a72a Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Fri, 12 Sep 2014 17:16:43 -0700 -Subject: [PATCH] Spigot Update - 20140909b - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index fdbdcc6..416a349 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -1,10 +1,14 @@ - package net.minecraft.server; - -+import net.md_5.bungee.api.chat.BaseComponent; -+import net.md_5.bungee.chat.ComponentSerializer; -+ - import java.io.IOException; - - public class PacketPlayOutChat extends Packet { - - private IChatBaseComponent a; -+ public BaseComponent[] components; // Spigot - Update 20140909b - private boolean b; - - public PacketPlayOutChat() { -@@ -26,7 +30,16 @@ public class PacketPlayOutChat extends Packet { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { -- packetdataserializer.a(ChatSerializer.a(this.a)); -+ // Spigot start - Update 20140909b -+ if (components != null) -+ { -+ packetdataserializer.a( ComponentSerializer.toString(components) ); -+ } -+ else { -+ packetdataserializer.a( ChatSerializer.a(a) ); -+ } -+ // Spigot end -+ - // Spigot start - protocol patch - if ( packetdataserializer.version >= 16 ) - { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5b6aa3f..3964ba0 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -23,6 +23,7 @@ import java.util.regex.Pattern; - - import javax.imageio.ImageIO; - -+import net.md_5.bungee.api.chat.BaseComponent; - import net.minecraft.server.ChunkCoordinates; - import net.minecraft.server.CommandAchievement; - import net.minecraft.server.CommandBan; -@@ -1837,6 +1838,24 @@ public final class CraftServer implements Server { - { - return org.spigotmc.SpigotConfig.config; - } -+ -+ @Override -+ public void broadcast( BaseComponent component ) -+ { -+ for ( Player player : getOnlinePlayers() ) -+ { -+ player.spigot().sendMessage( component ); -+ } -+ } -+ -+ @Override -+ public void broadcast( BaseComponent... components ) -+ { -+ for ( Player player : getOnlinePlayers() ) -+ { -+ player.spigot().sendMessage( components ); -+ } -+ } - }; - - public Spigot spigot() -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index a993b1d..ba744b1 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -22,33 +22,6 @@ public class Main { - public static boolean useConsole = true; - - public static void main(String[] args) throws Exception { -- // Spigot Start -- File lock = new File( ".update-lock" ); -- if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null ) -- { -- System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." ); -- System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" ); -- System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" ); -- System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" ); -- System.err.println( "Please type yes to continue starting the server. You have been warned :)" ); -- System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" ); -- System.err.println( "=================================================================================" ); -- System.err.println( "Starting server in 10 seconds" ); -- lock.createNewFile(); -- try -- { -- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -- } catch ( InterruptedException ex ) -- { -- } -- } -- -- System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n" -- + "*** It is imperative that backups be taken before running this build on your server! ***\n" -- + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n" -- + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" ); -- -- // Spigot End - // Todo: Installation script - OptionParser parser = new OptionParser() { - { -@@ -166,6 +139,34 @@ public class Main { - } else if (options.has("v")) { - System.out.println(CraftServer.class.getPackage().getImplementationVersion()); - } else { -+ // Spigot start - Update 20140909b -+ File lock = new File( ".update-lock" ); -+ if ( !new File( "update-lock" ).exists() && !lock.exists() && System.getProperty( "IReallyKnowWhatIAmDoingThisUpdate" ) == null ) -+ { -+ System.err.println( "WARNING: This Minecraft update alters the way in which saved data is stored." ); -+ System.err.println( "Please ensure your server is in the correct online/offline mode state, as the changes made are PERMANENT" ); -+ System.err.println( "If you are running in offline mode, but your BungeeCord is in online mode, it is imperative that BungeeCord support is enabled in spigot.yml and BungeeCord's config.yml" ); -+ System.err.println( "By typing `yes` you acknowledge that you have taken the necessary backups and are aware of this conversion" ); -+ System.err.println( "Please type yes to continue starting the server. You have been warned :)" ); -+ System.err.println( "See http://www.spigotmc.org/wiki/uuid-conversion/ if you have any questions and remember BACKUP BACKUP BACKUP" ); -+ System.err.println( "=================================================================================" ); -+ System.err.println( "Starting server in 10 seconds" ); -+ lock.createNewFile(); -+ try -+ { -+ Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -+ } catch ( InterruptedException ex ) -+ { -+ } -+ } -+ -+ System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n" -+ + "*** It is imperative that backups be taken before running this build on your server! ***\n" -+ + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n" -+ + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" ); -+ -+ // Spigot end -+ - try { - // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals - String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'}); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 35f2bfa..ca1d027 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -17,6 +17,7 @@ import java.util.UUID; - import java.util.logging.Level; - import java.util.logging.Logger; - -+import net.md_5.bungee.api.chat.BaseComponent; - import net.minecraft.server.*; - - import net.minecraft.util.com.mojang.authlib.GameProfile; -@@ -1402,6 +1403,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - - return java.util.Collections.unmodifiableSet( ret ); - } -+ -+ @Override -+ public void sendMessage( BaseComponent component ) -+ { -+ sendMessage( new BaseComponent[] { component } ); -+ } -+ -+ @Override -+ public void sendMessage( BaseComponent... components ) -+ { -+ if ( getHandle().playerConnection == null ) return; -+ -+ PacketPlayOutChat packet = new PacketPlayOutChat(); -+ packet.components = components; -+ getHandle().playerConnection.sendPacket( packet ); -+ } - }; - - public Player.Spigot spigot() --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0183-Spigot-Update-20140916a.patch b/CraftBukkit-Patches/0183-Spigot-Update-20140916a.patch deleted file mode 100644 index 909d9e9e61..0000000000 --- a/CraftBukkit-Patches/0183-Spigot-Update-20140916a.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0c60a2d1e7ae744f963071a20be7f6039df1444d Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 21 Sep 2014 12:57:40 -0700 -Subject: [PATCH] Spigot Update - 20140916a - - -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 46c4fb8..8dad7ca 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -147,7 +147,7 @@ public class EntityTrackerEntry { - this.scanPlayers(new java.util.ArrayList(this.trackedPlayers)); - } - // CraftBukkit end -- object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround); // Spigot - protocol patch -+ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, tracker.onGround, tracker instanceof EntityFallingBlock || tracker instanceof EntityTNTPrimed); // Spigot - protocol patch // Spigot Update - 20140916a - } - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -index 87260d5..b637d25 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -9,6 +9,7 @@ public class PacketPlayOutEntityTeleport extends Packet { - private byte e; - private byte f; - private boolean onGround; // Spigot - protocol patch -+ private boolean heightCorrection; // Spigot Update - 20140916a - - public PacketPlayOutEntityTeleport() {} - -@@ -21,7 +22,7 @@ public class PacketPlayOutEntityTeleport extends Packet { - this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F)); - } - -- public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround) { // Spigot - protocol patch -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround, boolean heightCorrection) { // Spigot - protocol patch // Spigot Update - 20140916a - this.a = i; - this.b = j; - this.c = k; -@@ -29,6 +30,7 @@ public class PacketPlayOutEntityTeleport extends Packet { - this.e = b0; - this.f = b1; - this.onGround = onGround; // Spigot - protocol patch -+ this.heightCorrection = heightCorrection; // Spigot Update - 20140916a - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -51,7 +53,7 @@ public class PacketPlayOutEntityTeleport extends Packet { - } - // Spigot end - packetdataserializer.writeInt(this.b); -- packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt((packetdataserializer.version >= 16 && heightCorrection) ? (this.c - 16) : this.c); // Spigot Update - 20140916a - packetdataserializer.writeInt(this.d); - packetdataserializer.writeByte(this.e); - packetdataserializer.writeByte(this.f); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -index dcf1204..eef9de2 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -116,6 +116,12 @@ public class PacketPlayOutSpawnEntity extends Packet { - int data = k >> 16; - k = id | ( data << 12 ); - } -+ -+ if ( ( j == 50 || j == 70 || j == 74 ) && packetdataserializer.version >= 16 ) // Spigot Update - 20140916a -+ { -+ c -= 16; -+ } -+ - // Spigot end - packetdataserializer.writeInt(this.b); - packetdataserializer.writeInt(this.c); --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0184-Spigot-Update-20140921a.patch b/CraftBukkit-Patches/0184-Spigot-Update-20140921a.patch deleted file mode 100644 index 9194d9ad36..0000000000 --- a/CraftBukkit-Patches/0184-Spigot-Update-20140921a.patch +++ /dev/null @@ -1,973 +0,0 @@ -From dd9186f3ff7054b05e2b5379badb7204718bc50d Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 21 Sep 2014 18:11:43 -0700 -Subject: [PATCH] Spigot Update - 20140921a - - -diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -new file mode 100644 -index 0000000..deda472 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java -@@ -0,0 +1,364 @@ -+package net.minecraft.server; -+ -+import java.util.ArrayList; -+import java.util.HashMap; -+import java.util.Iterator; -+import java.util.LinkedHashMap; -+import java.util.List; -+import java.util.Map; -+import java.util.Random; -+ -+public class EnchantmentManager { -+ -+ private static final Random random = new Random(); -+ private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass) null); -+ private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass) null); -+ private static final EnchantmentModifierThorns d = new EnchantmentModifierThorns((EmptyClass) null); -+ private static final EnchantmentModifierArthropods e = new EnchantmentModifierArthropods((EmptyClass) null); -+ -+ public static int getEnchantmentLevel(int i, ItemStack itemstack) { -+ if (itemstack == null) { -+ return 0; -+ } else { -+ NBTTagList nbttaglist = itemstack.getEnchantments(); -+ -+ if (nbttaglist == null) { -+ return 0; -+ } else { -+ for (int j = 0; j < nbttaglist.size(); ++j) { -+ short short1 = nbttaglist.get(j).getShort("id"); -+ short short2 = nbttaglist.get(j).getShort("lvl"); -+ -+ if (short1 == i) { -+ return short2; -+ } -+ } -+ -+ return 0; -+ } -+ } -+ } -+ -+ public static Map a(ItemStack itemstack) { -+ LinkedHashMap linkedhashmap = new LinkedHashMap(); -+ NBTTagList nbttaglist = itemstack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK.g(itemstack) : itemstack.getEnchantments(); -+ -+ if (nbttaglist != null) { -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ short short1 = nbttaglist.get(i).getShort("id"); -+ short short2 = nbttaglist.get(i).getShort("lvl"); -+ -+ linkedhashmap.put(Integer.valueOf(short1), Integer.valueOf(short2)); -+ } -+ } -+ -+ return linkedhashmap; -+ } -+ -+ public static void a(Map map, ItemStack itemstack) { -+ NBTTagList nbttaglist = new NBTTagList(); -+ Iterator iterator = map.keySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ int i = ((Integer) iterator.next()).intValue(); -+ NBTTagCompound nbttagcompound = new NBTTagCompound(); -+ -+ nbttagcompound.setShort("id", (short) i); -+ nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue()); -+ nbttaglist.add(nbttagcompound); -+ if (itemstack.getItem() == Items.ENCHANTED_BOOK) { -+ Items.ENCHANTED_BOOK.a(itemstack, new EnchantmentInstance(i, ((Integer) map.get(Integer.valueOf(i))).intValue())); -+ } -+ } -+ -+ if (nbttaglist.size() > 0) { -+ if (itemstack.getItem() != Items.ENCHANTED_BOOK) { -+ itemstack.a("ench", (NBTBase) nbttaglist); -+ } -+ } else if (itemstack.hasTag()) { -+ itemstack.getTag().remove("ench"); -+ } -+ } -+ -+ public static int getEnchantmentLevel(int i, ItemStack[] aitemstack) { -+ if (aitemstack == null) { -+ return 0; -+ } else { -+ int j = 0; -+ ItemStack[] aitemstack1 = aitemstack; -+ int k = aitemstack.length; -+ -+ for (int l = 0; l < k; ++l) { -+ ItemStack itemstack = aitemstack1[l]; -+ int i1 = getEnchantmentLevel(i, itemstack); -+ -+ if (i1 > j) { -+ j = i1; -+ } -+ } -+ -+ return j; -+ } -+ } -+ -+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { -+ if (itemstack != null) { -+ NBTTagList nbttaglist = itemstack.getEnchantments(); -+ -+ if (nbttaglist != null) { -+ for (int i = 0; i < nbttaglist.size(); ++i) { -+ short short1 = nbttaglist.get(i).getShort("id"); -+ short short2 = nbttaglist.get(i).getShort("lvl"); -+ -+ if (Enchantment.byId[short1] != null) { -+ enchantmentmodifier.a(Enchantment.byId[short1], short2); -+ } -+ } -+ } -+ } -+ } -+ -+ private static void a(EnchantmentModifier enchantmentmodifier, ItemStack[] aitemstack) { -+ ItemStack[] aitemstack1 = aitemstack; -+ int i = aitemstack.length; -+ -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack1[j]; -+ -+ a(enchantmentmodifier, itemstack); -+ } -+ } -+ -+ public static int a(ItemStack[] aitemstack, DamageSource damagesource) { -+ b.a = 0; -+ b.b = damagesource; -+ a((EnchantmentModifier) b, aitemstack); -+ if (b.a > 25) { -+ b.a = 25; -+ } -+ -+ return (b.a + 1 >> 1) + random.nextInt((b.a >> 1) + 1); -+ } -+ -+ public static float a(EntityLiving entityliving, EntityLiving entityliving1) { -+ return a(entityliving.be(), entityliving1.getMonsterType()); -+ } -+ -+ public static float a(ItemStack itemstack, EnumMonsterType enummonstertype) { -+ c.a = 0.0F; -+ c.b = enummonstertype; -+ a((EnchantmentModifier) c, itemstack); -+ return c.a; -+ } -+ -+ public static void a(EntityLiving entityliving, Entity entity) { -+ d.b = entity; -+ d.a = entityliving; -+ a((EnchantmentModifier) d, entityliving.getEquipment()); -+ if (entity instanceof EntityHuman) { -+ a((EnchantmentModifier) d, entityliving.be()); -+ } -+ d.b = null; -+ d.a = null; -+ } -+ -+ public static void b(EntityLiving entityliving, Entity entity) { -+ e.a = entityliving; -+ e.b = entity; -+ a((EnchantmentModifier) e, entityliving.getEquipment()); -+ if (entityliving instanceof EntityHuman) { -+ a((EnchantmentModifier) e, entityliving.be()); -+ } -+ e.a = null; -+ e.b = null; -+ } -+ -+ public static int getKnockbackEnchantmentLevel(EntityLiving entityliving, EntityLiving entityliving1) { -+ return getEnchantmentLevel(Enchantment.KNOCKBACK.id, entityliving.be()); -+ } -+ -+ public static int getFireAspectEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, entityliving.be()); -+ } -+ -+ public static int getOxygenEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.OXYGEN.id, entityliving.getEquipment()); -+ } -+ -+ public static int getDigSpeedEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.DIG_SPEED.id, entityliving.be()); -+ } -+ -+ public static boolean hasSilkTouchEnchantment(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, entityliving.be()) > 0; -+ } -+ -+ public static int getBonusBlockLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, entityliving.be()); -+ } -+ -+ public static int getLuckEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LUCK.id, entityliving.be()); -+ } -+ -+ public static int getLureEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LURE.id, entityliving.be()); -+ } -+ -+ public static int getBonusMonsterLootEnchantmentLevel(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, entityliving.be()); -+ } -+ -+ public static boolean hasWaterWorkerEnchantment(EntityLiving entityliving) { -+ return getEnchantmentLevel(Enchantment.WATER_WORKER.id, entityliving.getEquipment()) > 0; -+ } -+ -+ public static ItemStack a(Enchantment enchantment, EntityLiving entityliving) { -+ ItemStack[] aitemstack = entityliving.getEquipment(); -+ int i = aitemstack.length; -+ -+ for (int j = 0; j < i; ++j) { -+ ItemStack itemstack = aitemstack[j]; -+ -+ if (itemstack != null && getEnchantmentLevel(enchantment.id, itemstack) > 0) { -+ return itemstack; -+ } -+ } -+ -+ return null; -+ } -+ -+ public static int a(Random random, int i, int j, ItemStack itemstack) { -+ Item item = itemstack.getItem(); -+ int k = item.c(); -+ -+ if (k <= 0) { -+ return 0; -+ } else { -+ if (j > 15) { -+ j = 15; -+ } -+ -+ int l = random.nextInt(8) + 1 + (j >> 1) + random.nextInt(j + 1); -+ -+ return i == 0 ? Math.max(l / 3, 1) : (i == 1 ? l * 2 / 3 + 1 : Math.max(l, j * 2)); -+ } -+ } -+ -+ public static ItemStack a(Random random, ItemStack itemstack, int i) { -+ List list = b(random, itemstack, i); -+ boolean flag = itemstack.getItem() == Items.BOOK; -+ -+ if (flag) { -+ itemstack.setItem(Items.ENCHANTED_BOOK); -+ } -+ -+ if (list != null) { -+ Iterator iterator = list.iterator(); -+ -+ while (iterator.hasNext()) { -+ EnchantmentInstance enchantmentinstance = (EnchantmentInstance) iterator.next(); -+ -+ if (flag) { -+ Items.ENCHANTED_BOOK.a(itemstack, enchantmentinstance); -+ } else { -+ itemstack.addEnchantment(enchantmentinstance.enchantment, enchantmentinstance.level); -+ } -+ } -+ } -+ -+ return itemstack; -+ } -+ -+ public static List b(Random random, ItemStack itemstack, int i) { -+ Item item = itemstack.getItem(); -+ int j = item.c(); -+ -+ if (j <= 0) { -+ return null; -+ } else { -+ j /= 2; -+ j = 1 + random.nextInt((j >> 1) + 1) + random.nextInt((j >> 1) + 1); -+ int k = j + i; -+ float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F; -+ int l = (int) ((float) k * (1.0F + f) + 0.5F); -+ -+ if (l < 1) { -+ l = 1; -+ } -+ -+ ArrayList arraylist = null; -+ Map map = b(l, itemstack); -+ -+ if (map != null && !map.isEmpty()) { -+ EnchantmentInstance enchantmentinstance = (EnchantmentInstance) WeightedRandom.a(random, map.values()); -+ -+ if (enchantmentinstance != null) { -+ arraylist = new ArrayList(); -+ arraylist.add(enchantmentinstance); -+ -+ for (int i1 = l; random.nextInt(50) <= i1; i1 >>= 1) { -+ Iterator iterator = map.keySet().iterator(); -+ -+ while (iterator.hasNext()) { -+ Integer integer = (Integer) iterator.next(); -+ boolean flag = true; -+ Iterator iterator1 = arraylist.iterator(); -+ -+ while (true) { -+ if (iterator1.hasNext()) { -+ EnchantmentInstance enchantmentinstance1 = (EnchantmentInstance) iterator1.next(); -+ -+ if (enchantmentinstance1.enchantment.a(Enchantment.byId[integer.intValue()])) { -+ continue; -+ } -+ -+ flag = false; -+ } -+ -+ if (!flag) { -+ iterator.remove(); -+ } -+ break; -+ } -+ } -+ -+ if (!map.isEmpty()) { -+ EnchantmentInstance enchantmentinstance2 = (EnchantmentInstance) WeightedRandom.a(random, map.values()); -+ -+ arraylist.add(enchantmentinstance2); -+ } -+ } -+ } -+ } -+ -+ return arraylist; -+ } -+ } -+ -+ public static Map b(int i, ItemStack itemstack) { -+ Item item = itemstack.getItem(); -+ HashMap hashmap = null; -+ boolean flag = itemstack.getItem() == Items.BOOK; -+ Enchantment[] aenchantment = Enchantment.byId; -+ int j = aenchantment.length; -+ -+ for (int k = 0; k < j; ++k) { -+ Enchantment enchantment = aenchantment[k]; -+ -+ if (enchantment != null && (enchantment.slot.canEnchant(item) || flag)) { -+ for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) { -+ if (i >= enchantment.a(l) && i <= enchantment.b(l)) { -+ if (hashmap == null) { -+ hashmap = new HashMap(); -+ } -+ -+ hashmap.put(Integer.valueOf(enchantment.id), new EnchantmentInstance(enchantment, l)); -+ } -+ } -+ } -+ } -+ -+ return hashmap; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java -new file mode 100644 -index 0000000..c8e11db ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierArthropods.java -@@ -0,0 +1,17 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierArthropods implements EnchantmentModifier { -+ -+ public EntityLiving a; -+ public Entity b; -+ -+ private EnchantmentModifierArthropods() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ enchantment.a(this.a, this.b, i); -+ } -+ -+ EnchantmentModifierArthropods(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java -new file mode 100644 -index 0000000..8610c7a ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java -@@ -0,0 +1,17 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierDamage implements EnchantmentModifier { -+ -+ public float a; -+ public EnumMonsterType b; -+ -+ private EnchantmentModifierDamage() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ this.a += enchantment.a(i, this.b); -+ } -+ -+ EnchantmentModifierDamage(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java -new file mode 100644 -index 0000000..8c03320 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java -@@ -0,0 +1,17 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierProtection implements EnchantmentModifier { -+ -+ public int a; -+ public DamageSource b; -+ -+ private EnchantmentModifierProtection() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ this.a += enchantment.a(i, this.b); -+ } -+ -+ EnchantmentModifierProtection(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java -new file mode 100644 -index 0000000..41993e0 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentModifierThorns.java -@@ -0,0 +1,17 @@ -+package net.minecraft.server; -+ -+final class EnchantmentModifierThorns implements EnchantmentModifier { -+ -+ public EntityLiving a; -+ public Entity b; -+ -+ private EnchantmentModifierThorns() {} -+ -+ public void a(Enchantment enchantment, int i) { -+ enchantment.b(this.a, this.b, i); -+ } -+ -+ EnchantmentModifierThorns(EmptyClass emptyclass) { -+ this(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EnchantmentThorns.java b/src/main/java/net/minecraft/server/EnchantmentThorns.java -new file mode 100644 -index 0000000..6841259 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EnchantmentThorns.java -@@ -0,0 +1,54 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class EnchantmentThorns extends Enchantment { -+ -+ public EnchantmentThorns(int i, int j) { -+ super(i, j, EnchantmentSlotType.ARMOR_TORSO); -+ this.b("thorns"); -+ } -+ -+ public int a(int n) { -+ return 10 + 20 * (n - 1); -+ } -+ -+ public int b(int i) { -+ return super.a(i) + 50; -+ } -+ -+ public int getMaxLevel() { -+ return 3; -+ } -+ -+ public boolean canEnchant(ItemStack itemstack) { -+ return itemstack.getItem() instanceof ItemArmor ? true : super.canEnchant(itemstack); -+ } -+ -+ public void b(EntityLiving entityliving, Entity entity, int n) { -+ Random ai = entityliving.aI(); -+ ItemStack a = EnchantmentManager.a(Enchantment.THORNS, entityliving); -+ -+ if (a(n, ai)) { -+ entity.damageEntity(DamageSource.a(entityliving), b(n, ai)); -+ entity.makeSound("damage.thorns", 0.5F, 1.0F); -+ if (a != null) { -+ a.damage(3, entityliving); -+ } -+ } else if (a != null) { -+ a.damage(1, entityliving); -+ } -+ } -+ -+ public static boolean a(int n, Random random) { -+ return n > 0 && random.nextFloat() < 0.15f * n; -+ } -+ -+ public static int b(int n, Random random) { -+ if (n > 10) { -+ return n - 10; -+ } -+ -+ return 1 + random.nextInt(4); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 617f7d4..cf0c38f 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import java.lang.ref.WeakReference; - import java.util.Iterator; - import java.util.List; - import java.util.UUID; -@@ -21,7 +22,7 @@ public abstract class EntityInsentient extends EntityLiving { - private Navigation navigation; - protected final PathfinderGoalSelector goalSelector; - protected final PathfinderGoalSelector targetSelector; -- private EntityLiving goalTarget; -+ private WeakReference goalTarget = new WeakReference(null); // Spigot Update - 20140921a - private EntitySenses bq; - private ItemStack[] equipment = new ItemStack[5]; - public float[] dropChances = new float[5]; // CraftBukkit - protected -> public -@@ -76,11 +77,11 @@ public abstract class EntityInsentient extends EntityLiving { - } - - public EntityLiving getGoalTarget() { -- return this.goalTarget; -+ return this.goalTarget.get(); - } - - public void setGoalTarget(EntityLiving entityliving) { -- this.goalTarget = entityliving; -+ this.goalTarget = new WeakReference(entityliving); - } - - public boolean a(Class oclass) { -diff --git a/src/main/java/net/minecraft/server/ItemEnchantedBook.java b/src/main/java/net/minecraft/server/ItemEnchantedBook.java -new file mode 100644 -index 0000000..0829e4c ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemEnchantedBook.java -@@ -0,0 +1,72 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class ItemEnchantedBook extends Item { -+ -+ public ItemEnchantedBook() {} -+ -+ public boolean e_(ItemStack itemStack) { -+ return false; -+ } -+ -+ public EnumItemRarity f(ItemStack itemstack) { -+ if (this.g(itemstack).size() > 0) { -+ return EnumItemRarity.UNCOMMON; -+ } -+ return super.f(itemstack); -+ } -+ -+ public NBTTagList g(ItemStack itemStack) { -+ if (itemStack.tag == null || !itemStack.tag.hasKeyOfType("StoredEnchantments", 9)) { -+ return new NBTTagList(); -+ } -+ return (NBTTagList)itemStack.tag.get("StoredEnchantments"); -+ } -+ -+ public void a(ItemStack itemStack, EnchantmentInstance enchantmentInstance) { -+ NBTTagList g = this.g(itemStack); -+ boolean b = true; -+ for (int i = 0; i < g.size(); ++i) { -+ NBTTagCompound value = g.get(i); -+ if (value.getShort("id") == enchantmentInstance.enchantment.id) { -+ if (value.getShort("lvl") < enchantmentInstance.level) { -+ value.setShort("lvl", (short)enchantmentInstance.level); -+ } -+ -+ b = false; -+ break; -+ } -+ } -+ -+ if (b) { -+ NBTTagCompound nbtTagCompound = new NBTTagCompound(); -+ nbtTagCompound.setShort("id", (short)enchantmentInstance.enchantment.id); -+ nbtTagCompound.setShort("lvl", (short)enchantmentInstance.level); -+ g.add(nbtTagCompound); -+ } -+ -+ if (!itemStack.hasTag()) { -+ itemStack.setTag(new NBTTagCompound()); -+ } -+ -+ itemStack.getTag().set("StoredEnchantments", g); -+ } -+ -+ public ItemStack a(EnchantmentInstance enchantmentInstance) { -+ ItemStack itemStack = new ItemStack(this); -+ this.a(itemStack, enchantmentInstance); -+ return itemStack; -+ } -+ -+ public StructurePieceTreasure b(Random random) { -+ return this.a(random, 1, 1, 1); -+ } -+ -+ public StructurePieceTreasure a(final Random random, final int n, final int n2, final int n3) { -+ ItemStack itemstack = new ItemStack(Items.BOOK, 1, 0); -+ -+ EnchantmentManager.a(random, itemstack, 30); -+ return new StructurePieceTreasure(itemstack, n, n2, n3); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0cae021..76a5403 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -199,6 +199,8 @@ public class NetworkManager extends SimpleChannelInboundHandler { - public void close(IChatBaseComponent ichatbasecomponent) { - // Spigot Start - this.preparing = false; -+ this.k.clear(); // Spigot Update - 20140921a -+ this.l.clear(); // Spigot Update - 20140921a - // Spigot End - if (this.m.isOpen()) { - this.m.close(); -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -new file mode 100644 -index 0000000..30a05c6 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -@@ -0,0 +1,54 @@ -+package net.minecraft.server; -+ -+import java.lang.ref.WeakReference; -+import java.util.Collections; -+import java.util.List; -+ -+public class PathfinderGoalNearestAttackableTarget extends PathfinderGoalTarget { -+ -+ private final Class a; -+ private final int b; -+ private final DistanceComparator e; -+ private final IEntitySelector f; -+ private WeakReference g; // Spigot Update - 20140921a -+ -+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag) { -+ this(entitycreature, oclass, i, flag, false); -+ } -+ -+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag, boolean flag1) { -+ this(entitycreature, oclass, i, flag, flag1, (IEntitySelector) null); -+ } -+ -+ public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, int i, boolean flag, boolean flag1, IEntitySelector ientityselector) { -+ super(entitycreature, flag, flag1); -+ this.g = new WeakReference(null); -+ this.a = oclass; -+ this.b = i; -+ this.e = new DistanceComparator(entitycreature); -+ this.a(1); -+ this.f = new EntitySelectorNearestAttackableTarget(this, ientityselector); -+ } -+ -+ public boolean a() { -+ if (this.b > 0 && this.c.aI().nextInt(this.b) != 0) { -+ return false; -+ } else { -+ double d0 = this.f(); -+ List list = this.c.world.a(this.a, this.c.boundingBox.grow(d0, 4.0D, d0), this.f); -+ -+ Collections.sort(list, this.e); -+ if (list.isEmpty()) { -+ return false; -+ } else { -+ this.g = new WeakReference((EntityLiving) list.get(0)); -+ return true; -+ } -+ } -+ } -+ -+ public void c() { -+ this.c.setGoalTarget(this.g.get()); -+ super.c(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java -new file mode 100644 -index 0000000..9a31d82 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java -@@ -0,0 +1,36 @@ -+package net.minecraft.server; -+ -+public class PathfinderGoalSwell extends PathfinderGoal { -+ -+ EntityCreeper a; -+ -+ public PathfinderGoalSwell(EntityCreeper entitycreeper) { -+ this.a = entitycreeper; -+ this.a(1); -+ } -+ -+ public boolean a() { -+ EntityLiving entityliving = this.a.getGoalTarget(); -+ -+ return this.a.cb() > 0 || entityliving != null && this.a.f(entityliving) < 9.0D; -+ } -+ -+ public void c() { -+ this.a.getNavigation().h(); -+ } -+ -+ public void d() {} -+ -+ public void e() { -+ EntityLiving b = this.a.getGoalTarget(); // Spigot Update - 20140921a -+ if (b == null) { -+ this.a.a(-1); -+ } else if (this.a.f(b) > 49.0D) { -+ this.a.a(-1); -+ } else if (!this.a.getEntitySenses().canSee(b)) { -+ this.a.a(-1); -+ } else { -+ this.a.a(1); -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -index 9d54472..1765c79 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java -@@ -10,6 +10,6 @@ public class LongHash { - } - - public static int lsw(long l) { -- return (int) (l) + Integer.MIN_VALUE; // Spigot - remove redundant & -+ return (int) (l & -1L) + Integer.MIN_VALUE; // Spigot - remove redundant & // Spigot Update - 20140921a - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -index 7f659b7..22c96c5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java -@@ -31,7 +31,6 @@ public class LongHashSet { - private int elements; - private long[] values; - private int modCount; -- private org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongHashSet() { - this(INITIAL_SIZE); -@@ -57,30 +56,10 @@ public class LongHashSet { - } - - public boolean contains(int msw, int lsw) { -- // Spigot start -- if ( elements == 0 ) -- { -- return false; -- } -- if ( flat.contains( msw, lsw ) ) -- { -- return true; -- } -- // Spigot end - return contains(LongHash.toLong(msw, lsw)); - } - - public boolean contains(long value) { -- // Spigot start -- if ( elements == 0 ) -- { -- return false; -- } -- if ( flat.contains( value ) ) -- { -- return true; -- } -- // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -103,7 +82,6 @@ public class LongHashSet { - } - - public boolean add(long value) { -- flat.put( value, Boolean.TRUE ); // Spigot - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -147,18 +125,10 @@ public class LongHashSet { - } - - public void remove(int msw, int lsw) { -- // Spigot start -- flat.remove(msw, lsw); -- remove0(LongHash.toLong(msw, lsw)); -+ remove(LongHash.toLong(msw, lsw)); - } - - public boolean remove(long value) { -- flat.remove(value); -- return remove0(value); -- } -- -- private boolean remove0(long value) { -- // Spigot end - int hash = hash(value); - int index = (hash & 0x7FFFFFFF) % values.length; - int offset = 1; -@@ -191,7 +161,6 @@ public class LongHashSet { - - freeEntries = values.length; - modCount++; -- flat = new org.spigotmc.FlatMap(); - } - - public long[] toArray() { -diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -index 2e5b436..01861cc 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/LongObjectHashMap.java -@@ -28,7 +28,6 @@ public class LongObjectHashMap implements Cloneable, Serializable { - private transient V[][] values; - private transient int modCount; - private transient int size; -- private transient org.spigotmc.FlatMap flat = new org.spigotmc.FlatMap(); // Spigot - - public LongObjectHashMap() { - initialize(); -@@ -62,17 +61,6 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V get(long key) { -- // Spigot start -- if ( size == 0 ) -- { -- return null; -- } -- V val = flat.get( key ); -- if ( val != null ) -- { -- return val; -- } -- // Spigot end - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) return null; -@@ -90,7 +78,6 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V put(long key, V value) { -- flat.put(key, value); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] innerKeys = keys[index]; - V[] innerValues = values[index]; -@@ -137,7 +124,6 @@ public class LongObjectHashMap implements Cloneable, Serializable { - } - - public V remove(long key) { -- flat.remove(key); // Spigot - int index = (int) (keyIndex(key) & (BUCKET_SIZE - 1)); - long[] inner = keys[index]; - if (inner == null) { -@@ -188,7 +174,6 @@ public class LongObjectHashMap implements Cloneable, Serializable { - size = 0; - Arrays.fill(keys, null); - Arrays.fill(values, null); -- flat = new org.spigotmc.FlatMap(); - } - - public Set keySet() { -diff --git a/src/main/java/org/spigotmc/FlatMap.java b/src/main/java/org/spigotmc/FlatMap.java -deleted file mode 100644 -index 9416f6e..0000000 ---- a/src/main/java/org/spigotmc/FlatMap.java -+++ /dev/null -@@ -1,64 +0,0 @@ --package org.spigotmc; -- --import org.bukkit.craftbukkit.util.LongHash; -- --public class FlatMap --{ -- -- private static final int FLAT_LOOKUP_SIZE = 512; -- private final Object[][] flatLookup = new Object[ FLAT_LOOKUP_SIZE * 2 ][ FLAT_LOOKUP_SIZE * 2 ]; -- -- public void put(long msw, long lsw, V value) -- { -- long acx = Math.abs( msw ); -- long acz = Math.abs( lsw ); -- if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -- { -- flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )] = value; -- } -- } -- -- public void put(long key, V value) -- { -- put( LongHash.msw( key ), LongHash.lsw( key ), value ); -- -- } -- -- public void remove(long key) -- { -- put( key, null ); -- } -- -- public void remove(long msw, long lsw) -- { -- put( msw, lsw, null ); -- } -- -- public boolean contains(long msw, long lsw) -- { -- return get( msw, lsw ) != null; -- } -- -- public boolean contains(long key) -- { -- return get( key ) != null; -- } -- -- public V get(long msw, long lsw) -- { -- long acx = Math.abs( msw ); -- long acz = Math.abs( lsw ); -- if ( acx < FLAT_LOOKUP_SIZE && acz < FLAT_LOOKUP_SIZE ) -- { -- return (V) flatLookup[(int) ( msw + FLAT_LOOKUP_SIZE )][(int) ( lsw + FLAT_LOOKUP_SIZE )]; -- } else -- { -- return null; -- } -- } -- -- public V get(long key) -- { -- return get( LongHash.msw( key ), LongHash.lsw( key ) ); -- } --} --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0185-Spigot-Update-20140927a.patch b/CraftBukkit-Patches/0185-Spigot-Update-20140927a.patch deleted file mode 100644 index d3678c994d..0000000000 --- a/CraftBukkit-Patches/0185-Spigot-Update-20140927a.patch +++ /dev/null @@ -1,58 +0,0 @@ -From feaaf50a42e83b918d3a2c9f36e24ef7a4c6d8a7 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 1 Oct 2014 00:27:39 -0700 -Subject: [PATCH] Spigot Update - 20140927a - - -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 8dad7ca..78e0965 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -324,6 +324,10 @@ public class EntityTrackerEntry { - if ( tracker instanceof EntityPlayer ) - { - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.addPlayer( (EntityPlayer) tracker ) ); -+ -+ if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { // Spigot Update - 20140927a -+ entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( (EntityPlayer) this.tracker ) ); -+ } - } - // Spigot end - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0359cb3..86b0343 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -285,11 +285,17 @@ public abstract class PlayerList { - - // CraftBukkit start - sendAll above replaced with this loop - PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.addPlayer( entityplayer ); // Spigot - protocol patch -+ PacketPlayOutPlayerInfo displayPacket = PacketPlayOutPlayerInfo.updateDisplayName( entityplayer ); // Spigot Update - 20140927a - for (int i = 0; i < this.players.size(); ++i) { - EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); - - if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) { - entityplayer1.playerConnection.sendPacket(packet); -+ // Spigot start - Update 20140927a -+ if ( entityplayer1.playerConnection.networkManager.getVersion() > 28 ) { -+ entityplayer1.playerConnection.sendPacket( displayPacket ); -+ } -+ // Spigot end - } - } - // CraftBukkit end -@@ -303,6 +309,11 @@ public abstract class PlayerList { - } - // .name -> .listName - entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( entityplayer1 )); // Spigot - protocol patch -+ // Spigot start - Update 20140927a -+ if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { -+ entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( entityplayer1 ) ); -+ } -+ // Spigot end - // CraftBukkit end - } - } --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0186-Spigot-Update-20141001a.patch b/CraftBukkit-Patches/0186-Spigot-Update-20141001a.patch deleted file mode 100644 index 2c176da4f0..0000000000 --- a/CraftBukkit-Patches/0186-Spigot-Update-20141001a.patch +++ /dev/null @@ -1,224 +0,0 @@ -From cd9384eed6798cc8638659fa40d161f0ad56b8b6 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 1 Oct 2014 03:00:09 -0700 -Subject: [PATCH] Spigot Update - 20141001a - - -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 78e0965..886feed 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -325,7 +325,7 @@ public class EntityTrackerEntry { - { - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.addPlayer( (EntityPlayer) tracker ) ); - -- if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { // Spigot Update - 20140927a -+ if ( !entityplayer.getName().equals( entityplayer.listName ) && entityplayer.playerConnection.networkManager.getVersion() > 28 ) { // Spigot Update - 20140927a // Spigot Update - 20141001a - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( (EntityPlayer) this.tracker ) ); - } - } -diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java -new file mode 100644 -index 0000000..3fa6e11 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemDoor.java -@@ -0,0 +1,79 @@ -+package net.minecraft.server; -+ -+public class ItemDoor extends Item { -+ -+ private Material a; -+ -+ public ItemDoor(Material material) { -+ this.a = material; -+ this.maxStackSize = 1; -+ this.a(CreativeModeTab.d); -+ } -+ -+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) { -+ if (l != 1) { -+ return false; -+ } else { -+ ++j; -+ Block block; -+ -+ if (this.a == Material.WOOD) { -+ block = Blocks.WOODEN_DOOR; -+ } else { -+ block = Blocks.IRON_DOOR_BLOCK; -+ } -+ -+ if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i, j + 1, k, l, itemstack)) { -+ if (!block.canPlace(world, i, j, k)) { -+ return false; -+ } else { -+ int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; -+ -+ place(world, i, j, k, i1, block); -+ --itemstack.count; -+ return true; -+ } -+ } else { -+ return false; -+ } -+ } -+ } -+ -+ public static void place(World world, int i, int j, int k, int l, Block block) { -+ byte b0 = 0; -+ byte b1 = 0; -+ -+ if (l == 0) { -+ b1 = 1; -+ } -+ -+ if (l == 1) { -+ b0 = -1; -+ } -+ -+ if (l == 2) { -+ b1 = -1; -+ } -+ -+ if (l == 3) { -+ b0 = 1; -+ } -+ -+ int i1 = (world.getType(i - b0, j, k - b1).r() ? 1 : 0) + (world.getType(i - b0, j + 1, k - b1).r() ? 1 : 0); -+ int j1 = (world.getType(i + b0, j, k + b1).r() ? 1 : 0) + (world.getType(i + b0, j + 1, k + b1).r() ? 1 : 0); -+ boolean flag = world.getType(i - b0, j, k - b1) == block || world.getType(i - b0, j + 1, k - b1) == block; -+ boolean flag1 = world.getType(i + b0, j, k + b1) == block || world.getType(i + b0, j + 1, k + b1) == block; -+ boolean flag2 = false; -+ -+ if (flag && !flag1) { -+ flag2 = true; -+ } else if (j1 > i1) { -+ flag2 = true; -+ } -+ -+ world.setTypeAndData(i, j, k, block, l, 3); // Spigot Update - 20141001a -+ world.setTypeAndData(i, j + 1, k, block, 8 | (flag2 ? 1 : 0), 3); // Spigot Update - 20141001a -+ //world.applyPhysics(i, j, k, block); // Spigot Update - 20141001a -+ //world.applyPhysics(i, j + 1, k, block); // Spigot Update - 20141001a -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 27c34f6..05edc52 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -10,6 +10,7 @@ public class PacketPlayOutChat extends Packet { - private IChatBaseComponent a; - public BaseComponent[] components; // Spigot - Update 20140909b - private boolean b; -+ private int pos; // Spigot - Update 20141001a - - public PacketPlayOutChat() { - this.b = true; -@@ -19,10 +20,19 @@ public class PacketPlayOutChat extends Packet { - this(ichatbasecomponent, true); - } - -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, int pos) { -+ this(ichatbasecomponent, pos, true); -+ } -+ - public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag) { -+ this(ichatbasecomponent, 0, flag); -+ } -+ -+ public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, int pos, boolean flag) { - this.b = true; - this.a = ichatbasecomponent; - this.b = flag; -+ this.pos = pos; - } - - public void a(PacketDataSerializer packetdataserializer) throws IOException { -@@ -43,7 +53,7 @@ public class PacketPlayOutChat extends Packet { - // Spigot start - protocol patch - if ( packetdataserializer.version >= 16 ) - { -- packetdataserializer.writeByte(0); -+ packetdataserializer.writeByte( this.pos ); - } - // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -index b3c0ccf..7520af8 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java -@@ -8,16 +8,22 @@ public class PacketPlayOutPosition extends Packet { - private float d; - private float e; - private boolean f; -+ private byte relativeBitMask; // Spigot Update - 20141001a - - public PacketPlayOutPosition() {} - - public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, boolean flag) { -+ this(d0, d1, d2, f, f1, flag, (byte)0); -+ } -+ -+ public PacketPlayOutPosition(double d0, double d1, double d2, float f, float f1, boolean flag, byte relativeBitMask) { - this.a = d0; - this.b = d1; - this.c = d2; - this.d = f; - this.e = f1; - this.f = flag; -+ this.relativeBitMask = relativeBitMask; - } - - public void a(PacketDataSerializer packetdataserializer) { -@@ -41,7 +47,7 @@ public class PacketPlayOutPosition extends Packet { - packetdataserializer.writeBoolean( this.f ); - } else - { -- packetdataserializer.writeByte( 0 ); -+ packetdataserializer.writeByte( this.relativeBitMask ); - } - // Spigot end - } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 86b0343..bc10c4e 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -291,8 +291,8 @@ public abstract class PlayerList { - - if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) { - entityplayer1.playerConnection.sendPacket(packet); -- // Spigot start - Update 20140927a -- if ( entityplayer1.playerConnection.networkManager.getVersion() > 28 ) { -+ // Spigot start - Update 20140927a // Update - 20141001a -+ if ( !entityplayer.getName().equals( entityplayer.listName ) && entityplayer1.playerConnection.networkManager.getVersion() > 28 ) { - entityplayer1.playerConnection.sendPacket( displayPacket ); - } - // Spigot end -@@ -309,8 +309,8 @@ public abstract class PlayerList { - } - // .name -> .listName - entityplayer.playerConnection.sendPacket(PacketPlayOutPlayerInfo.addPlayer( entityplayer1 )); // Spigot - protocol patch -- // Spigot start - Update 20140927a -- if ( entityplayer.playerConnection.networkManager.getVersion() > 28 ) { -+ // Spigot start - Update 20140927a // Update - 20141001a -+ if ( !entityplayer.getName().equals( entityplayer.listName ) && entityplayer.playerConnection.networkManager.getVersion() > 28 ) { - entityplayer.playerConnection.sendPacket( PacketPlayOutPlayerInfo.updateDisplayName( entityplayer1 ) ); - } - // Spigot end -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index d452df7..0d025bc 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -844,6 +844,9 @@ public class CraftEventFactory { - } - - public static void handleInventoryCloseEvent(EntityHuman human) { -+ if (human.activeContainer == human.defaultContainer) { // Spigot Update - 20141001a -+ return; -+ } - InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView()); - human.world.getServer().getPluginManager().callEvent(event); - human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity()); --- -1.9.4.msysgit.0 - diff --git a/CraftBukkit-Patches/0187-Spigot-Update-20141113a.patch b/CraftBukkit-Patches/0187-Spigot-Update-20141113a.patch deleted file mode 100644 index 3a0322ed51..0000000000 --- a/CraftBukkit-Patches/0187-Spigot-Update-20141113a.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 1a72afa69bf31016e7b053e0c70393eb5062a76f Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Thu, 13 Nov 2014 20:41:31 -0600 -Subject: [PATCH] Spigot Update - 20141113a - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 26ce4ed..8d60366 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1753,6 +1753,12 @@ public class PlayerConnection implements PacketPlayInListener { - } - - public void a(PacketPlayInTabComplete packetplayintabcomplete) { -+ // Spigot start - Update 20141113a -+ if (PlayerConnection.chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { -+ this.disconnect("disconnect.spam"); -+ return; -+ } -+ // Spigot end - ArrayList arraylist = Lists.newArrayList(); - Iterator iterator = this.minecraftServer.a(this.player, packetplayintabcomplete.c()).iterator(); - --- -1.9.1 - diff --git a/MinecraftRelocate/pom.xml b/MinecraftRelocate/pom.xml deleted file mode 100644 index ced882a8c4..0000000000 --- a/MinecraftRelocate/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - - - org.github.paperspigot - paperspigot-parent - dev-SNAPSHOT - ../pom.xml - - - org.github.paperspigot - minecraft-server-relocated - 1.7.10-SNAPSHOT - jar - - Minecraft Server Relocation - - - - org.github.paperspigot - minecraft-server - ${project.version} - compile - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - - package - - shade - - - - - - - net.minecraft.util.com.google - com.google - - - net.minecraft.util.gnu - gnu - - - net.minecraft.util.io - io - - - net.minecraft.util.org - org - - - - - - - \ No newline at end of file diff --git a/MinecraftRelocate/rename.sh b/MinecraftRelocate/rename.sh deleted file mode 100755 index b9b25f357c..0000000000 --- a/MinecraftRelocate/rename.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -find ../PaperSpigot-Server/src/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; -find ../Spigot-Server/src/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; -find ../Spigot-Server-Patches/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; -find ../CraftBukkit-Patches/ -type f -exec sed -i 's/net.minecraft.util.//g' {} \; - -find ../PaperSpigot-Server/src/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; -find ../Spigot-Server/src/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; -find ../CraftBukkit-Patches/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; -find ../Spigot-Server-Patches/ -type f -exec sed -i 's/com.mojang.authlib./net.minecraft.util.com.mojang.authlib./g' {} \; diff --git a/MinecraftServer/pom.xml b/MinecraftServer/pom.xml deleted file mode 100644 index 827c2fa386..0000000000 --- a/MinecraftServer/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - - org.github.paperspigot - paperspigot-parent - dev-SNAPSHOT - ../pom.xml - - - org.github.paperspigot - minecraft-server - 1.7.10-SNAPSHOT - jar - - Minecraft Server - - - - repobo-snap - http://repo.bukkit.org/content/groups/public - - - - - - org.bukkit - minecraft-server - 1.7.10 - compile - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - - package - - shade - - - - - - - \ No newline at end of file diff --git a/SneakyThrow.jar b/SneakyThrow.jar deleted file mode 100644 index 321f64ee81..0000000000 Binary files a/SneakyThrow.jar and /dev/null differ diff --git a/Spigot-API-Patches/0001-POM-changes.patch b/Spigot-API-Patches/0001-POM-changes.patch index fa85b6789f..1386b11d90 100644 --- a/Spigot-API-Patches/0001-POM-changes.patch +++ b/Spigot-API-Patches/0001-POM-changes.patch @@ -1,11 +1,11 @@ -From 5cf86c73f80228e42649a23cbf0799ce2b62a9f2 Mon Sep 17 00:00:00 2001 +From bdae10cc5e0da615921857bb3bc110820e54efde Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Mon, 21 Jul 2014 15:35:46 -0500 +Date: Thu, 27 Nov 2014 21:07:38 -0800 Subject: [PATCH] POM changes diff --git a/pom.xml b/pom.xml -index 0c9f243..8bf91d1 100644 +index 072f84d..c0616db 100644 --- a/pom.xml +++ b/pom.xml @@ -1,18 +1,18 @@ @@ -15,11 +15,11 @@ index 0c9f243..8bf91d1 100644 - spigot-api + org.github.paperspigot + paperspigot-api - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - Spigot-API - http://www.spigotmc.org + PaperSpigot-API -+ https://github.com/PaperSpigot/Spigot ++ >https://github.com/PaperSpigot/Paper UTF-8 diff --git a/Spigot-API-Patches/0004-Player-affects-spawning-API.patch b/Spigot-API-Patches/0004-Player-affects-spawning-API.patch index bf7dd4bb72..65e2bcba21 100644 --- a/Spigot-API-Patches/0004-Player-affects-spawning-API.patch +++ b/Spigot-API-Patches/0004-Player-affects-spawning-API.patch @@ -1,14 +1,14 @@ -From fbc8ea64960e2ed633cbe1a82bec8434028cff9b Mon Sep 17 00:00:00 2001 +From 782378e964c0df175a8bb46055b1d0e63fbf3dfb Mon Sep 17 00:00:00 2001 From: Jedediah Smith Date: Fri, 8 Aug 2014 22:51:26 -0500 Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 75ccf08..a780abc 100644 +index b2ad5b7..b2a8e2e 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1113,6 +1113,28 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline +@@ -1102,6 +1102,28 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline { throw new UnsupportedOperationException( "Not supported yet." ); } diff --git a/Spigot-API-Patches/0005-Add-getTPS-method.patch b/Spigot-API-Patches/0005-Add-getTPS-method.patch index 05661846f2..9384b8f93e 100644 --- a/Spigot-API-Patches/0005-Add-getTPS-method.patch +++ b/Spigot-API-Patches/0005-Add-getTPS-method.patch @@ -1,14 +1,14 @@ -From 9ad95be7f945f498bd4a58c63ffc4d3c2d7c8e73 Mon Sep 17 00:00:00 2001 +From eae88541a7dfe4f66682ac973b0e301916a26739 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 19 Oct 2014 18:22:18 -0500 Subject: [PATCH] Add getTPS method diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 199060d..560364e 100644 +index f861214..8d3865b 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -926,6 +926,13 @@ public interface Server extends PluginMessageRecipient { +@@ -915,6 +915,13 @@ public interface Server extends PluginMessageRecipient { { throw new UnsupportedOperationException( "Not supported yet." ); } diff --git a/Spigot-Server-Patches/0001-POM-changes.patch b/Spigot-Server-Patches/0001-POM-changes.patch index df79eb8b24..b8d6aadc28 100644 --- a/Spigot-Server-Patches/0001-POM-changes.patch +++ b/Spigot-Server-Patches/0001-POM-changes.patch @@ -1,11 +1,11 @@ -From 782c21dd59776700f5dec8b4c5f268171b33c757 Mon Sep 17 00:00:00 2001 +From ef69e326d930564b7c45cd34a9d583e3dcf25744 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Mon, 21 Jul 2014 15:36:01 -0500 +Date: Thu, 27 Nov 2014 22:43:08 -0800 Subject: [PATCH] POM changes diff --git a/pom.xml b/pom.xml -index 0d00e79..58a7b1b 100644 +index 64600fb..fc72aa1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,12 @@ @@ -17,11 +17,11 @@ index 0d00e79..58a7b1b 100644 + org.github.paperspigot + paperspigot jar - 1.7.10-R0.1-SNAPSHOT + 1.8-R0.1-SNAPSHOT - Spigot - http://www.spigotmc.org + PaperSpigot -+ https://github.com/PaperSpigot/Spigot ++ https://github.com/PaperSpigot/Paper UTF-8 @@ -36,7 +36,7 @@ index 0d00e79..58a7b1b 100644 dev-SNAPSHOT ../pom.xml -@@ -41,14 +41,14 @@ +@@ -41,8 +41,8 @@ @@ -47,14 +47,7 @@ index 0d00e79..58a7b1b 100644 ${project.version} jar compile - - -- org.spigotmc -+ org.github.paperspigot - minecraft-server - ${minecraft.version}-SNAPSHOT - jar -@@ -119,7 +119,7 @@ +@@ -146,7 +146,7 @@ gitdescribe-maven-plugin 1.3 diff --git a/Spigot-Server-Patches/0002-PaperSpigot-config-files.patch b/Spigot-Server-Patches/0002-PaperSpigot-config-files.patch index 3be4e2faa8..c87c78e3a5 100644 --- a/Spigot-Server-Patches/0002-PaperSpigot-config-files.patch +++ b/Spigot-Server-Patches/0002-PaperSpigot-config-files.patch @@ -1,11 +1,11 @@ -From da7e53caceb34fb4e99f9363c281696e8e668625 Mon Sep 17 00:00:00 2001 +From b98a3a7904fb5a8a3f341e113319631d4bcd2624 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 12 Jul 2014 19:32:01 -0500 Subject: [PATCH] PaperSpigot config files diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 9cc0526..e9a1a67 100644 +index 2806f1e..2e38fec 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -131,6 +131,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -15,43 +15,44 @@ index 9cc0526..e9a1a67 100644 + // PaperSpigot start + org.github.paperspigot.PaperSpigotConfig.init(); + org.github.paperspigot.PaperSpigotConfig.registerCommands(); -+ // PaperSpigot stop ++ // PaperSpigot end - i.info("Generating keypair"); + DedicatedServer.LOGGER.info("Generating keypair"); this.a(MinecraftEncryption.b()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7a547da..a6ef3b6 100644 +index e6250e1..516447e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -197,6 +197,7 @@ public abstract class World implements IBlockAccess { - public boolean keepSpawnInMemory = true; - public ChunkGenerator generator; - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot -+ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot +@@ -179,6 +179,8 @@ public abstract class World implements IBlockAccess { + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + ++ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot ++ public final SpigotTimings.WorldTimingsHandler timings; // Spigot -@@ -215,6 +216,7 @@ public abstract class World implements IBlockAccess { - // 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.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( s ); // PaperSpigot + public CraftWorld getWorld() { +@@ -195,6 +197,7 @@ public abstract class World implements IBlockAccess { + + protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot ++ this.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( worlddata.getName() ); // PaperSpigot 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 10621b3..1548042 100644 +index fcb22d9..239cbd7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -814,6 +814,7 @@ public final class CraftServer implements Server { +@@ -689,6 +689,7 @@ public final class CraftServer implements Server { } org.spigotmc.SpigotConfig.init(); // Spigot + org.github.paperspigot.PaperSpigotConfig.init(); // PaperSpigot for (WorldServer world : console.worlds) { - world.difficulty = difficulty; + world.worldData.setDifficulty(difficulty); world.setSpawnFlags(monsters, animals); -@@ -829,12 +830,14 @@ public final class CraftServer implements Server { +@@ -704,12 +705,14 @@ public final class CraftServer implements Server { world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns(); } world.spigotConfig.init(); // Spigot diff --git a/Spigot-Server-Patches/0003-mc-dev-imports.patch b/Spigot-Server-Patches/0003-mc-dev-imports.patch index 657da2dc35..0ce84d0a4b 100644 --- a/Spigot-Server-Patches/0003-mc-dev-imports.patch +++ b/Spigot-Server-Patches/0003-mc-dev-imports.patch @@ -1,29 +1,29 @@ -From cbbd2417d3fda9052696daf507161a57a90c8465 Mon Sep 17 00:00:00 2001 +From 49b5ab870fb9264549c00c2ecda33ac7affdfb13 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 22 Jul 2014 21:05:53 -0500 +Date: Thu, 27 Nov 2014 23:53:56 -0600 Subject: [PATCH] mc-dev imports diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java new file mode 100644 -index 0000000..d36aacb +index 0000000..063177d --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -@@ -0,0 +1,145 @@ +@@ -0,0 +1,120 @@ +package net.minecraft.server; + -+import java.util.Random; -+ +public abstract class BlockMinecartTrackAbstract extends Block { + + protected final boolean a; + -+ public static final boolean b_(World world, int i, int j, int k) { -+ return a(world.getType(i, j, k)); ++ public static boolean d(World world, BlockPosition blockposition) { ++ return d(world.getType(blockposition)); + } + -+ public static final boolean a(Block block) { -+ return block == Blocks.RAILS || block == Blocks.GOLDEN_RAIL || block == Blocks.DETECTOR_RAIL || block == Blocks.ACTIVATOR_RAIL; ++ public static boolean d(IBlockData iblockdata) { ++ Block block = iblockdata.getBlock(); ++ ++ return block == Blocks.RAIL || block == Blocks.GOLDEN_RAIL || block == Blocks.DETECTOR_RAIL || block == Blocks.ACTIVATOR_RAIL; + } + + protected BlockMinecartTrackAbstract(boolean flag) { @@ -33,11 +33,7 @@ index 0000000..d36aacb + this.a(CreativeModeTab.e); + } + -+ public boolean e() { -+ return this.a; -+ } -+ -+ public AxisAlignedBB a(World world, int i, int j, int k) { ++ public AxisAlignedBB a(World world, BlockPosition blockposition, IBlockData iblockdata) { + return null; + } + @@ -45,292 +41,98 @@ index 0000000..d36aacb + return false; + } + -+ public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { -+ this.updateShape(world, i, j, k); -+ return super.a(world, i, j, k, vec3d, vec3d1); ++ public MovingObjectPosition a(World world, BlockPosition blockposition, Vec3D vec3d, Vec3D vec3d1) { ++ this.updateShape(world, blockposition); ++ return super.a(world, blockposition, vec3d, vec3d1); + } + -+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { -+ int l = iblockaccess.getData(i, j, k); ++ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ IBlockData iblockdata = iblockaccess.getType(blockposition); ++ EnumTrackPosition enumtrackposition = iblockdata.getBlock() == this ? (EnumTrackPosition) iblockdata.get(this.l()) : null; + -+ if (l >= 2 && l <= 5) { ++ if (enumtrackposition != null && enumtrackposition.c()) { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); + } else { + this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } ++ + } + + public boolean d() { + return false; + } + -+ public int b() { -+ return 9; ++ public boolean canPlace(World world, BlockPosition blockposition) { ++ return World.a((IBlockAccess) world, blockposition.down()); + } + -+ public int a(Random random) { -+ return 1; -+ } -+ -+ public boolean canPlace(World world, int i, int j, int k) { -+ return World.a((IBlockAccess) world, i, j - 1, k); -+ } -+ -+ public void onPlace(World world, int i, int j, int k) { ++ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { + if (!world.isStatic) { -+ this.a(world, i, j, k, true); ++ iblockdata = this.a(world, blockposition, iblockdata, true); + if (this.a) { -+ this.doPhysics(world, i, j, k, this); ++ this.doPhysics(world, blockposition, iblockdata, this); + } + } ++ + } + -+ public void doPhysics(World world, int i, int j, int k, Block block) { ++ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { + if (!world.isStatic) { -+ int l = world.getData(i, j, k); -+ int i1 = l; -+ -+ if (this.a) { -+ i1 = l & 7; -+ } -+ ++ EnumTrackPosition enumtrackposition = (EnumTrackPosition) iblockdata.get(this.l()); + boolean flag = false; + -+ if (!World.a((IBlockAccess) world, i, j - 1, k)) { ++ if (!World.a((IBlockAccess) world, blockposition.down())) { + flag = true; + } + -+ if (i1 == 2 && !World.a((IBlockAccess) world, i + 1, j, k)) { ++ if (enumtrackposition == EnumTrackPosition.ASCENDING_EAST && !World.a((IBlockAccess) world, blockposition.east())) { + flag = true; -+ } -+ -+ if (i1 == 3 && !World.a((IBlockAccess) world, i - 1, j, k)) { ++ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_WEST && !World.a((IBlockAccess) world, blockposition.west())) { + flag = true; -+ } -+ -+ if (i1 == 4 && !World.a((IBlockAccess) world, i, j, k - 1)) { ++ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_NORTH && !World.a((IBlockAccess) world, blockposition.north())) { + flag = true; -+ } -+ -+ if (i1 == 5 && !World.a((IBlockAccess) world, i, j, k + 1)) { ++ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_SOUTH && !World.a((IBlockAccess) world, blockposition.south())) { + flag = true; + } + + if (flag) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); ++ this.b(world, blockposition, iblockdata, 0); ++ world.setAir(blockposition); + } else { -+ this.a(world, i, j, k, l, i1, block); ++ this.b(world, blockposition, iblockdata, block); + } ++ + } + } + -+ protected void a(World world, int i, int j, int k, int l, int i1, Block block) {} ++ protected void b(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {} + -+ protected void a(World world, int i, int j, int k, boolean flag) { -+ if (!world.isStatic) { -+ (new MinecartTrackLogic(this, world, i, j, k)).a(world.isBlockIndirectlyPowered(i, j, k), flag); -+ } ++ protected IBlockData a(World world, BlockPosition blockposition, IBlockData iblockdata, boolean flag) { ++ return world.isStatic ? iblockdata : (new MinecartTrackLogic(this, world, blockposition, iblockdata)).a(world.isBlockIndirectlyPowered(blockposition), flag).b(); + } + -+ public int h() { ++ public int i() { + return 0; + } + -+ public void remove(World world, int i, int j, int k, Block block, int l) { -+ int i1 = l; -+ -+ if (this.a) { -+ i1 = l & 7; -+ } -+ -+ super.remove(world, i, j, k, block, l); -+ if (i1 == 2 || i1 == 3 || i1 == 4 || i1 == 5) { -+ world.applyPhysics(i, j + 1, k, block); ++ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ super.remove(world, blockposition, iblockdata); ++ if (((EnumTrackPosition) iblockdata.get(this.l())).c()) { ++ world.applyPhysics(blockposition.up(), this); + } + + if (this.a) { -+ world.applyPhysics(i, j, k, block); -+ world.applyPhysics(i, j - 1, k, block); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/BlockTorch.java b/src/main/java/net/minecraft/server/BlockTorch.java -new file mode 100644 -index 0000000..d95aff2 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BlockTorch.java -@@ -0,0 +1,167 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class BlockTorch extends Block { -+ -+ protected BlockTorch() { -+ super(Material.ORIENTABLE); -+ this.a(true); -+ this.a(CreativeModeTab.c); -+ } -+ -+ public AxisAlignedBB a(World world, int i, int j, int k) { -+ return null; -+ } -+ -+ public boolean c() { -+ return false; -+ } -+ -+ public boolean d() { -+ return false; -+ } -+ -+ public int b() { -+ return 2; -+ } -+ -+ private boolean m(World world, int i, int j, int k) { -+ if (World.a((IBlockAccess) world, i, j, k)) { -+ return true; -+ } else { -+ Block block = world.getType(i, j, k); -+ -+ return block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL; -+ } -+ } -+ -+ public boolean canPlace(World world, int i, int j, int k) { -+ return world.c(i - 1, j, k, true) ? true : (world.c(i + 1, j, k, true) ? true : (world.c(i, j, k - 1, true) ? true : (world.c(i, j, k + 1, true) ? true : this.m(world, i, j - 1, k)))); -+ } -+ -+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) { -+ int j1 = i1; -+ -+ if (l == 1 && this.m(world, i, j - 1, k)) { -+ j1 = 5; ++ world.applyPhysics(blockposition, this); ++ world.applyPhysics(blockposition.down(), this); + } + -+ if (l == 2 && world.c(i, j, k + 1, true)) { -+ j1 = 4; -+ } -+ -+ if (l == 3 && world.c(i, j, k - 1, true)) { -+ j1 = 3; -+ } -+ -+ if (l == 4 && world.c(i + 1, j, k, true)) { -+ j1 = 2; -+ } -+ -+ if (l == 5 && world.c(i - 1, j, k, true)) { -+ j1 = 1; -+ } -+ -+ return j1; + } + -+ public void a(World world, int i, int j, int k, Random random) { -+ super.a(world, i, j, k, random); -+ if (world.getData(i, j, k) == 0) { -+ this.onPlace(world, i, j, k); -+ } -+ } -+ -+ public void onPlace(World world, int i, int j, int k) { -+ if (world.getData(i, j, k) == 0) { -+ if (world.c(i - 1, j, k, true)) { -+ world.setData(i, j, k, 1, 2); -+ } else if (world.c(i + 1, j, k, true)) { -+ world.setData(i, j, k, 2, 2); -+ } else if (world.c(i, j, k - 1, true)) { -+ world.setData(i, j, k, 3, 2); -+ } else if (world.c(i, j, k + 1, true)) { -+ world.setData(i, j, k, 4, 2); -+ } else if (this.m(world, i, j - 1, k)) { -+ world.setData(i, j, k, 5, 2); -+ } -+ } -+ -+ this.e(world, i, j, k); -+ } -+ -+ public void doPhysics(World world, int i, int j, int k, Block block) { -+ this.b(world, i, j, k, block); -+ } -+ -+ protected boolean b(World world, int i, int j, int k, Block block) { -+ if (this.e(world, i, j, k)) { -+ int l = world.getData(i, j, k); -+ boolean flag = false; -+ -+ if (!world.c(i - 1, j, k, true) && l == 1) { -+ flag = true; -+ } -+ -+ if (!world.c(i + 1, j, k, true) && l == 2) { -+ flag = true; -+ } -+ -+ if (!world.c(i, j, k - 1, true) && l == 3) { -+ flag = true; -+ } -+ -+ if (!world.c(i, j, k + 1, true) && l == 4) { -+ flag = true; -+ } -+ -+ if (!this.m(world, i, j - 1, k) && l == 5) { -+ flag = true; -+ } -+ -+ if (flag) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); -+ return true; -+ } else { -+ return false; -+ } -+ } else { -+ return true; -+ } -+ } -+ -+ protected boolean e(World world, int i, int j, int k) { -+ if (!this.canPlace(world, i, j, k)) { -+ if (world.getType(i, j, k) == this) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); -+ } -+ -+ return false; -+ } else { -+ return true; -+ } -+ } -+ -+ public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { -+ int l = world.getData(i, j, k) & 7; -+ float f = 0.15F; -+ -+ if (l == 1) { -+ this.a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); -+ } else if (l == 2) { -+ this.a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); -+ } else if (l == 3) { -+ this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); -+ } else if (l == 4) { -+ this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); -+ } else { -+ f = 0.1F; -+ this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); -+ } -+ -+ return super.a(world, i, j, k, vec3d, vec3d1); -+ } ++ public abstract IBlockState l(); +} diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java new file mode 100644 -index 0000000..3eb029d +index 0000000..620685a --- /dev/null +++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java @@ -0,0 +1,12 @@ @@ -338,132 +140,54 @@ index 0000000..3eb029d + +public class MobEffectAttackDamage extends MobEffectList { + -+ protected MobEffectAttackDamage(int i, boolean flag, int j) { -+ super(i, flag, j); ++ protected MobEffectAttackDamage(int i, MinecraftKey minecraftkey, boolean flag, int j) { ++ super(i, minecraftkey, flag, j); + } + + public double a(int i, AttributeModifier attributemodifier) { + return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1); + } +} -diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -new file mode 100644 -index 0000000..9342a3f ---- /dev/null -+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -@@ -0,0 +1,74 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+public class RandomPositionGenerator { -+ -+ private static Vec3D a = Vec3D.a(0.0D, 0.0D, 0.0D); -+ -+ public static Vec3D a(EntityCreature entitycreature, int i, int j) { -+ return c(entitycreature, i, j, (Vec3D) null); -+ } -+ -+ public static Vec3D a(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { -+ a.a = vec3d.a - entitycreature.locX; -+ a.b = vec3d.b - entitycreature.locY; -+ a.c = vec3d.c - entitycreature.locZ; -+ return c(entitycreature, i, j, a); -+ } -+ -+ public static Vec3D b(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { -+ a.a = entitycreature.locX - vec3d.a; -+ a.b = entitycreature.locY - vec3d.b; -+ a.c = entitycreature.locZ - vec3d.c; -+ return c(entitycreature, i, j, a); -+ } -+ -+ private static Vec3D c(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { -+ Random random = entitycreature.aI(); -+ boolean flag = false; -+ int k = 0; -+ int l = 0; -+ int i1 = 0; -+ float f = -99999.0F; -+ boolean flag1; -+ -+ if (entitycreature.bY()) { -+ double d0 = (double) (entitycreature.bV().e(MathHelper.floor(entitycreature.locX), MathHelper.floor(entitycreature.locY), MathHelper.floor(entitycreature.locZ)) + 4.0F); -+ double d1 = (double) (entitycreature.bW() + (float) i); -+ -+ flag1 = d0 < d1 * d1; -+ } else { -+ flag1 = false; -+ } -+ -+ for (int j1 = 0; j1 < 10; ++j1) { -+ int k1 = random.nextInt(2 * i) - i; -+ int l1 = random.nextInt(2 * j) - j; -+ int i2 = random.nextInt(2 * i) - i; -+ -+ if (vec3d == null || (double) k1 * vec3d.a + (double) i2 * vec3d.c >= 0.0D) { -+ k1 += MathHelper.floor(entitycreature.locX); -+ l1 += MathHelper.floor(entitycreature.locY); -+ i2 += MathHelper.floor(entitycreature.locZ); -+ if (!flag1 || entitycreature.b(k1, l1, i2)) { -+ float f1 = entitycreature.a(k1, l1, i2); -+ -+ if (f1 > f) { -+ f = f1; -+ k = k1; -+ l = l1; -+ i1 = i2; -+ flag = true; -+ } -+ } -+ } -+ } -+ -+ if (flag) { -+ return Vec3D.a((double) k, (double) l, (double) i1); -+ } else { -+ return null; -+ } -+ } -+} diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java new file mode 100644 -index 0000000..b205ab7 +index 0000000..794cdc8 --- /dev/null +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -0,0 +1,84 @@ +@@ -0,0 +1,87 @@ +package net.minecraft.server; + -+public class TileEntityEnderChest extends TileEntity { ++public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox { + + public float a; -+ public float i; -+ public int j; -+ private int k; ++ public float f; ++ public int g; ++ private int h; + + public TileEntityEnderChest() {} + -+ public void h() { -+ super.h(); -+ if (++this.k % 20 * 4 == 0) { -+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); ++ public void c() { ++ if (++this.h % 20 * 4 == 0) { ++ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + -+ this.i = this.a; ++ this.f = this.a; ++ int i = this.position.getX(); ++ int j = this.position.getY(); ++ int k = this.position.getZ(); + float f = 0.1F; + double d0; + -+ if (this.j > 0 && this.a == 0.0F) { -+ double d1 = (double) this.x + 0.5D; ++ if (this.g > 0 && this.a == 0.0F) { ++ double d1 = (double) i + 0.5D; + -+ d0 = (double) this.z + 0.5D; -+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ d0 = (double) k + 0.5D; ++ this.world.makeSound(d1, (double) j + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } + -+ if (this.j == 0 && this.a > 0.0F || this.j > 0 && this.a < 1.0F) { ++ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { + float f1 = this.a; + -+ if (this.j > 0) { ++ if (this.g > 0) { + this.a += f; + } else { + this.a -= f; @@ -476,65 +200,67 @@ index 0000000..b205ab7 + float f2 = 0.5F; + + if (this.a < f2 && f1 >= f2) { -+ d0 = (double) this.x + 0.5D; -+ double d2 = (double) this.z + 0.5D; ++ d0 = (double) i + 0.5D; ++ double d2 = (double) k + 0.5D; + -+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ this.world.makeSound(d0, (double) j + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } + + if (this.a < 0.0F) { + this.a = 0.0F; + } + } ++ + } + + public boolean c(int i, int j) { + if (i == 1) { -+ this.j = j; ++ this.g = j; + return true; + } else { + return super.c(i, j); + } + } + -+ public void s() { -+ this.u(); -+ super.s(); -+ } -+ -+ public void a() { -+ ++this.j; -+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); ++ public void y() { ++ this.E(); ++ super.y(); + } + + public void b() { -+ --this.j; -+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); ++ ++this.g; ++ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); ++ } ++ ++ public void d() { ++ --this.g; ++ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + + public boolean a(EntityHuman entityhuman) { -+ return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D; ++ return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D; + } +} diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java new file mode 100644 -index 0000000..143cffb +index 0000000..7b6f8ae --- /dev/null +++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java -@@ -0,0 +1,15 @@ +@@ -0,0 +1,16 @@ +package net.minecraft.server; + -+public class TileEntityLightDetector extends TileEntity { ++public class TileEntityLightDetector extends TileEntity implements IUpdatePlayerListBox { + + public TileEntityLightDetector() {} + -+ public void h() { ++ public void c() { + if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) { -+ this.h = this.q(); -+ if (this.h instanceof BlockDaylightDetector) { -+ ((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z); ++ this.e = this.w(); ++ if (this.e instanceof BlockDaylightDetector) { ++ ((BlockDaylightDetector) this.e).d(this.world, this.position); + } + } ++ + } +} -- diff --git a/Spigot-Server-Patches/0004-Allow-undead-horse-types-to-be-leashed.patch b/Spigot-Server-Patches/0004-Allow-undead-horse-types-to-be-leashed.patch index 27239956f2..85a06ada12 100644 --- a/Spigot-Server-Patches/0004-Allow-undead-horse-types-to-be-leashed.patch +++ b/Spigot-Server-Patches/0004-Allow-undead-horse-types-to-be-leashed.patch @@ -1,28 +1,28 @@ -From b802cfc9eb7d1f6ec5fe1d52e2e460f53bfcb5be Mon Sep 17 00:00:00 2001 +From c09702cef82655997b7ace1787a8ee295b1f7211 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 5 Aug 2014 16:10:44 -0500 +Date: Fri, 28 Nov 2014 00:08:37 -0600 Subject: [PATCH] Allow undead horse types to be leashed diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java -index e9f6236..ec43573 100644 +index 50e9292..0bcf8c9 100644 --- a/src/main/java/net/minecraft/server/EntityHorse.java +++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -169,7 +169,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { +@@ -173,7 +173,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } - public boolean bM() { -- return !this.cE() && super.bM(); + public boolean ca() { +- return !this.cP() && super.ca(); + // PaperSpigot start - Configurable undead horse leashing + if (this.world.paperSpigotConfig.allowUndeadHorseLeashing) { -+ return super.bM(); ++ return super.ca(); + } else { -+ return !this.cE() && super.bM(); ++ return !this.cP() && super.ca(); + } + // PaperSpigot end } - protected void o(float f) { + protected void n(float f) { diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index f3bc3aa..b9d1afe 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch b/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch index bb28ef279a..0810ac53b1 100644 --- a/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch +++ b/Spigot-Server-Patches/0005-Teleport-passenger-vehicle-with-player.patch @@ -1,29 +1,29 @@ -From 2e1e4619fd49a668fca9eabecbbc7f21d29b9af1 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 17 May 2014 02:12:39 -0500 +From d5d998345385422fa5f96941068f849fbaa69558 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Fri, 28 Nov 2014 00:24:18 -0600 Subject: [PATCH] Teleport passenger/vehicle with player diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index dea5e19..5dc7e95 100644 +index b0a90d7..1e5f057 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -38,6 +38,13 @@ public abstract class Entity { - static boolean isLevelAtLeast(NBTTagCompound tag, int level) { +@@ -40,6 +40,13 @@ public abstract class Entity implements ICommandListener { return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } -+ // PaperSpigot start + // CraftBukikt end ++ // PaperSpigot start - Teleport passenger vehicle with player + public void retrack() { + final EntityTracker entityTracker = ((WorldServer) world).getTracker(); + entityTracker.untrackEntity(this); + entityTracker.track(this); + } + // PaperSpigot end - // CraftBukkit end + private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); private static int entityCount; -@@ -1849,7 +1856,7 @@ public abstract class Entity { - // minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1); +@@ -1949,7 +1956,7 @@ public abstract class Entity implements ICommandListener { + // minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1); boolean before = worldserver1.chunkProviderServer.forceChunkLoad; worldserver1.chunkProviderServer.forceChunkLoad = true; - worldserver1.getMinecraftServer().getPlayerList().repositionEntity(this, exit, portal); @@ -31,22 +31,22 @@ index dea5e19..5dc7e95 100644 worldserver1.chunkProviderServer.forceChunkLoad = before; // CraftBukkit end this.world.methodProfiler.c("reloading"); -@@ -1857,6 +1864,10 @@ public abstract class Entity { +@@ -1957,6 +1964,10 @@ public abstract class Entity implements ICommandListener { if (entity != null) { - entity.a(this, true); + entity.n(this); + // PaperSpigot start - move entity to new location + exit.getBlock(); // force load + entity.setLocation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + // PaperSpigot end /* CraftBukkit start - We need to do this... if (j == 1 && i == 1) { - ChunkCoordinates chunkcoordinates = worldserver1.getSpawn(); + BlockPosition blockposition = this.world.r(worldserver1.getSpawn()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 173166f..2c8d0a0 100644 +index 5864a51..2d4398e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -492,6 +492,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -453,6 +453,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // If this player is riding another entity, we must dismount before teleporting. entity.mount(null); @@ -58,7 +58,7 @@ index 173166f..2c8d0a0 100644 + vehicle.teleportTo(location, false); + vehicle = vehicle.getBukkitEntity().getHandle(); + entity.vehicle = vehicle; -+ vehicle.passenger = entity; ++ entity.passenger = entity; + } + + if (passenger != null) { @@ -73,7 +73,7 @@ index 173166f..2c8d0a0 100644 // Update the From Location from = event.getFrom(); // Grab the new To Location dependent on whether the event was cancelled. -@@ -511,6 +531,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -472,6 +492,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } else { server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true); } @@ -81,12 +81,13 @@ index 173166f..2c8d0a0 100644 + // PaperSpigot start + if (vehicle != null) { + vehicle.retrack(); -+ //entity.retrack(); + } ++ + if (passenger != null) { + passenger.retrack(); + } + // PaperSpigot end ++ return true; } diff --git a/Spigot-Server-Patches/0006-Invisible-players-don-t-have-rights.patch b/Spigot-Server-Patches/0006-Invisible-players-don-t-have-rights.patch index 3580b1c8c0..40358c02b9 100644 --- a/Spigot-Server-Patches/0006-Invisible-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/0006-Invisible-players-don-t-have-rights.patch @@ -1,16 +1,16 @@ -From 2b64890ac075c7e7125b05ca2eb164c6736ad347 Mon Sep 17 00:00:00 2001 +From 7772412950502bba4c4f2b0ddb765ff274b554b6 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Mon, 21 Jul 2014 18:46:53 -0500 +Date: Fri, 28 Nov 2014 00:35:56 -0600 Subject: [PATCH] Invisible players don't have rights diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index de8dda7..dbb420b 100644 +index 7d1727d..d1c588a 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -220,6 +220,14 @@ public class EntityArrow extends Entity implements IProjectile { - float f2; +@@ -221,6 +221,14 @@ public class EntityArrow extends Entity implements IProjectile { float f3; + float f4; + // PaperSpigot start - Allow arrows to fly through players + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { @@ -22,12 +22,12 @@ index de8dda7..dbb420b 100644 + if (movingobjectposition != null) { org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event - + diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 7f8a33b..73f52ac 100644 +index ce3e628..7fc9abe 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java -@@ -148,6 +148,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile { +@@ -146,6 +146,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile { } } @@ -40,16 +40,16 @@ index 7f8a33b..73f52ac 100644 + // PaperSpigot end + if (movingobjectposition != null) { - if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d) == Blocks.PORTAL) { - this.ah(); + if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) { + this.aq(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a6ef3b6..7281b59 100644 +index 516447e..1537d76 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1683,6 +1683,13 @@ public abstract class World implements IBlockAccess { - +@@ -1641,6 +1641,14 @@ public abstract class World implements IBlockAccess { for (int i = 0; i < list.size(); ++i) { Entity entity1 = (Entity) list.get(i); + + // PaperSpigot start - Allow block placement if the placer cannot see the blocker + if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) { + if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) { @@ -57,9 +57,10 @@ index a6ef3b6..7281b59 100644 + } + } + // PaperSpigot end - - if (!entity1.dead && entity1.k && entity1 != entity) { ++ + if (!entity1.dead && entity1.k && entity1 != entity && (entity == null || entity.vehicle != entity1 && entity.passenger != entity1)) { return false; + } -- 1.9.1 diff --git a/Spigot-Server-Patches/0007-Configurable-squid-spawn-ranges.patch b/Spigot-Server-Patches/0007-Configurable-squid-spawn-ranges.patch index b05342a585..e072b52d32 100644 --- a/Spigot-Server-Patches/0007-Configurable-squid-spawn-ranges.patch +++ b/Spigot-Server-Patches/0007-Configurable-squid-spawn-ranges.patch @@ -1,22 +1,23 @@ -From 2eaa0b4e142f591ab7c320f0ff3a96c4f406cd38 Mon Sep 17 00:00:00 2001 +From 0979615299c39e333904637e88ad927d38b8e978 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 5 Aug 2014 16:17:15 -0500 +Date: Fri, 28 Nov 2014 00:41:04 -0600 Subject: [PATCH] Configurable squid spawn ranges diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 6e6d612..bf95300 100644 +index ee93dfe..0868017 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java -@@ -146,6 +146,7 @@ public class EntitySquid extends EntityWaterAnimal { +@@ -145,7 +145,8 @@ public class EntitySquid extends EntityWaterAnimal { } - public boolean canSpawn() { -- return this.locY > 45.0D && this.locY < 63.0D && super.canSpawn(); -+ // PaperSpigot - Configurable squid spawn height range -+ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < this.world.paperSpigotConfig.squidMaxSpawnHeight && super.canSpawn(); + public boolean bQ() { +- return this.locY > 45.0D && this.locY < 63.0D && super.bQ(); ++ // PaperSpigot - Configurable squid spawn range ++ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < this.world.paperSpigotConfig.squidMaxSpawnHeight && super.bQ(); } - } + + public void b(float f, float f1, float f2) { diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index b9d1afe..f6b0349 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch b/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch index c98b3ca5a2..0885ab37cd 100644 --- a/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch +++ b/Spigot-Server-Patches/0008-Configurable-damage-multiplier-for-PvP-blocking.patch @@ -1,16 +1,16 @@ -From 3e2e1768b7a5673c56438b14adff27392fa82f1c Mon Sep 17 00:00:00 2001 +From 55ffa201465306efe4167240fe27b0d1f960f2aa Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 5 Aug 2014 16:21:03 -0500 +Date: Fri, 28 Nov 2014 00:45:14 -0600 Subject: [PATCH] Configurable damage multiplier for PvP blocking diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 5bb7295..a0e4855 100644 +index 4ef5e01..b382854 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -826,7 +826,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -860,7 +860,7 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end - if (!this.isInvulnerable()) { + if (!this.isInvulnerable(damagesource)) { if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) { - f = (1.0F + f) * 0.5F; + f = (1.0F + f) * this.world.paperSpigotConfig.playerBlockingDamageMultiplier; // PaperSpigot - Configurable damage multiplier for blocking diff --git a/Spigot-Server-Patches/0009-Configurable-cactus-and-reed-natural-growth-heights.patch b/Spigot-Server-Patches/0009-Configurable-cactus-and-reed-natural-growth-heights.patch index 24d4fd9a67..2afeb31736 100644 --- a/Spigot-Server-Patches/0009-Configurable-cactus-and-reed-natural-growth-heights.patch +++ b/Spigot-Server-Patches/0009-Configurable-cactus-and-reed-natural-growth-heights.patch @@ -1,35 +1,35 @@ -From ca1ba942144325966ed83e1efb00be333659b135 Mon Sep 17 00:00:00 2001 +From aa6691415c68a0965b149456f31680ae26e5e56b Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 5 Aug 2014 16:26:30 -0500 +Date: Fri, 28 Nov 2014 00:55:17 -0600 Subject: [PATCH] Configurable cactus and reed natural growth heights diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index f55e531..e2e41b9 100644 +index 8569204..26cb10e 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -20,7 +20,7 @@ public class BlockCactus extends Block { +@@ -26,7 +26,7 @@ public class BlockCactus extends Block { ; } -- if (l < 3) { -+ if (l < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks - int i1 = world.getData(i, j, k); +- if (i < 3) { ++ if (i < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks + int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot + if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index 6c04ad2..0fa3349 100644 +index 11631da..33806da 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -21,7 +21,7 @@ public class BlockReed extends Block { +@@ -25,7 +25,7 @@ public class BlockReed extends Block { ; } -- if (l < 3) { -+ if (l < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks - int i1 = world.getData(i, j, k); +- if (i < 3) { ++ if (i < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks + int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); - if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot + if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java index 5cda463..0878ea7 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java diff --git a/Spigot-Server-Patches/0010-Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/0010-Configurable-baby-zombie-movement-speed.patch index feed2aa730..4fa918c53e 100644 --- a/Spigot-Server-Patches/0010-Configurable-baby-zombie-movement-speed.patch +++ b/Spigot-Server-Patches/0010-Configurable-baby-zombie-movement-speed.patch @@ -1,23 +1,23 @@ -From 0b2f0d7f6919abe5727ca0e0e52301664183e237 Mon Sep 17 00:00:00 2001 +From 3678c7ac6071f4c97d0efd7dab6f6c071ac1f4f4 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 5 Aug 2014 17:18:23 -0500 +Date: Fri, 28 Nov 2014 01:01:51 -0600 Subject: [PATCH] Configurable baby zombie movement speed diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index f732579..41e59ba 100644 +index d50ddd4..418c6da 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -17,7 +17,8 @@ public class EntityZombie extends EntityMonster { +@@ -16,7 +16,8 @@ public class EntityZombie extends EntityMonster { - protected static final IAttribute bp = (new AttributeRanged("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); - private static final UUID bq = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); -- private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", 0.5D, 1); + protected static final IAttribute b = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); + private static final UUID c = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); +- private static final AttributeModifier bk = new AttributeModifier(EntityZombie.c, "Baby speed boost", 0.5D, 1); + // PaperSpigot - Configurable baby zombie movement speed -+ private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); - private final PathfinderGoalBreakDoor bs = new PathfinderGoalBreakDoor(this); - private int bt; - private boolean bu = false; ++ private static final AttributeModifier bk = new AttributeModifier(EntityZombie.c, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); + private final PathfinderGoalBreakDoor bl = new PathfinderGoalBreakDoor(this); + private int bm; + private boolean bn = false; diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java index 7ea1617..f4acbb3 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java diff --git a/Spigot-Server-Patches/0013-Ability-to-disable-asynccatcher.patch b/Spigot-Server-Patches/0011-Ability-to-disable-asynccatcher.patch similarity index 100% rename from Spigot-Server-Patches/0013-Ability-to-disable-asynccatcher.patch rename to Spigot-Server-Patches/0011-Ability-to-disable-asynccatcher.patch diff --git a/Spigot-Server-Patches/0011-Inverted-Daylight-Detector-Toggle.patch b/Spigot-Server-Patches/0011-Inverted-Daylight-Detector-Toggle.patch deleted file mode 100644 index 4db9132e36..0000000000 --- a/Spigot-Server-Patches/0011-Inverted-Daylight-Detector-Toggle.patch +++ /dev/null @@ -1,64 +0,0 @@ -From c9b0f38fcb015f0c1b7e8fb73eb0c71f5ed31b61 Mon Sep 17 00:00:00 2001 -From: gsand -Date: Tue, 5 Aug 2014 17:31:07 -0500 -Subject: [PATCH] Inverted Daylight Detector Toggle - - -diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java -index 96e9c37..1298610 100644 ---- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java -+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java -@@ -38,14 +38,27 @@ public class BlockDaylightDetector extends BlockContainer { - f += (6.2831855F - f) * 0.2F; - } - -- i1 = Math.round((float) i1 * MathHelper.cos(f)); -- if (i1 < 0) { -- i1 = 0; -- } -- -- if (i1 > 15) { -- i1 = 15; -+ // PaperSpigot start - Configurable "inversion" for daylight detectors -+ if (world.paperSpigotConfig.invertedDaylightDetectors) { -+ i1 = Math.round((float) i1 * MathHelper.cos(f) * -1 + 15); -+ if (i1 < 10) { -+ i1 = 0; -+ } -+ -+ if (i1 > 9) { -+ i1 = 15; -+ } -+ } else { -+ i1 = Math.round((float) i1 * MathHelper.cos(f)); -+ if (i1 < 0) { -+ i1 = 0; -+ } -+ -+ if (i1 > 15) { -+ i1 = 15; -+ } - } -+ // PaperSpigot end - - if (l != i1) { - i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, i, j, k, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0878ea7..9cd9c6d 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -106,4 +106,11 @@ public class PaperSpigotWorldConfig - reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); - log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); - } -+ -+ public boolean invertedDaylightDetectors; -+ private void invertedDaylightDetectors() -+ { -+ invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false ); -+ log( "Inverted Redstone Lamps: " + invertedDaylightDetectors ); -+ } - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0012-Add-1.8-recipes-for-stone-variants.patch b/Spigot-Server-Patches/0012-Add-1.8-recipes-for-stone-variants.patch deleted file mode 100644 index 5b2678e8b8..0000000000 --- a/Spigot-Server-Patches/0012-Add-1.8-recipes-for-stone-variants.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 524020b85b36ea7e052ecb8a3d789d859b84660b Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 10 Jun 2014 18:22:19 -0500 -Subject: [PATCH] Add 1.8 recipes for stone variants - - -diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java -index 9675edb..e2fbdc4 100644 ---- a/src/main/java/net/minecraft/server/CraftingManager.java -+++ b/src/main/java/net/minecraft/server/CraftingManager.java -@@ -148,6 +148,11 @@ public class CraftingManager { - this.registerShapelessRecipe(new ItemStack(Items.FIREBALL, 3), new Object[] { Items.SULPHUR, Items.BLAZE_POWDER, new ItemStack(Items.COAL, 1, 1)}); - this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOOD_STEP}); - this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST}); -+ // PaperSpigot start - Register moss stone and mossy and chiseled stone brick recipes -+ this.registerShapelessRecipe(new ItemStack(Blocks.MOSSY_COBBLESTONE), new Object[] { Blocks.VINE, Blocks.COBBLESTONE}); -+ this.registerShapelessRecipe(new ItemStack(Blocks.SMOOTH_BRICK, 1, 1), new Object[] { Blocks.VINE, Blocks.SMOOTH_BRICK}); -+ this.registerShapelessRecipe(new ItemStack(Blocks.SMOOTH_BRICK, 1, 3), new Object[] { new ItemStack(Blocks.STEP, 1, 5), new ItemStack(Blocks.STEP, 1, 5)}); -+ // PaperSpigot end - // Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below - this.sort(); // CraftBukkit - call new sort method - } -diff --git a/src/main/java/net/minecraft/server/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java -index c474d54..23a1446 100644 ---- a/src/main/java/net/minecraft/server/RecipesFurnace.java -+++ b/src/main/java/net/minecraft/server/RecipesFurnace.java -@@ -33,6 +33,7 @@ public class RecipesFurnace { - this.registerRecipe(Blocks.EMERALD_ORE, new ItemStack(Items.EMERALD), 1.0F); - this.a(Items.POTATO, new ItemStack(Items.POTATO_BAKED), 0.35F); - this.registerRecipe(Blocks.NETHERRACK, new ItemStack(Items.NETHER_BRICK), 0.1F); -+ this.registerRecipe(Blocks.SMOOTH_BRICK, new ItemStack(Blocks.SMOOTH_BRICK, 1, 2), 0.5F); // PaperSpigot - Register cracked stone brick recipe - EnumFish[] aenumfish = EnumFish.values(); - int i = aenumfish.length; - --- -1.9.1 - diff --git a/Spigot-Server-Patches/0012-Fix-redstone-lag-issues.patch b/Spigot-Server-Patches/0012-Fix-redstone-lag-issues.patch new file mode 100644 index 0000000000..f16a333f0d --- /dev/null +++ b/Spigot-Server-Patches/0012-Fix-redstone-lag-issues.patch @@ -0,0 +1,32 @@ +From 722f697f6497f7b02193e4236d4fbfe935c04afd Mon Sep 17 00:00:00 2001 +From: Iceee +Date: Fri, 28 Nov 2014 01:21:27 -0600 +Subject: [PATCH] Fix redstone lag issues + + +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index ff9ac1b..de6ed7d 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -591,6 +591,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { + if (i != this.L.size()) { + throw new IllegalStateException("TickNextTick list out of synch"); + } else { ++ // PaperSpigot start - Fix redstone lag issues ++ /* + if (i > 1000) { + // CraftBukkit start - If the server has too much to process over time, try to alleviate that + if (i > 20 * 1000) { +@@ -599,7 +601,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { + i = 1000; + } + // CraftBukkit end +- } ++ } */ ++ // PaperSpigot end + + this.methodProfiler.a("cleaning"); + +-- +1.9.1 + diff --git a/Spigot-Server-Patches/0015-Do-not-remove-player-in-world-change.patch b/Spigot-Server-Patches/0013-Do-not-remove-player-in-world-change.patch similarity index 51% rename from Spigot-Server-Patches/0015-Do-not-remove-player-in-world-change.patch rename to Spigot-Server-Patches/0013-Do-not-remove-player-in-world-change.patch index 057fc8480e..29d275a534 100644 --- a/Spigot-Server-Patches/0015-Do-not-remove-player-in-world-change.patch +++ b/Spigot-Server-Patches/0013-Do-not-remove-player-in-world-change.patch @@ -1,31 +1,31 @@ -From 82f4ed7a6fe9063beefe686c260e01c703313633 Mon Sep 17 00:00:00 2001 +From e66b9b880bd800574dfc6bdf942ccef7af685313 Mon Sep 17 00:00:00 2001 From: T00thpick1 -Date: Mon, 23 Jun 2014 21:37:24 -0500 +Date: Fri, 28 Nov 2014 01:25:45 -0600 Subject: [PATCH] Do not remove player in world change diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 8adf091..79fc999 100644 +index 26e4328..04d9be9 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -463,7 +463,7 @@ public abstract class PlayerList { - entityplayer.r().getTracker().untrackPlayer(entityplayer); - // entityplayer.r().getTracker().untrackEntity(entityplayer); // CraftBukkit - entityplayer.r().getPlayerChunkMap().removePlayer(entityplayer); +@@ -440,7 +440,7 @@ public abstract class PlayerList { + entityplayer.u().getTracker().untrackPlayer(entityplayer); + // entityplayer.u().getTracker().untrackEntity(entityplayer); // CraftBukkit + entityplayer.u().getPlayerChunkMap().removePlayer(entityplayer); - this.players.remove(entityplayer); -+ // this.players.remove(entityplayer); // PaperSpigot -- Fixes BUKKIT-4561 and BUKKIT-4082 and BUKKIT-2094 ++ // this.players.remove(entityplayer); // PaperSpigot - Fixes BUKKIT-4561, BUKKIT-4082, and BUKKIT-2094 this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer); - ChunkCoordinates chunkcoordinates = entityplayer.getBed(); + BlockPosition blockposition = entityplayer.getBed(); boolean flag1 = entityplayer.isRespawnForced(); -@@ -558,7 +558,7 @@ public abstract class PlayerList { +@@ -534,7 +534,7 @@ public abstract class PlayerList { if (!entityplayer.playerConnection.isDisconnected()) { worldserver.getPlayerChunkMap().addPlayer(entityplayer1); worldserver.addEntity(entityplayer1); - this.players.add(entityplayer1); -+ // this.players.add(entityplayer1); // PaperSpigot -- Fixes BUKKIT-4561 and BUKKIT-4082 and BUKKIT-2094 ++ //this.players.add(entityplayer1); // PaperSpigot - Fixes BUKKIT-4561, BUKKIT-4082, and BUKKIT-2094 + this.f.put(entityplayer1.getUniqueID(), entityplayer1); } // Added from changeDimension - this.updateClient(entityplayer1); // Update health, etc... -- 1.9.1 diff --git a/Spigot-Server-Patches/0016-Fix-directional-TNT-bias.patch b/Spigot-Server-Patches/0014-Fix-directional-TNT-bias.patch similarity index 88% rename from Spigot-Server-Patches/0016-Fix-directional-TNT-bias.patch rename to Spigot-Server-Patches/0014-Fix-directional-TNT-bias.patch index 6304094c83..b1dc721444 100644 --- a/Spigot-Server-Patches/0016-Fix-directional-TNT-bias.patch +++ b/Spigot-Server-Patches/0014-Fix-directional-TNT-bias.patch @@ -1,14 +1,14 @@ -From dd64547b4501439260882f51130504ecd449e651 Mon Sep 17 00:00:00 2001 +From 8d1a3aa8b453adcf1f354824229ef2245b015b9b Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 11 Jul 2014 03:54:06 -0500 Subject: [PATCH] Fix directional TNT bias diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 2214660..1f98f8d 100644 +index 3621faf..4823698 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -19,11 +19,11 @@ public class EntityTNTPrimed extends Entity { +@@ -18,11 +18,11 @@ public class EntityTNTPrimed extends Entity { public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) { this(world); this.setPosition(d0, d1, d2); diff --git a/Spigot-Server-Patches/0014-Fix-redstone-lag-issues.patch b/Spigot-Server-Patches/0014-Fix-redstone-lag-issues.patch deleted file mode 100644 index 769f153c77..0000000000 --- a/Spigot-Server-Patches/0014-Fix-redstone-lag-issues.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 4db0e372257fed81cb8d2d465a81efc04131d18f Mon Sep 17 00:00:00 2001 -From: Iceee -Date: Thu, 12 Jun 2014 13:37:35 -0500 -Subject: [PATCH] Fix redstone lag issues - - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 91f036b..e98d282 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -527,6 +527,7 @@ public class WorldServer extends World { - if (i != this.M.size()) { - throw new IllegalStateException("TickNextTick list out of synch"); - } else { -+ /* PaperSpigot start - Fix redstone lag issues - if (i > 1000) { - // CraftBukkit start - If the server has too much to process over time, try to alleviate that - if (i > 20 * 1000) { -@@ -535,7 +536,12 @@ public class WorldServer extends World { - i = 1000; - } - // CraftBukkit end -+ } */ -+ -+ if (i > 10000) { -+ i = 10000; - } -+ // PaperSpigot end - - this.methodProfiler.a("cleaning"); - --- -1.9.1 - diff --git a/Spigot-Server-Patches/0018-Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/0015-Configurable-fishing-time-ranges.patch similarity index 63% rename from Spigot-Server-Patches/0018-Configurable-fishing-time-ranges.patch rename to Spigot-Server-Patches/0015-Configurable-fishing-time-ranges.patch index 7e069c9804..e36e1c0b31 100644 --- a/Spigot-Server-Patches/0018-Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/0015-Configurable-fishing-time-ranges.patch @@ -1,30 +1,30 @@ -From 07dca9a9864ad7237634a4ca23ed229ea0ba5b5b Mon Sep 17 00:00:00 2001 +From e8658be06e362eaaad09d04aefeeab0c4754cbad Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 5 Aug 2014 17:49:02 -0500 +Date: Fri, 28 Nov 2014 01:29:35 -0600 Subject: [PATCH] Configurable fishing time ranges diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 9d4ea60..0fc1e85 100644 +index b1a6daf..e94c4c7 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -315,7 +315,8 @@ public class EntityFishingHook extends Entity { - this.az = MathHelper.nextInt(this.random, 20, 80); +@@ -324,7 +324,8 @@ public class EntityFishingHook extends Entity { + this.av = MathHelper.nextInt(this.random, 20, 80); } } else { -- this.ay = MathHelper.nextInt(this.random, 100, 900); +- this.au = MathHelper.nextInt(this.random, 100, 900); + // PaperSpigot - Configurable fishing tick range -+ this.ay = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks); - this.ay -= EnchantmentManager.getLureEnchantmentLevel(this.owner) * 20 * 5; ++ this.au = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks); + this.au -= EnchantmentManager.h(this.owner) * 20 * 5; } } diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 9cd9c6d..1d01f89 100644 +index 0878ea7..b67b856 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -113,4 +113,12 @@ public class PaperSpigotWorldConfig - invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false ); - log( "Inverted Redstone Lamps: " + invertedDaylightDetectors ); +@@ -106,4 +106,12 @@ public class PaperSpigotWorldConfig + reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); + log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); } + + public int fishingMinTicks; diff --git a/Spigot-Server-Patches/0019-Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/0016-Allow-nerfed-mobs-to-jump.patch similarity index 80% rename from Spigot-Server-Patches/0019-Allow-nerfed-mobs-to-jump.patch rename to Spigot-Server-Patches/0016-Allow-nerfed-mobs-to-jump.patch index 2f784e14d0..a52b5ad71a 100644 --- a/Spigot-Server-Patches/0019-Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/0016-Allow-nerfed-mobs-to-jump.patch @@ -1,14 +1,14 @@ -From 109aa46544af611045286e27a6653995eff5f58b Mon Sep 17 00:00:00 2001 +From b26b0d9d00ccc25cfbc39188d76b98cee220c713 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 29 Jun 2014 13:32:36 -0500 Subject: [PATCH] Allow nerfed mobs to jump diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index cf0c38f..deb04b5 100644 +index bc7f81e..39800e5 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -408,6 +408,12 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -454,6 +454,12 @@ public abstract class EntityInsentient extends EntityLiving { // Spigot Start if ( this.fromMobSpawner ) { @@ -16,7 +16,7 @@ index cf0c38f..deb04b5 100644 + this.world.methodProfiler.a("goalSelector"); + this.goalSelector.a(); + this.world.methodProfiler.c("jump"); -+ this.bm.b(); ++ this.g.b(); + // PaperSpigot end return; } diff --git a/Spigot-Server-Patches/0017-Fix-zombie-sieges-and-their-spawn-mechanics.patch b/Spigot-Server-Patches/0017-Fix-zombie-sieges-and-their-spawn-mechanics.patch deleted file mode 100644 index f54eb8752f..0000000000 --- a/Spigot-Server-Patches/0017-Fix-zombie-sieges-and-their-spawn-mechanics.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 9a0edbdf905d6b3068a5fff20af4522dac3d9301 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 24 Jun 2014 22:55:30 -0500 -Subject: [PATCH] Fix zombie sieges and their spawn mechanics - - -diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index 93e1a1e..549d390 100644 ---- a/src/main/java/net/minecraft/server/VillageSiege.java -+++ b/src/main/java/net/minecraft/server/VillageSiege.java -@@ -50,6 +50,12 @@ public class VillageSiege { - return; - } - } -+ -+ // PaperSpigot start - Siege manager initial state is -1 -+ if (this.c == -1) { -+ return; -+ } -+ // PaperSpigot end - } - - if (!this.b) { -@@ -89,9 +95,12 @@ public class VillageSiege { - - while (true) { - if (i < 10) { -- this.g = chunkcoordinates.x + (int) ((double) (MathHelper.cos(this.world.random.nextFloat() * 3.1415927F * 2.0F) * f) * 0.9D); -+ // PaperSpigot start - Zombies should spawn near the perimeter of the village not in the center of it -+ float angle = this.world.random.nextFloat() * (float) Math.PI * 2.0F; -+ this.g = chunkcoordinates.x + (int) ((double) (MathHelper.cos(angle) * f) * 0.9D); - this.h = chunkcoordinates.y; -- this.i = chunkcoordinates.z + (int) ((double) (MathHelper.sin(this.world.random.nextFloat() * 3.1415927F * 2.0F) * f) * 0.9D); -+ this.i = chunkcoordinates.z + (int) ((double) (MathHelper.sin(angle) * f) * 0.9D); -+ // PaperSpigot end - flag = false; - Iterator iterator1 = this.world.villages.getVillages().iterator(); - -@@ -165,6 +174,7 @@ public class VillageSiege { - // CraftBukkit - add Return - return Vec3D.a((double) i1, (double) j1, (double) k1); - } -+ - } - - return null; --- -1.9.1 - diff --git a/Spigot-Server-Patches/0020-Toggle-for-player-interact-limiter.patch b/Spigot-Server-Patches/0017-Toggle-for-player-interact-limiter.patch similarity index 80% rename from Spigot-Server-Patches/0020-Toggle-for-player-interact-limiter.patch rename to Spigot-Server-Patches/0017-Toggle-for-player-interact-limiter.patch index a68f98ed00..f7414db7fa 100644 --- a/Spigot-Server-Patches/0020-Toggle-for-player-interact-limiter.patch +++ b/Spigot-Server-Patches/0017-Toggle-for-player-interact-limiter.patch @@ -1,16 +1,16 @@ -From d9da9e413d37e05c22ac1568c4ac65ad9df12b20 Mon Sep 17 00:00:00 2001 +From 7609e57fb0d059d23984709ec44f6711f0d229b9 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 5 Aug 2014 17:56:02 -0500 +Date: Fri, 28 Nov 2014 01:33:25 -0600 Subject: [PATCH] Toggle for player interact limiter diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 10faa8c..26ce4ed 100644 +index 521e9bc..da81869 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -581,7 +581,8 @@ public class PlayerConnection implements PacketPlayInListener { - - public void a(PacketPlayInBlockPlace packetplayinblockplace) { +@@ -631,7 +631,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); boolean throttled = false; - if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { + // PaperSpigot - Allow disabling the player interaction limiter diff --git a/Spigot-Server-Patches/0021-Player-Exhaustion-Multipliers.patch b/Spigot-Server-Patches/0018-Player-Exhaustion-Multipliers.patch similarity index 71% rename from Spigot-Server-Patches/0021-Player-Exhaustion-Multipliers.patch rename to Spigot-Server-Patches/0018-Player-Exhaustion-Multipliers.patch index 9a8fa9c1a3..49d6448e1f 100644 --- a/Spigot-Server-Patches/0021-Player-Exhaustion-Multipliers.patch +++ b/Spigot-Server-Patches/0018-Player-Exhaustion-Multipliers.patch @@ -1,47 +1,47 @@ -From e7e389c145935280c12f237ba33e2ede2f89b10b Mon Sep 17 00:00:00 2001 -From: gsand -Date: Sun, 17 Aug 2014 16:40:54 -0500 +From 4f2a2610b45a7c09d12fbf3e04c60f6eba005773 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Fri, 28 Nov 2014 01:41:54 -0600 Subject: [PATCH] Player Exhaustion Multipliers diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 0893a6f..24e84d6 100644 +index 9a19752..32d678d 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -686,7 +686,7 @@ public class Block { +@@ -525,7 +525,7 @@ public class Block { - public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { - entityhuman.a(StatisticList.MINE_BLOCK_COUNT[getId(this)], 1); + public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) { + entityhuman.b(StatisticList.MINE_BLOCK_COUNT[getId(this)]); - entityhuman.applyExhaustion(0.025F); + entityhuman.applyExhaustion(world.paperSpigotConfig.blockBreakExhaustion); // PaperSpigot - Configurable block break exhaustion - if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) { - ItemStack itemstack = this.j(l); + if (this.G() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) { + ItemStack itemstack = this.i(iblockdata); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index a0e4855..35b5cfb 100644 +index b382854..5d03955 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1314,13 +1314,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen +@@ -1351,13 +1351,13 @@ public abstract class EntityHuman extends EntityLiving { i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); if (i > 0) { - this.a(StatisticList.m, i); + this.a(StatisticList.p, i); - this.applyExhaustion(0.015F * (float) i * 0.01F); + this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion } - } else if (this.M()) { + } else if (this.V()) { i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); if (i > 0) { - this.a(StatisticList.i, i); + this.a(StatisticList.l, i); - this.applyExhaustion(0.015F * (float) i * 0.01F); + this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion } - } else if (this.h_()) { + } else if (this.j_()) { if (d1 > 0.0D) { diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 1d01f89..df84df5 100644 +index b67b856..1b8683a 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -121,4 +121,12 @@ public class PaperSpigotWorldConfig +@@ -114,4 +114,12 @@ public class PaperSpigotWorldConfig fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", 100 ); fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", 900 ); } diff --git a/Spigot-Server-Patches/0022-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0019-Add-configurable-despawn-distances-for-living-entiti.patch similarity index 70% rename from Spigot-Server-Patches/0022-Add-configurable-despawn-distances-for-living-entiti.patch rename to Spigot-Server-Patches/0019-Add-configurable-despawn-distances-for-living-entiti.patch index fc0f9214ce..64b36797ba 100644 --- a/Spigot-Server-Patches/0022-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/0019-Add-configurable-despawn-distances-for-living-entiti.patch @@ -1,14 +1,14 @@ -From e3736087c549f4992576f0ed4bfaad5d8ce9776e Mon Sep 17 00:00:00 2001 +From 9fce5b162ea77e577894a188678115c96e5f3021 Mon Sep 17 00:00:00 2001 From: Suddenly -Date: Mon, 7 Jul 2014 04:11:34 +0100 +Date: Fri, 28 Nov 2014 01:49:53 -0600 Subject: [PATCH] Add configurable despawn distances for living entities diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index deb04b5..2d35a8d 100644 +index 39800e5..4755489 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -387,13 +387,13 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -432,13 +432,13 @@ public abstract class EntityInsentient extends EntityLiving { double d2 = entityhuman.locZ - this.locZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -17,37 +17,45 @@ index deb04b5..2d35a8d 100644 this.die(); } -- if (this.aU > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check -+ if (this.aU > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances +- if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check ++ if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances this.die(); - } else if (d3 < 1024.0D) { + } else if (d3 < this.world.paperSpigotConfig.softDespawnDistance) { // PaperSpigot - custom despawn distances - this.aU = 0; + this.aO = 0; } } diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index df84df5..1e1a382 100644 +index 1b8683a..522a214 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -129,4 +129,22 @@ public class PaperSpigotWorldConfig +@@ -103,7 +103,7 @@ public class PaperSpigotWorldConfig + private void blockGrowthHeight() + { + cactusMaxHeight = getInt( "max-growth-height.cactus", 3 ); +- reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); ++ reedMaxHeight = getInt("max-growth-height.reeds", 3); + log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); + } + +@@ -122,4 +122,21 @@ public class PaperSpigotWorldConfig blockBreakExhaustion = getFloat( "player-exhaustion.block-break", 0.025F ); playerSwimmingExhaustion = getFloat("player-exhaustion.swimming", 0.015F ); } + -+ public Integer softDespawnDistance; -+ public Integer hardDespawnDistance; ++ public int softDespawnDistance; ++ public int hardDespawnDistance; + private void despawnDistances() + { + softDespawnDistance = getInt( "despawn-ranges.soft", 32 ); // 32^2 = 1024, Minecraft Default + hardDespawnDistance = getInt( "despawn-ranges.hard", 128 ); // 128^2 = 16384, Minecraft Default; -+ -+ if ( softDespawnDistance > hardDespawnDistance) -+ { ++ ++ if ( softDespawnDistance > hardDespawnDistance) { + softDespawnDistance = hardDespawnDistance; + } -+ ++ + log( "Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance ); -+ ++ + softDespawnDistance = softDespawnDistance*softDespawnDistance; + hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; + } diff --git a/Spigot-Server-Patches/0023-Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/0020-Allow-for-toggling-of-spawn-chunks.patch similarity index 74% rename from Spigot-Server-Patches/0023-Allow-for-toggling-of-spawn-chunks.patch rename to Spigot-Server-Patches/0020-Allow-for-toggling-of-spawn-chunks.patch index d8375c1eb3..a7ce69c30a 100644 --- a/Spigot-Server-Patches/0023-Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/0020-Allow-for-toggling-of-spawn-chunks.patch @@ -1,31 +1,30 @@ -From 5846639b4009856d9ed0400fa2d242fb586be668 Mon Sep 17 00:00:00 2001 +From 319ff111613fd3a97f280692ef8a60c94ec979b9 Mon Sep 17 00:00:00 2001 From: Dmck2b -Date: Thu, 10 Jul 2014 16:57:10 +0100 +Date: Fri, 28 Nov 2014 01:53:14 -0600 Subject: [PATCH] Allow for toggling of spawn chunks -Now with 100% more confirmed working by creator diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7281b59..0358c7c 100644 +index 1537d76..c63617d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -222,6 +222,7 @@ public abstract class World implements IBlockAccess { +@@ -203,6 +203,7 @@ public abstract class World implements IBlockAccess { this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit // CraftBukkit end + this.keepSpawnInMemory = this.paperSpigotConfig.keepSpawnInMemory; // PaperSpigot // Spigot start this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 ); - this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); + this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE ); diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 1e1a382..ca977bc 100644 +index 522a214..00303dc 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -147,4 +147,11 @@ public class PaperSpigotWorldConfig +@@ -139,4 +139,11 @@ public class PaperSpigotWorldConfig softDespawnDistance = softDespawnDistance*softDespawnDistance; hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; } -+ ++ + public boolean keepSpawnInMemory; + private void keepSpawnInMemory() + { diff --git a/Spigot-Server-Patches/0026-Drop-falling-block-entities-that-are-above-the-speci.patch b/Spigot-Server-Patches/0021-Drop-falling-block-entities-that-are-above-the-speci.patch similarity index 82% rename from Spigot-Server-Patches/0026-Drop-falling-block-entities-that-are-above-the-speci.patch rename to Spigot-Server-Patches/0021-Drop-falling-block-entities-that-are-above-the-speci.patch index 225464190e..d0aa921884 100644 --- a/Spigot-Server-Patches/0026-Drop-falling-block-entities-that-are-above-the-speci.patch +++ b/Spigot-Server-Patches/0021-Drop-falling-block-entities-that-are-above-the-speci.patch @@ -1,22 +1,23 @@ -From 309b3c0831fda8cce0efb4d8787a3de214c2647c Mon Sep 17 00:00:00 2001 +From a9c5d65ab6b429e657fedbbc02054bd06e85b47c Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Tue, 5 Aug 2014 18:39:57 -0500 +Date: Fri, 28 Nov 2014 02:03:43 -0600 Subject: [PATCH] Drop falling block entities that are above the specified + height diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index df602bd..00dcca6 100644 +index fd78677..81a5dc9 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -67,6 +67,17 @@ public class EntityFallingBlock extends Entity { - ++this.ticksLived; +@@ -69,6 +69,17 @@ public class EntityFallingBlock extends Entity { + this.motY -= 0.03999999910593033D; this.move(this.motX, this.motY, this.motZ); + + // PaperSpigot start - Drop falling blocks above the specified height + if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) { + if (this.dropItem) { -+ this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F); ++ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F); + } + + this.die(); @@ -27,10 +28,10 @@ index df602bd..00dcca6 100644 this.motY *= 0.9800000190734863D; this.motZ *= 0.9800000190734863D; diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index ca977bc..708318d 100644 +index 00303dc..5306e9a 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -154,4 +154,14 @@ public class PaperSpigotWorldConfig +@@ -146,4 +146,14 @@ public class PaperSpigotWorldConfig keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true ); log( "Keep spawn chunk loaded: " + keepSpawnInMemory ); } diff --git a/Spigot-Server-Patches/0022-Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/0022-Configurable-speed-for-water-flowing-over-lava.patch new file mode 100644 index 0000000000..693098d68d --- /dev/null +++ b/Spigot-Server-Patches/0022-Configurable-speed-for-water-flowing-over-lava.patch @@ -0,0 +1,63 @@ +From 3f75698f2fa54576ea3fcc419632a11a8d561722 Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Fri, 28 Nov 2014 02:31:02 -0600 +Subject: [PATCH] Configurable speed for water flowing over lava + + +diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java +index 5184715..bc4cee5 100644 +--- a/src/main/java/net/minecraft/server/BlockFlowing.java ++++ b/src/main/java/net/minecraft/server/BlockFlowing.java +@@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids { + b0 = 2; + } + +- int j = this.a(world); ++ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot + int k; + + if (i > 0) { +@@ -259,8 +259,23 @@ public class BlockFlowing extends BlockFluids { + + public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { + if (!this.e(world, blockposition, iblockdata)) { +- world.a(blockposition, (Block) this, this.a(world)); ++ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // PaperSpigot + } + + } ++ ++ /** ++ * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava ++ */ ++ public int getFlowSpeed(World world, BlockPosition blockposition) { ++ if (this.getMaterial() == Material.WATER && ( ++ // TODO: Double check that this does what I think it does ++ world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA || ++ world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA || ++ world.getType(blockposition.west(1)).getBlock().getMaterial() == Material.LAVA || ++ world.getType(blockposition.east(1)).getBlock().getMaterial() == Material.LAVA)) { ++ return world.paperSpigotConfig.waterOverLavaFlowSpeed; ++ } ++ return super.a(world); ++ } + } +diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +index 5306e9a..670f78f 100644 +--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java ++++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +@@ -156,4 +156,11 @@ public class PaperSpigotWorldConfig + log( "TNT/Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); + } + } ++ ++ public int waterOverLavaFlowSpeed; ++ private void waterOverLavaFlowSpeed() ++ { ++ waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); ++ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed ); ++ } + } +-- +1.9.1 + diff --git a/Spigot-Server-Patches/0028-Center-TNT-grid-sample-points.patch b/Spigot-Server-Patches/0023-Center-TNT-grid-sample-points.patch similarity index 69% rename from Spigot-Server-Patches/0028-Center-TNT-grid-sample-points.patch rename to Spigot-Server-Patches/0023-Center-TNT-grid-sample-points.patch index 419815b5f7..074b338b4a 100644 --- a/Spigot-Server-Patches/0028-Center-TNT-grid-sample-points.patch +++ b/Spigot-Server-Patches/0023-Center-TNT-grid-sample-points.patch @@ -1,15 +1,14 @@ -From 8cad240c921709616da608af0737c1d7507dbca7 Mon Sep 17 00:00:00 2001 +From 3cbb307579d88ea2247c7763420a18a73cb8c433 Mon Sep 17 00:00:00 2001 From: Jedediah Smith -Date: Wed, 6 Aug 2014 18:17:41 -0500 +Date: Fri, 28 Nov 2014 02:36:18 -0600 Subject: [PATCH] Center TNT grid sample points -More information at https://bugs.mojang.com/browse/MC-65697 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0358c7c..717be3b 100644 +index c63617d..bf697c2 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1911,6 +1911,12 @@ public abstract class World implements IBlockAccess { +@@ -1847,6 +1847,12 @@ public abstract class World implements IBlockAccess { double d1 = 1.0D / ((axisalignedbb.e - axisalignedbb.b) * 2.0D + 1.0D); double d2 = 1.0D / ((axisalignedbb.f - axisalignedbb.c) * 2.0D + 1.0D); @@ -22,12 +21,12 @@ index 0358c7c..717be3b 100644 if (d0 >= 0.0D && d1 >= 0.0D && d2 >= 0.0D) { int i = 0; int j = 0; -@@ -1923,7 +1929,7 @@ public abstract class World implements IBlockAccess { +@@ -1858,7 +1864,7 @@ public abstract class World implements IBlockAccess { double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1; double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2; -- if (this.a(vec3d2.b(d3, d4, d5), vec3d) == null) { // CraftBukkit -+ if (this.a(vec3d2.b(xOffset + d3, d4, zOffset + d5), vec3d) == null) { // CraftBukkit // PaperSpigot +- if (this.rayTrace(new Vec3D(d3, d4, d5), vec3d) == null) { ++ if (this.rayTrace(new Vec3D(xOffset, d4, zOffset + d5), vec3d) == null) { // PaperSpigot - Center TNT sample points ++i; } diff --git a/Spigot-Server-Patches/0024-Better-EULA-handling.patch b/Spigot-Server-Patches/0024-Better-EULA-handling.patch deleted file mode 100644 index b88f9df454..0000000000 --- a/Spigot-Server-Patches/0024-Better-EULA-handling.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 55cca3b8a7074e826b20d9cd004400ad6aced9d6 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 8 Jul 2014 22:39:41 -0500 -Subject: [PATCH] Better EULA handling - - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index e9a1a67..38b76ba 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -9,6 +9,7 @@ import java.util.Collections; - import java.util.List; - import java.util.Random; - import java.util.concurrent.Callable; -+import java.util.concurrent.TimeUnit; // PaperSpigot - - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -76,7 +77,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - i.info("Loading properties"); - this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support -- this.n = new EULA(new File("eula.txt")); -+ // PaperSpigot start - Display a EULA warning then continue -+ File EULALock = new File( ".eula-lock"); - // Spigot Start - boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); - if ( eulaAgreed ) -@@ -84,13 +86,24 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - System.err.println( "You have used the Spigot command line EULA agreement flag." ); - System.err.println( "By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)." ); - System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); -- } -- // Spigot End -- if (!this.n.a() && !eulaAgreed) { -- i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); -- this.n.b(); -- return false; -+ // Spigot End - } else { -+ if (!EULALock.exists()) { -+ System.err.println("WARNING: By using this server you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)"); -+ System.err.println("If you do not agree to the above EULA please stop this server and remove it from your system immediately."); -+ System.err.println("The server will start in 10 seconds, you will only see this message and have to wait this one time."); -+ try { -+ EULALock.createNewFile(); -+ } catch (IOException e1) { -+ System.err.println("Unable to create EULA lock file"); -+ e1.printStackTrace(); -+ } -+ try { -+ Thread.sleep(TimeUnit.SECONDS.toMillis(10)); -+ } catch (InterruptedException ex) { -+ } -+ } -+ // PaperSpigot end - if (this.N()) { - this.c("127.0.0.1"); - } else { -@@ -252,6 +265,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - return true; - } - } -+ return true; // PaperSpigot - } - - // CraftBukkit start --- -1.9.1 - diff --git a/Spigot-Server-Patches/0024-Player-affects-spawning-API.patch b/Spigot-Server-Patches/0024-Player-affects-spawning-API.patch new file mode 100644 index 0000000000..8c11401fa7 --- /dev/null +++ b/Spigot-Server-Patches/0024-Player-affects-spawning-API.patch @@ -0,0 +1,171 @@ +From 325cee0020dfc470cae368187992852c4face538 Mon Sep 17 00:00:00 2001 +From: Jedediah Smith +Date: Fri, 28 Nov 2014 03:31:21 -0600 +Subject: [PATCH] Player affects spawning API + + +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +index 5d03955..847b507 100644 +--- a/src/main/java/net/minecraft/server/EntityHuman.java ++++ b/src/main/java/net/minecraft/server/EntityHuman.java +@@ -59,6 +59,7 @@ public abstract class EntityHuman extends EntityLiving { + private final GameProfile bF; + private boolean bG = false; + public EntityFishingHook hookedFish; ++ public boolean affectsSpawning = true; // PaperSpigot + + // CraftBukkit start + public boolean fauxSleeping; +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index 91c6b71..40abc51 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -424,7 +424,7 @@ public abstract class EntityInsentient extends EntityLiving { + if (this.persistent) { + this.aO = 0; + } else { +- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); ++ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot - Affects Spawning API + + if (entityhuman != null) { + double d0 = entityhuman.locX - this.locX; +diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +index 4ff4ece..ecd518b 100644 +--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +@@ -47,7 +47,8 @@ public abstract class MobSpawnerAbstract { + private boolean g() { + BlockPosition blockposition = this.b(); + +- return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); ++ // PaperSpigot - Affects Spawning API ++ return this.a().isPlayerNearbyWhoAffectsSpawning((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); + } + + public void c() { +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index 43954b3..932a572 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -52,7 +52,7 @@ public final class SpawnerCreature { + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + +- if (!entityhuman.v()) { ++ if (!entityhuman.v() || !entityhuman.affectsSpawning) { // PaperSpigot + int l = MathHelper.floor(entityhuman.locX / 16.0D); + + j = MathHelper.floor(entityhuman.locZ / 16.0D); +@@ -156,7 +156,8 @@ public final class SpawnerCreature { + float f = (float) j3 + 0.5F; + float f1 = (float) l3 + 0.5F; + +- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { ++ // PaperSpigot - Affects Spawning API ++ if (!worldserver.isPlayerNearbyWhoAffectsSpawning((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { + if (biomemeta == null) { + biomemeta = worldserver.a(enumcreaturetype, blockposition2); + if (biomemeta == null) { +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index bf697c2..91c0a2f 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -2,14 +2,13 @@ package net.minecraft.server; + + import com.google.common.base.Predicate; + import com.google.common.collect.Lists; +-import com.google.common.collect.Sets; ++ + import java.util.ArrayList; + import java.util.Calendar; + import java.util.Collection; + import java.util.Iterator; + import java.util.List; + import java.util.Random; +-import java.util.Set; + import java.util.UUID; + import java.util.concurrent.Callable; + +@@ -17,7 +16,6 @@ import java.util.concurrent.Callable; + import org.bukkit.Bukkit; + import org.bukkit.block.BlockState; + import org.bukkit.craftbukkit.util.CraftMagicNumbers; +-import org.bukkit.craftbukkit.util.LongHashSet; + import org.bukkit.craftbukkit.SpigotTimings; // Spigot + import org.bukkit.generator.ChunkGenerator; + import org.bukkit.craftbukkit.CraftServer; +@@ -2754,6 +2752,50 @@ public abstract class World implements IBlockAccess { + return false; + } + ++ // PaperSpigot start - Affects spawning API ++ public boolean isPlayerNearbyWhoAffectsSpawning(double d0, double d1, double d2, double d3) { ++ for (int i = 0; i < this.players.size(); ++i) { ++ EntityHuman entityhuman = (EntityHuman) this.players.get(i); ++ ++ if (IEntitySelector.d.apply(entityhuman)) { ++ double d4 = entityhuman.e(d0, d1, d2); ++ ++ if (d3 < 0.0D || d4 < d3 * d3 && entityhuman.affectsSpawning) { ++ return true; ++ } ++ } ++ } ++ ++ return false; ++ } ++ ++ public EntityHuman findNearbyPlayerWhoAffectsSpawning(Entity entity, double radius) { ++ return this.findNearbyPlayerWhoAffectsSpawning(entity.locX, entity.locY, entity.locZ, radius); ++ } ++ ++ public EntityHuman findNearbyPlayerWhoAffectsSpawning(double x, double y, double z, double radius) { ++ double nearestRadius = - 1.0D; ++ EntityHuman entityHuman = null; ++ ++ for (int i = 0; i < this.players.size(); ++i) { ++ EntityHuman nearestPlayer = (EntityHuman) this.players.get(i); ++ ++ if (nearestPlayer == null || nearestPlayer.dead || !nearestPlayer.affectsSpawning) { ++ continue; ++ } ++ ++ double distance = nearestPlayer.e(x, y, z); ++ ++ if ((radius < 0.0D || distance < radius * radius) && (nearestRadius == -1.0D || distance < nearestRadius)) { ++ nearestRadius = distance; ++ entityHuman = nearestPlayer; ++ } ++ } ++ ++ return entityHuman; ++ } ++ // PaperSpigot end ++ + public EntityHuman a(String s) { + for (int i = 0; i < this.players.size(); ++i) { + EntityHuman entityhuman = (EntityHuman) this.players.get(i); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 2d4398e..914187d 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1457,6 +1457,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + + return java.util.Collections.unmodifiableSet( ret ); + } ++ ++ // PaperSpigot start - Add affects spawning API ++ public void setAffectsSpawning(boolean affects) { ++ getHandle().affectsSpawning = affects; ++ } ++ ++ public boolean getAffectsSpawning() { ++ return getHandle().affectsSpawning; ++ } ++ // PaperSpigot end + }; + + public Player.Spigot spigot() +-- +1.9.1 + diff --git a/Spigot-Server-Patches/0025-Fix-random-position-generator-tendency-to-move-north.patch b/Spigot-Server-Patches/0025-Fix-random-position-generator-tendency-to-move-north.patch deleted file mode 100644 index de32e39c4b..0000000000 --- a/Spigot-Server-Patches/0025-Fix-random-position-generator-tendency-to-move-north.patch +++ /dev/null @@ -1,78 +0,0 @@ -From a9b4a5ea623ce31c33c2362459589ce7888137a6 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 22 Jul 2014 21:52:19 -0500 -Subject: [PATCH] Fix random position generator tendency to move north west - -Fixes mobs sticking to one side of pens and "migrating" to the north west constantly -Backported fix from 1.8 - -diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -index 9342a3f..fa20a7d 100644 ---- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java -+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -@@ -27,9 +27,11 @@ public class RandomPositionGenerator { - private static Vec3D c(EntityCreature entitycreature, int i, int j, Vec3D vec3d) { - Random random = entitycreature.aI(); - boolean flag = false; -- int k = 0; -- int l = 0; -- int i1 = 0; -+ // PaperSpigot start - int -> double -+ double k = 0; -+ double l = 0; -+ double i1 = 0; -+ // PaperSpigot end - float f = -99999.0F; - boolean flag1; - -@@ -43,22 +45,27 @@ public class RandomPositionGenerator { - } - - for (int j1 = 0; j1 < 10; ++j1) { -- int k1 = random.nextInt(2 * i) - i; -- int l1 = random.nextInt(2 * j) - j; -- int i2 = random.nextInt(2 * i) - i; -+ // PaperSpigot start - Even distribution and average of 0 -+ int k1 = random.nextInt(2 * i + 1) - i; -+ int l1 = random.nextInt(2 * j + 1) - j; -+ int i2 = random.nextInt(2 * i + 1) - i; -+ // PaperSpigot end - - if (vec3d == null || (double) k1 * vec3d.a + (double) i2 * vec3d.c >= 0.0D) { -- k1 += MathHelper.floor(entitycreature.locX); -- l1 += MathHelper.floor(entitycreature.locY); -- i2 += MathHelper.floor(entitycreature.locZ); -- if (!flag1 || entitycreature.b(k1, l1, i2)) { -- float f1 = entitycreature.a(k1, l1, i2); -+ // PaperSpigot start - Use truncated absolute destination position for checking things -+ int k1Mod = k1 + MathHelper.floor(entitycreature.locX); -+ int l1Mod = l1 + MathHelper.floor(entitycreature.locY); -+ int i2Mod = i2 + MathHelper.floor(entitycreature.locZ); -+ if (!flag1 || entitycreature.b(k1Mod, l1Mod, i2Mod)) { -+ float f1 = entitycreature.a(k1Mod, l1Mod, i2Mod); - - if (f1 > f) { - f = f1; -- k = k1; -- l = l1; -- i1 = i2; -+ // but then the full value to set where to move -+ k = entitycreature.locX + k1; -+ l = entitycreature.locY + l1; -+ i1 = entitycreature.locZ + i2; -+ // PaperSpigot end - flag = true; - } - } -@@ -66,7 +73,7 @@ public class RandomPositionGenerator { - } - - if (flag) { -- return Vec3D.a((double) k, (double) l, (double) i1); -+ return Vec3D.a(k, l, i1); // PaperSpigot remove unnecessary cast - } else { - return null; - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0030-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch b/Spigot-Server-Patches/0025-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch similarity index 78% rename from Spigot-Server-Patches/0030-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch rename to Spigot-Server-Patches/0025-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch index 3e94480f5f..fbcaea014c 100644 --- a/Spigot-Server-Patches/0030-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch +++ b/Spigot-Server-Patches/0025-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch @@ -1,4 +1,4 @@ -From 86853911cac991344a4c79a4cee9de10b8651ed3 Mon Sep 17 00:00:00 2001 +From 9c7adf66832042b97e4d17ea484e81eee3190ae9 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 19 Aug 2014 14:21:37 -0500 Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and @@ -6,10 +6,10 @@ Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8c3950a..fa10ea1 100644 +index 7bfd6f5..bdaf6fb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -988,7 +988,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -1048,7 +1048,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs } public String getServerModName() { diff --git a/Spigot-Server-Patches/0031-RIP-metrics.patch b/Spigot-Server-Patches/0026-RIP-metrics.patch similarity index 100% rename from Spigot-Server-Patches/0031-RIP-metrics.patch rename to Spigot-Server-Patches/0026-RIP-metrics.patch diff --git a/Spigot-Server-Patches/0027-Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/0027-Configurable-speed-for-water-flowing-over-lava.patch deleted file mode 100644 index 1dd0883e3e..0000000000 --- a/Spigot-Server-Patches/0027-Configurable-speed-for-water-flowing-over-lava.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 897c5080d8ebb7ebbd3e9724d516a881f63d4997 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Sun, 3 Aug 2014 21:20:42 -0500 -Subject: [PATCH] Configurable speed for water flowing over lava - -Basic info: http://hastebin.com/axuzaralas.vhdl - -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index cdce3ff..6409391 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -38,7 +38,7 @@ public class BlockFlowing extends BlockFluids { - } - - boolean flag = true; -- int i1 = this.a(world); -+ int i1 = this.getFlowSpeed(world, i, j, k); // PaperSpigot - int j1; - - if (l > 0) { -@@ -289,11 +289,25 @@ public class BlockFlowing extends BlockFluids { - public void onPlace(World world, int i, int j, int k) { - super.onPlace(world, i, j, k); - if (world.getType(i, j, k) == this) { -- world.a(i, j, k, this, this.a(world)); -+ world.a(i, j, k, this, this.getFlowSpeed(world, i, j, k)); // PaperSpigot - } - } - - public boolean L() { - return true; - } -+ -+ /** -+ * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava -+ */ -+ public int getFlowSpeed(World world, int x, int y, int z) { -+ if (this.getMaterial() == Material.WATER && ( -+ world.getType(x, y, z - 1).getMaterial() == Material.LAVA || -+ world.getType(x, y, z + 1).getMaterial() == Material.LAVA || -+ world.getType(x - 1, y, z).getMaterial() == Material.LAVA || -+ world.getType(x + 1, y, z).getMaterial() == Material.LAVA)) { -+ return world.paperSpigotConfig.waterOverLavaFlowSpeed; -+ } -+ return super.a(world); -+ } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 708318d..ce3fb73 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -164,4 +164,11 @@ public class PaperSpigotWorldConfig - log( "TNT/Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); - } - } -+ -+ public int waterOverLavaFlowSpeed; -+ private void waterOverLavaFlowSpeed() -+ { -+ waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); -+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed); -+ } - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0032-Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/0027-Remove-invalid-mob-spawner-tile-entities.patch similarity index 72% rename from Spigot-Server-Patches/0032-Remove-invalid-mob-spawner-tile-entities.patch rename to Spigot-Server-Patches/0027-Remove-invalid-mob-spawner-tile-entities.patch index 0f54cafd76..b670648172 100644 --- a/Spigot-Server-Patches/0032-Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/0027-Remove-invalid-mob-spawner-tile-entities.patch @@ -1,32 +1,32 @@ -From 0c4d3daad8180e670e800360fe2f25d15f79b544 Mon Sep 17 00:00:00 2001 +From 9d5edc25a12f2c5f268e5964b396131b066e5b4a Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Tue, 19 Aug 2014 14:51:28 -0500 +Date: Fri, 28 Nov 2014 03:43:14 -0600 Subject: [PATCH] Remove invalid mob spawner tile entities diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0423ee9..9454d4f 100644 +index 858e12c..538ae9c 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -755,6 +755,11 @@ public class Chunk { +@@ -768,6 +768,11 @@ public class Chunk { this.world.triggerHoppersList.add(tileentity); } // Spigot end + // PaperSpigot start - Remove invalid mob spawner Tile Entities + } else if (this.world.paperSpigotConfig.removeInvalidMobSpawnerTEs && tileentity instanceof TileEntityMobSpawner && -+ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(i, j, k)) != org.bukkit.Material.MOB_SPAWNER) { -+ this.tileEntities.remove(chunkposition); ++ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) != org.bukkit.Material.MOB_SPAWNER) { ++ this.tileEntities.remove(blockposition); + // PaperSpigot end // CraftBukkit start } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index ce3fb73..753bdda 100644 +index 670f78f..0642f12 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -171,4 +171,11 @@ public class PaperSpigotWorldConfig +@@ -163,4 +163,11 @@ public class PaperSpigotWorldConfig waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); - log( "Water over lava flow speed: " + waterOverLavaFlowSpeed); + log( "Water over lava flow speed: " + waterOverLavaFlowSpeed ); } + + public boolean removeInvalidMobSpawnerTEs; diff --git a/Spigot-Server-Patches/0033-Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/0028-Optimize-TileEntity-Ticking.patch similarity index 57% rename from Spigot-Server-Patches/0033-Optimize-TileEntity-Ticking.patch rename to Spigot-Server-Patches/0028-Optimize-TileEntity-Ticking.patch index 936cfe14bc..77c746e24e 100644 --- a/Spigot-Server-Patches/0033-Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/0028-Optimize-TileEntity-Ticking.patch @@ -1,119 +1,119 @@ -From f7a916d804a0d98856017ad2cd6904c34db9f19f Mon Sep 17 00:00:00 2001 +From ec638c94f59ab071684d66c4f66c3c5a8c75d7c8 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 24 Aug 2014 21:35:11 -0400 +Date: Fri, 28 Nov 2014 04:14:14 -0600 Subject: [PATCH] Optimize TileEntity Ticking -Re-organizes the servers TileEntity Tick List to be bucketed based on their tick interval. - -We now will not even store a Tile Entity that is known to not have any tick function -(half of them), skipping time spent iterating them and checking if they are valid -and in a loaded chunk. In other words, a lot of "meta" time wasted on tile entities -that would never do anything anyways. - -Then by reducing chests to 1 in 20 ticks, we cut out 95% of isLoaded checks and findPlayer -calls on chests, and 100% of the checks for Signs, the 2 most popular Tile Entities. - -This cuts out a massive amount of checks revolving around TileEntity ticking. -Servers with large amounts of TileEntities should see significant improvement. - -Finally, this then spreads out the ticking of reduced-rate TileEntities so that they -do not all tick on the same tick, distributing the load of some TileEntities like Chest. diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 3c5ec6f..27fedeb 100644 +index 7cf38ea..76cdc7e 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -56,6 +56,12 @@ public class TileEntity { - } - } +@@ -56,6 +56,12 @@ public abstract class TileEntity { } -+ -+ // Optimized TileEntity Tick changes + // Spigot end + ++ // PaperSpigot start - Optimized TileEntity Tick changes + private static int tileEntityCounter = 0; + public boolean isAdded = false; + public int tileId = tileEntityCounter++; ++ // PaperSpigot end + - // Spigot end - - public TileEntity() {} + public TileEntity() { + this.position = BlockPosition.ZERO; + this.h = -1; diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java -index 09313ea..198f908 100644 +index 66b023c..65561c6 100644 --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java -@@ -45,7 +45,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory { +@@ -48,7 +48,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay public TileEntityBeacon() {} - public void h() { + public void c() { - if (this.world.getTime() % 80L == 0L) { -+ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick handling - this.y(); - this.x(); ++ if (true || this.world.getTime() % 80L == 0L) { // PaperSpigot - controlled by Improved Tick Handling + this.m(); } + diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index c900caf..e27716b 100644 +index 7444f4f..0f29365 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -255,7 +255,7 @@ public class TileEntityChest extends TileEntity implements IInventory { - ++this.ticks; +@@ -246,7 +246,7 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + ++this.n; float f; -- if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) { -+ if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling - this.o = 0; +- if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 200 == 0) { ++ if (!this.world.isStatic && this.l != 0 && (this.n + i + j + k) % 10 == 0) { // PaperSpigot Reduced 200 -> 10 interval due to reduced tick rate from Improved Tick Handling + this.l = 0; f = 5.0F; - List list = this.world.a(EntityHuman.class, AxisAlignedBB.a((double) ((float) this.x - f), (double) ((float) this.y - f), (double) ((float) this.z - f), (double) ((float) (this.x + 1) + f), (double) ((float) (this.y + 1) + f), (double) ((float) (this.z + 1) + f))); + List list = this.world.a(EntityHuman.class, new AxisAlignedBB((double) ((float) i - f), (double) ((float) j - f), (double) ((float) k - f), (double) ((float) (i + 1) + f), (double) ((float) (j + 1) + f), (double) ((float) (k + 1) + f))); diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -index b205ab7..d76a2b2 100644 +index 794cdc8..218b801 100644 --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -11,7 +11,7 @@ public class TileEntityEnderChest extends TileEntity { +@@ -10,7 +10,7 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis + public TileEntityEnderChest() {} - public void h() { - super.h(); -- if (++this.k % 20 * 4 == 0) { -+ if (++this.k % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling - this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); + public void c() { +- if (++this.h % 20 * 4 == 0) { ++ if (++this.h % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); } diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java -index 143cffb..de33df0 100644 +index 7b6f8ae..c6b593f 100644 --- a/src/main/java/net/minecraft/server/TileEntityLightDetector.java +++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java -@@ -5,7 +5,7 @@ public class TileEntityLightDetector extends TileEntity { +@@ -5,7 +5,7 @@ public class TileEntityLightDetector extends TileEntity implements IUpdatePlayer public TileEntityLightDetector() {} - public void h() { + public void c() { - if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) { + if (this.world != null && !this.world.isStatic /*&& this.world.getTime() % 20L == 0L*/) { // PaperSpigot - interval controlled by Improved Tick Handling - this.h = this.q(); - if (this.h instanceof BlockDaylightDetector) { - ((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z); + this.e = this.w(); + if (this.e instanceof BlockDaylightDetector) { + ((BlockDaylightDetector) this.e).d(this.world, this.position); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 33c228b..3bf2af0 100644 +index 91c0a2f..13a6169 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -58,7 +58,7 @@ public abstract class World implements IBlockAccess { - }; +@@ -3,13 +3,7 @@ package net.minecraft.server; + import com.google.common.base.Predicate; + import com.google.common.collect.Lists; + +-import java.util.ArrayList; +-import java.util.Calendar; +-import java.util.Collection; +-import java.util.Iterator; +-import java.util.List; +-import java.util.Random; +-import java.util.UUID; ++import java.util.*; + import java.util.concurrent.Callable; + + // CraftBukkit start +@@ -59,7 +53,7 @@ public abstract class World implements IBlockAccess { // Spigot end - protected List f = new ArrayList(); -- public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet -+ public Set tileEntityList = new org.spigotmc.WorldTileEntityList(this); // CraftBukkit - ArrayList -> HashSet - private List a = new ArrayList(); - private List b = new ArrayList(); - public List players = new ArrayList(); -diff --git a/src/main/java/org/spigotmc/WorldTileEntityList.java b/src/main/java/org/spigotmc/WorldTileEntityList.java + protected final List g = Lists.newArrayList(); + public final List h = Lists.newArrayList(); +- public final List tileEntityList = Lists.newArrayList(); ++ public final Set tileEntityList = new org.github.paperspigot.WorldTileEntityList(this); // PaperSpigot + private final List a = Lists.newArrayList(); + private final List b = Lists.newArrayList(); + public final List players = Lists.newArrayList(); +diff --git a/src/main/java/org/github/paperspigot/WorldTileEntityList.java b/src/main/java/org/github/paperspigot/WorldTileEntityList.java new file mode 100644 -index 0000000..e7fd3d3 +index 0000000..1a53e94 --- /dev/null -+++ b/src/main/java/org/spigotmc/WorldTileEntityList.java -@@ -0,0 +1,174 @@ -+package org.spigotmc; ++++ b/src/main/java/org/github/paperspigot/WorldTileEntityList.java +@@ -0,0 +1,175 @@ ++package org.github.paperspigot; + +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import net.minecraft.server.*; -+import net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap; ++import gnu.trove.map.hash.TObjectIntHashMap; + +import java.util.Collection; +import java.util.HashSet; @@ -122,39 +122,40 @@ index 0000000..e7fd3d3 + +public class WorldTileEntityList extends HashSet { + private static final TObjectIntHashMap> tileEntityTickIntervals = -+ new TObjectIntHashMap>() {{ -+ // Use -1 for no ticking -+ // These TE's have empty tick methods, doing nothing. Never bother ticking them. -+ for (Class ignored : new Class[]{ -+ TileEntityChest.class, // PaperSpigot - Don't tick chests either -+ TileEntityEnderChest.class, // PaperSpigot - Don't tick chests either -+ TileEntityRecordPlayer.class, -+ TileEntityDispenser.class, -+ TileEntityDropper.class, -+ TileEntitySign.class, -+ TileEntityNote.class, -+ TileEntityEnderPortal.class, -+ TileEntityCommand.class, -+ TileEntitySkull.class, -+ TileEntityComparator.class, -+ TileEntityFlowerPot.class -+ }) { -+ put(ignored, -1); -+ } ++ new TObjectIntHashMap>() {{ ++ // Use -1 for no ticking ++ // These TE's have empty tick methods, doing nothing. Never bother ticking them. ++ for (Class ignored : new Class[]{ ++ TileEntityChest.class, // PaperSpigot - Don't tick chests either ++ TileEntityEnderChest.class, // PaperSpigot - Don't tick chests either ++ TileEntityRecordPlayer.class, ++ TileEntityDispenser.class, ++ TileEntityDropper.class, ++ TileEntitySign.class, ++ TileEntityNote.class, ++ TileEntityEnderPortal.class, ++ TileEntityCommand.class, ++ TileEntitySkull.class, ++ TileEntityComparator.class, ++ TileEntityFlowerPot.class ++ }) { ++ put(ignored, -1); ++ } + -+ // does findPlayer lookup, so this helps performance to slow down -+ put(TileEntityEnchantTable.class, 20); ++ // does findPlayer lookup, so this helps performance to slow down ++ put(TileEntityEnchantTable.class, 20); + -+ // Slow things down that players won't notice due to craftbukkit "wall time" patches. -+ // These need to be investigated further before they can be safely used here -+ //put(TileEntityFurnace.class, 20); -+ //put(TileEntityBrewingStand.class, 10); ++ // Slow things down that players won't notice due to craftbukkit "wall time" patches. ++ // These need to be investigated further before they can be safely used here ++ //put(TileEntityFurnace.class, 20); ++ //put(TileEntityBrewingStand.class, 10); ++ ++ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know ++ // won't do anything anyways ++ put(TileEntityBeacon.class, 80); ++ put(TileEntityLightDetector.class, 20); ++ }}; + -+ // Vanilla controlled values - These are checks already done in vanilla, so don't tick on ticks we know -+ // won't do anything anyways -+ put(TileEntityBeacon.class, 80); -+ put(TileEntityLightDetector.class, 20); -+ }}; + private static int getInterval(Class cls) { + int tickInterval = tileEntityTickIntervals.get(cls); + return tickInterval != 0 ? tickInterval : 1; @@ -281,6 +282,7 @@ index 0000000..e7fd3d3 + } + } +} +\ No newline at end of file -- 1.9.1 diff --git a/Spigot-Server-Patches/0029-Move-sound-handling-out-of-the-chest-tick-loop.patch b/Spigot-Server-Patches/0029-Move-sound-handling-out-of-the-chest-tick-loop.patch new file mode 100644 index 0000000000..076febf7f2 --- /dev/null +++ b/Spigot-Server-Patches/0029-Move-sound-handling-out-of-the-chest-tick-loop.patch @@ -0,0 +1,218 @@ +From bd1c3a3d30ceff9067f09560e487f5d0613b9974 Mon Sep 17 00:00:00 2001 +From: Iceee +Date: Fri, 28 Nov 2014 11:56:55 -0600 +Subject: [PATCH] Move sound handling out of the chest tick loop + +This allows us to disable ticking chests and enderchests without any +noticeable difference to players + +diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java +index 0f29365..135f2f7 100644 +--- a/src/main/java/net/minecraft/server/TileEntityChest.java ++++ b/src/main/java/net/minecraft/server/TileEntityChest.java +@@ -12,13 +12,13 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + + private ItemStack[] items = new ItemStack[27]; + public boolean a; +- public TileEntityChest f; +- public TileEntityChest g; +- public TileEntityChest h; +- public TileEntityChest i; +- public float j; ++ public TileEntityChest f; // PaperSpigot - adjacentChestZNeg ++ public TileEntityChest g; // PaperSpigot - adjacentChestXPos ++ public TileEntityChest h; // PaperSpigot - adjacentChestXNeg ++ public TileEntityChest i; // PaperSpigot - adjacentChestZPos ++ public float j; // PaperSpigot - lidAngle + public float k; +- public int l; ++ public int l; // PaperSpigot - playersUsing + private int n; + private int o = -1; + private String p; +@@ -238,6 +238,8 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + } + + public void c() { ++ // PaperSpigot start - Move chest sounds out of tick loop - TileEntity Tick Improvements ++ /* + this.m(); + int i = this.position.getX(); + int j = this.position.getY(); +@@ -318,6 +320,8 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + this.j = 0.0F; + } + } ++ */ ++ // PaperSpigot end + + } + +@@ -340,6 +344,27 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + + ++this.l; + if (this.world == null) return; // CraftBukkit ++ ++ // PaperSpigot - Move chest open sound out of the tick loop ++ if (this.l > 1 && this.j == 0.0F && this.f == null && this.h == null) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); ++ ++ double d0 = (double) locZ + 0.5D; ++ double d1 = (double) locX + 0.5D; ++ ++ if (this.i != null) { ++ d0 += 0.5D; ++ } ++ ++ if (this.g != null) { ++ d1 += 0.5D; ++ } ++ ++ this.world.makeSound(d1, (double) locY + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ } ++ + this.world.playBlockAction(this.position, this.w(), 1, this.l); + + // CraftBukkit start - Call redstone event +@@ -363,6 +388,41 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye + + --this.l; + if (this.world == null) return; // CraftBukkit ++ ++ // PaperSpigot start - Move chest close sound handling out of the tick loop ++ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); ++ float f1 = this.j; ++ ++ float f = 0.1F; ++ ++ if (this.l > 0) { ++ this.j += f; ++ } else { ++ this.j -= f; ++ } ++ ++ double d0 = (double) locX + 0.5D; ++ double d2 = (double) locZ + 0.5D; ++ ++ if (this.i != null) { ++ d2 += 0.5D; ++ } ++ ++ if (this.g != null) { ++ d0 += 0.5D; ++ } ++ ++ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ ++ if (this.j < 0.0F) { ++ this.j = 0.0F; ++ } ++ } ++ // PaperSpigot end ++ + this.world.playBlockAction(this.position, this.w(), 1, this.l); + + // CraftBukkit start - Call redstone event +diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java +index 218b801..2a202b7 100644 +--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java ++++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java +@@ -2,14 +2,16 @@ package net.minecraft.server; + + public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox { + +- public float a; ++ public float a; // PaperSpigot - lidAngle + public float f; +- public int g; ++ public int g; // PaperSpigot - numPlayersUsing + private int h; + + public TileEntityEnderChest() {} + + public void c() { ++ // PaperSpigot - Move enderchest sound handling out of the tick loop ++ /* + if (++this.h % 4 == 0) { // PaperSpigot Reduced (20 * 4) -> 4 interval due to reduced tick rate from Improved Tick Handling + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } +@@ -54,6 +56,8 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis + this.a = 0.0F; + } + } ++ */ ++ // PaperSpigot end + + } + +@@ -73,11 +77,62 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis + + public void b() { + ++this.g; ++ ++ // PaperSpigot start - Move enderchest open sounds out of the tick loop ++ if (this.g > 0 && this.a == 0.0F) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); ++ ++ double d1 = (double) locX + 0.5D; ++ double d0 = (double) locZ + 0.5D; ++ ++ this.world.makeSound(d1, (double) locY + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ ++ this.a = 0.7F; ++ } ++ // PaperSpigot end ++ + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + + public void d() { + --this.g; ++ ++ // PaperSpigot start - Move enderchest close sounds out of the tick loop ++ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { ++ int locX = this.position.getX(); ++ int locY = this.position.getY(); ++ int locZ = this.position.getZ(); ++ ++ float f = 0.1F; ++ ++ if (this.g > 0) { ++ this.a += f; ++ } else { ++ this.a -= f; ++ } ++ ++ if (this.a > 1.0F) { ++ this.a = 1.0F; ++ } ++ ++ float f1 = this.a; ++ float f2 = 0.5F; ++ ++ if (this.a < f2 && f1 >= f2) { ++ double d0 = (double) locX + 0.5D; ++ double d2 = (double) locZ + 0.5D; ++ ++ this.world.makeSound(d0, (double) locY + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ } ++ ++ if (this.a < 0.0F) { ++ this.a = 0.0F; ++ } ++ } ++ // PaperSpigot end ++ + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + +-- +1.9.1 + diff --git a/Spigot-Server-Patches/0029-Player-affects-spawning-API.patch b/Spigot-Server-Patches/0029-Player-affects-spawning-API.patch deleted file mode 100644 index 9df865651e..0000000000 --- a/Spigot-Server-Patches/0029-Player-affects-spawning-API.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 63eabb4da69bdf01854b63c4ee9af7a744a1a9a1 Mon Sep 17 00:00:00 2001 -From: Jedediah Smith -Date: Sun, 21 Sep 2014 22:02:02 -0500 -Subject: [PATCH] Player affects spawning API - - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 35b5cfb..114f406 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -42,6 +42,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - public boolean sleeping; // protected -> public - public boolean fauxSleeping; - public String spawnWorld = ""; -+ public boolean affectsSpawning = true; // PaperSpigot - - @Override - public CraftHumanEntity getBukkitEntity() { -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 2d35a8d..cbef9b6 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -379,7 +379,7 @@ public abstract class EntityInsentient extends EntityLiving { - if (this.persistent) { - this.aU = 0; - } else { -- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); -+ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot - - if (entityhuman != null) { - double d0 = entityhuman.locX - this.locX; -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 2276905..26fa93e 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -46,7 +46,7 @@ public abstract class MobSpawnerAbstract { - } - - public boolean f() { -- return this.a().findNearbyPlayer((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null; -+ return this.a().findNearbyPlayerWhoAffectsSpawning((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null; // PaperSpigot - } - - public void g() { -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 75427b5..7b30362 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -55,6 +55,10 @@ public final class SpawnerCreature { - - for (i = 0; i < worldserver.players.size(); ++i) { - EntityHuman entityhuman = (EntityHuman) worldserver.players.get(i); -+ // PaperSpigot start - Affects spawning API -+ if (!entityhuman.affectsSpawning) -+ continue; -+ // PaperSpigot end - int k = MathHelper.floor(entityhuman.locX / 16.0D); - - j = MathHelper.floor(entityhuman.locZ / 16.0D); -@@ -154,7 +158,7 @@ public final class SpawnerCreature { - float f1 = (float) i3; - float f2 = (float) j3 + 0.5F; - -- if (worldserver.findNearbyPlayer((double) f, (double) f1, (double) f2, 24.0D) == null) { -+ if (worldserver.findNearbyPlayerWhoAffectsSpawning((double) f, (double) f1, (double) f2, 24.0D) == null) { // PaperSpigot - float f3 = f - (float) chunkcoordinates.x; - float f4 = f1 - (float) chunkcoordinates.y; - float f5 = f2 - (float) chunkcoordinates.z; -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 717be3b..33c228b 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -2847,6 +2847,34 @@ public abstract class World implements IBlockAccess { - return entityhuman; - } - -+ // PaperSpigot start - Find players with the spawning flag -+ public EntityHuman findNearbyPlayerWhoAffectsSpawning(Entity entity, double radius) { -+ return this.findNearbyPlayerWhoAffectsSpawning(entity.locX, entity.locY, entity.locZ, radius); -+ } -+ -+ public EntityHuman findNearbyPlayerWhoAffectsSpawning(double x, double y, double z, double radius) { -+ double nearestRadius = - 1.0D; -+ EntityHuman entityHuman = null; -+ -+ for (int i = 0; i < this.players.size(); ++i) { -+ EntityHuman nearestPlayer = (EntityHuman) this.players.get(i); -+ -+ if (nearestPlayer == null || nearestPlayer.dead || !nearestPlayer.affectsSpawning) { -+ continue; -+ } -+ -+ double distance = nearestPlayer.e(x, y, z); -+ -+ if ((radius < 0.0D || distance < radius * radius) && (nearestRadius == -1.0D || distance < nearestRadius)) { -+ nearestRadius = distance; -+ entityHuman = nearestPlayer; -+ } -+ } -+ -+ return entityHuman; -+ } -+ // PaperSpigot end -+ - public EntityHuman a(String s) { - for (int i = 0; i < this.players.size(); ++i) { - EntityHuman entityhuman = (EntityHuman) this.players.get(i); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a282b68..096615e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1449,6 +1449,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - packet.components = components; - getHandle().playerConnection.sendPacket( packet ); - } -+ -+ // PaperSpigot start - Add affects spawning API -+ public void setAffectsSpawning(boolean affects) { -+ getHandle().affectsSpawning = affects; -+ } -+ -+ public boolean getAffectsSpawning() { -+ return getHandle().affectsSpawning; -+ } -+ // PaperSpigot end -+ - }; - - public Player.Spigot spigot() --- -1.9.1 - diff --git a/Spigot-Server-Patches/0035-Remove-specific-entities-that-fly-through-an-unloade.patch b/Spigot-Server-Patches/0030-Remove-specific-entities-that-fly-through-an-unloade.patch similarity index 80% rename from Spigot-Server-Patches/0035-Remove-specific-entities-that-fly-through-an-unloade.patch rename to Spigot-Server-Patches/0030-Remove-specific-entities-that-fly-through-an-unloade.patch index 6d8f512895..43bbffb250 100644 --- a/Spigot-Server-Patches/0035-Remove-specific-entities-that-fly-through-an-unloade.patch +++ b/Spigot-Server-Patches/0030-Remove-specific-entities-that-fly-through-an-unloade.patch @@ -1,15 +1,15 @@ -From 6b8e8f9d3a433a7bea59b5d3f77262a383ce3399 Mon Sep 17 00:00:00 2001 +From 35c03515abddae64498a2d966183bf1ca0c497b2 Mon Sep 17 00:00:00 2001 From: Iceee -Date: Fri, 29 Aug 2014 20:33:52 -0500 +Date: Fri, 28 Nov 2014 12:11:03 -0600 Subject: [PATCH] Remove specific entities that fly through an unloaded chunk diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 5dc7e95..28749c1 100644 +index 1e5f057..bf9dfbf 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -120,6 +120,7 @@ public abstract class Entity { - public EnumEntitySize as; +@@ -119,6 +119,7 @@ public abstract class Entity implements ICommandListener { + private final CommandObjectiveExecutor as; public boolean valid; // CraftBukkit public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only + public boolean inUnloadedChunk = false; // PaperSpigot - Remove entities in unloaded chunks @@ -17,11 +17,11 @@ index 5dc7e95..28749c1 100644 // Spigot start public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java -index 336b6b0..9376a1d 100644 +index 1658cb0..63d88e6 100644 --- a/src/main/java/net/minecraft/server/EntityEnderPearl.java +++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java -@@ -21,6 +21,12 @@ public class EntityEnderPearl extends EntityProjectile { - movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0.0F); +@@ -19,6 +19,12 @@ public class EntityEnderPearl extends EntityProjectile { + movingobjectposition.entity.damageEntity(DamageSource.projectile(this, entityliving), 0.0F); } + // PaperSpigot start - Remove entities in unloaded chunks @@ -31,62 +31,65 @@ index 336b6b0..9376a1d 100644 + // PaperSpigot end + for (int i = 0; i < 32; ++i) { - this.world.addParticle("portal", this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian()); + this.world.addParticle(EnumParticle.PORTAL, this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian(), new int[0]); } diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 00dcca6..715f6d0 100644 +index 81a5dc9..336e575 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -67,6 +67,11 @@ public class EntityFallingBlock extends Entity { - ++this.ticksLived; +@@ -70,6 +70,12 @@ public class EntityFallingBlock extends Entity { this.motY -= 0.03999999910593033D; this.move(this.motX, this.motY, this.motZ); + + // PaperSpigot start - Remove entities in unloaded chunks + if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedFallingBlocks) { + this.die(); + } + // PaperSpigot end - ++ // PaperSpigot start - Drop falling blocks above the specified height if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) { + if (this.dropItem) { diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 1f98f8d..5ce67f5 100644 +index 4823698..7b856ef 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -48,6 +48,12 @@ public class EntityTNTPrimed extends Entity { +@@ -47,6 +47,14 @@ public class EntityTNTPrimed extends Entity { this.lastZ = this.locZ; this.motY -= 0.03999999910593033D; this.move(this.motX, this.motY, this.motZ); ++ + // PaperSpigot start - Remove entities in unloaded chunks + if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedTNTEntities) { + this.die(); + this.fuseTicks = 2; + } + // PaperSpigot end ++ this.motX *= 0.9800000190734863D; this.motY *= 0.9800000190734863D; this.motZ *= 0.9800000190734863D; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 3bf2af0..1977c6c 100644 +index 13a6169..c217a91 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1245,6 +1245,7 @@ public abstract class World implements IBlockAccess { +@@ -1138,6 +1138,7 @@ public abstract class World implements IBlockAccess { { - if ( !this.isChunkLoaded( chunkx, chunkz ) ) + if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) { + entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks continue; } int cz = chunkz << 4; -@@ -1607,6 +1608,14 @@ public abstract class World implements IBlockAccess { +@@ -1555,6 +1556,14 @@ public abstract class World implements IBlockAccess { if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { entity.ticksLived++; entity.inactiveTick(); + // PaperSpigot start - Remove entities in unloaded chunks -+ if (entity instanceof EntityEnderPearl || (!this.isChunkLoaded(i, j) && ++ if (entity instanceof EntityEnderPearl || (!this.isChunkLoaded(i, j, true) && + (entity instanceof EntityFallingBlock && this.paperSpigotConfig.removeUnloadedFallingBlocks) || + (entity instanceof EntityTNTPrimed && this.paperSpigotConfig.removeUnloadedTNTEntities))) { -+ entity.inUnloadedChunk = true; ++ entity.inUnloadedChunk = true; + entity.die(); + } + // PaperSpigot end @@ -94,10 +97,10 @@ index 3bf2af0..1977c6c 100644 entity.tickTimer.startTiming(); // Spigot // CraftBukkit end diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 7842d69..f80c075 100644 +index 0642f12..9507ab5 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -178,4 +178,14 @@ public class PaperSpigotWorldConfig +@@ -170,4 +170,14 @@ public class PaperSpigotWorldConfig removeInvalidMobSpawnerTEs = getBoolean( "remove-invalid-mob-spawner-tile-entities", true ); log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs ); } diff --git a/Spigot-Server-Patches/0036-Configurable-strength-and-weakness-effect-modifiers.patch b/Spigot-Server-Patches/0031-Configurable-strength-and-weakness-effect-modifiers.patch similarity index 74% rename from Spigot-Server-Patches/0036-Configurable-strength-and-weakness-effect-modifiers.patch rename to Spigot-Server-Patches/0031-Configurable-strength-and-weakness-effect-modifiers.patch index 9ac5ef2be1..e00ec02bbe 100644 --- a/Spigot-Server-Patches/0036-Configurable-strength-and-weakness-effect-modifiers.patch +++ b/Spigot-Server-Patches/0031-Configurable-strength-and-weakness-effect-modifiers.patch @@ -1,28 +1,20 @@ -From d44dc1fcfe556710513b393b70f2626e705a41e2 Mon Sep 17 00:00:00 2001 +From a9bcbb534f1d780a4f7878fe12d192f16c722348 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Sun, 31 Aug 2014 12:13:32 -0500 +Date: Fri, 28 Nov 2014 12:23:02 -0600 Subject: [PATCH] Configurable strength and weakness effect modifiers diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -index 3eb029d..c448789 100644 +index 620685a..175503b 100644 --- a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java +++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import org.github.paperspigot.PaperSpigotConfig; -+ - public class MobEffectAttackDamage extends MobEffectList { - - protected MobEffectAttackDamage(int i, boolean flag, int j) { -@@ -7,6 +9,7 @@ public class MobEffectAttackDamage extends MobEffectList { +@@ -7,6 +7,7 @@ public class MobEffectAttackDamage extends MobEffectList { } public double a(int i, AttributeModifier attributemodifier) { - return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1); + // PaperSpigot - Configurable modifiers for strength and weakness effects -+ return this.id == MobEffectList.WEAKNESS.id ? (double) (PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : PaperSpigotConfig.strengthEffectModifier * (double) (i + 1); ++ return this.id == MobEffectList.WEAKNESS.id ? (double) (org.github.paperspigot.PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : org.github.paperspigot.PaperSpigotConfig.strengthEffectModifier * (double) (i + 1); } } diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java diff --git a/Spigot-Server-Patches/0032-Temporary-fix-for-rails-dupe.patch b/Spigot-Server-Patches/0032-Temporary-fix-for-rails-dupe.patch new file mode 100644 index 0000000000..23cd3fa271 --- /dev/null +++ b/Spigot-Server-Patches/0032-Temporary-fix-for-rails-dupe.patch @@ -0,0 +1,28 @@ +From a18ea39b2bb1e238ab951f1b30209bd2d40d8de0 Mon Sep 17 00:00:00 2001 +From: Dmck2b +Date: Fri, 28 Nov 2014 12:30:47 -0600 +Subject: [PATCH] Temporary fix for rails dupe + + +diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java +index 063177d..f1e299f 100644 +--- a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java ++++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java +@@ -84,8 +84,12 @@ public abstract class BlockMinecartTrackAbstract extends Block { + } + + if (flag) { +- this.b(world, blockposition, iblockdata, 0); +- world.setAir(blockposition); ++ // PaperSpigot start - Rails dupe workaround ++ if (world.getType(blockposition).getBlock().getMaterial() != Material.AIR) { ++ this.b(world, blockposition, iblockdata, 0); ++ world.setAir(blockposition); ++ } ++ // PaperSpigot end + } else { + this.b(world, blockposition, iblockdata, block); + } +-- +1.9.1 + diff --git a/Spigot-Server-Patches/0040-Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/0033-Further-improve-server-tick-loop.patch similarity index 82% rename from Spigot-Server-Patches/0040-Further-improve-server-tick-loop.patch rename to Spigot-Server-Patches/0033-Further-improve-server-tick-loop.patch index a6fc8f133e..b6edf75d33 100644 --- a/Spigot-Server-Patches/0040-Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/0033-Further-improve-server-tick-loop.patch @@ -1,6 +1,6 @@ -From c6bcae3d4cf7234371b1a75dceba995b8a82713f Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 19 Oct 2014 15:56:39 -0500 +From 0a8abf013236bcecd16ad30c61c62d4f9aa85dfd Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Fri, 28 Nov 2014 12:48:26 -0600 Subject: [PATCH] Further improve server tick loop Improves how the catchup buffer is handled, allowing it to roll both ways @@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fa10ea1..953a88c 100644 +index bdaf6fb..189fe12 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -102,17 +102,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -113,17 +113,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public ConsoleReader reader; @@ -32,9 +32,9 @@ index fa10ea1..953a88c 100644 - public final double[] recentTps = new double[ 3 ]; - // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet - net.minecraft.util.io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable -@@ -446,12 +440,53 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo + public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable +@@ -484,12 +478,53 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs this.isRunning = false; } @@ -49,8 +49,8 @@ index fa10ea1..953a88c 100644 + private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; + private static final int SAMPLE_INTERVAL = 20; + public final RollingAverage tps1 = new RollingAverage(60); -+ public final RollingAverage tps5 = new RollingAverage(60*5); -+ public final RollingAverage tps15 = new RollingAverage(60*15); ++ public final RollingAverage tps5 = new RollingAverage(60 * 5); ++ public final RollingAverage tps15 = new RollingAverage(60 * 15); + + public static class RollingAverage { + private final int size; @@ -74,11 +74,11 @@ index fa10ea1..953a88c 100644 + + public void add(double x, long t) { + time -= times[index]; -+ total -= samples[index]*times[index]; ++ total -= samples[index] * times[index]; + samples[index] = x; + times[index] = t; + time += t; -+ total += x*t; ++ total += x * t; + if (++index == size) { + index = 0; + } @@ -93,8 +93,8 @@ index fa10ea1..953a88c 100644 public void run() { try { -@@ -464,26 +499,45 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo - this.a(this.q); +@@ -502,26 +537,43 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.a(this.r); // Spigot start - Arrays.fill( recentTps, 20 ); @@ -132,15 +132,13 @@ index fa10ea1..953a88c 100644 - if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait); -+ // Paperspigot end + -+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) // PaperSpigot - Further improve tick loop ++ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) { - double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL; - recentTps[0] = calcTps( recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min) - recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min) - recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min) -+ // PaperSpigot start - Further improve tick loop + final long diff = curTime - tickSection; + double currentTps = 1E9 / diff * SAMPLE_INTERVAL; + tps1.add(currentTps, diff); @@ -152,12 +150,12 @@ index fa10ea1..953a88c 100644 lastTick = curTime; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1548042..ed5bb2e 100644 +index 239cbd7..dca6f17 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1842,6 +1842,17 @@ public final class CraftServer implements Server { - return org.spigotmc.SpigotConfig.config; - } +@@ -1681,6 +1681,17 @@ public final class CraftServer implements Server { + private final Spigot spigot = new Spigot() + { + // PaperSpigot start - Add getTPS (Further improve tick loop) + @Override @@ -171,24 +169,22 @@ index 1548042..ed5bb2e 100644 + // PaperSpigot end + @Override - public void broadcast( BaseComponent component ) + public YamlConfiguration getConfig() { diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -index 2b8343d..1780e35 100644 +index be2e31d..21fd7ef 100644 --- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -@@ -1,8 +1,7 @@ +@@ -1,8 +1,5 @@ package org.spigotmc; -import com.google.common.base.Joiner; -import net.minecraft.server.MinecraftServer; --import net.minecraft.util.com.google.common.collect.Iterables; -+import org.apache.commons.lang.StringUtils; -+import org.bukkit.Bukkit; +-import com.google.common.collect.Iterables; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -@@ -26,18 +25,21 @@ public class TicksPerSecondCommand extends Command +@@ -26,18 +23,19 @@ public class TicksPerSecondCommand extends Command return true; } @@ -198,16 +194,14 @@ index 2b8343d..1780e35 100644 - sb.append( format( tps ) ); - sb.append( ", " ); + // PaperSpigot start - Further improve tick handling -+ double[] tps = Bukkit.spigot().getTPS(); ++ double[] tps = org.bukkit.Bukkit.spigot().getTPS(); + String[] tpsAvg = new String[tps.length]; + -+ for ( int i = 0; i < tps.length; i++) { -+ tpsAvg[i] = format( tps[i] ); ++ for ( int i = 0; i < tps.length; i++) { ++ tpsAvg[i] = format( tps[i] ); } - sender.sendMessage( sb.substring( 0, sb.length() - 2 ) ); -+ -+ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + StringUtils.join(tpsAvg, ", ")); -+ // PaperSpigot end ++ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); return true; } diff --git a/Spigot-Server-Patches/0034-Improve-Network-Manager-packet-handling.patch b/Spigot-Server-Patches/0034-Improve-Network-Manager-packet-handling.patch new file mode 100644 index 0000000000..005b7b5f37 --- /dev/null +++ b/Spigot-Server-Patches/0034-Improve-Network-Manager-packet-handling.patch @@ -0,0 +1,28 @@ +From cad30db92a21978282fda86eed2351308d6b05e2 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 28 Nov 2014 13:12:00 -0600 +Subject: [PATCH] Improve Network Manager packet handling + +Removes an unnecessary "peek at head of queue" + +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index e34f0f1..146ab2e 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -144,9 +144,10 @@ public class NetworkManager extends SimpleChannelInboundHandler { + + private void m() { + if (this.i != null && this.i.isOpen()) { +- while (!this.h.isEmpty()) { +- QueuedPacket queuedpacket = (QueuedPacket) this.h.poll(); +- ++ // PaperSpigot start - Improve Network Manager packet handling ++ QueuedPacket queuedpacket; ++ while ((queuedpacket = (QueuedPacket) this.h.poll()) != null) { ++ // PaperSpigot end + this.a(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket)); + } + +-- +1.9.1 + diff --git a/Spigot-Server-Patches/0034-Move-sound-handling-out-of-the-chest-tick-loop.patch b/Spigot-Server-Patches/0034-Move-sound-handling-out-of-the-chest-tick-loop.patch deleted file mode 100644 index bcc91c1309..0000000000 --- a/Spigot-Server-Patches/0034-Move-sound-handling-out-of-the-chest-tick-loop.patch +++ /dev/null @@ -1,151 +0,0 @@ -From a887cb0c9a96e9f90b3c2b31850fe06bd019c0d5 Mon Sep 17 00:00:00 2001 -From: Iceee -Date: Mon, 11 Aug 2014 23:03:47 -0500 -Subject: [PATCH] Move sound handling out of the chest tick loop - -This allows us to disable ticking chests and enderchests without any -noticeable difference to players - -diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index e27716b..69ffd30 100644 ---- a/src/main/java/net/minecraft/server/TileEntityChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -275,6 +275,9 @@ public class TileEntityChest extends TileEntity implements IInventory { - } - - this.n = this.m; -+ -+ // PaperSpigot start - Move chest sound handling out of the tick loop -+ /* - f = 0.1F; - double d0; - -@@ -327,6 +330,8 @@ public class TileEntityChest extends TileEntity implements IInventory { - this.m = 0.0F; - } - } -+ */ -+ // PaperSpigot end - } - - public boolean c(int i, int j) { -@@ -349,6 +354,26 @@ public class TileEntityChest extends TileEntity implements IInventory { - if (this.world == null) return; // CraftBukkit - this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o); - -+ // PaperSpigot start - Move chest open sound handling down to here -+ this.i(); -+ double d0; -+ -+ if (this.o > 0 && this.m == 0.0F && this.i == null && this.k == null) { -+ double d1 = (double) this.x + 0.5D; -+ -+ d0 = (double) this.z + 0.5D; -+ if (this.l != null) { -+ d0 += 0.5D; -+ } -+ -+ if (this.j != null) { -+ d1 += 0.5D; -+ } -+ -+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // PaperSpigot end -+ - // CraftBukkit start - Call redstone event - if (this.q() == Blocks.TRAPPED_CHEST) { - int newPower = Math.max(0, Math.min(15, this.o)); -@@ -371,6 +396,26 @@ public class TileEntityChest extends TileEntity implements IInventory { - if (this.world == null) return; // CraftBukkit - this.world.playBlockAction(this.x, this.y, this.z, this.q(), 1, this.o); - -+ // PaperSpigot start - Move chest close sound handling down to here -+ this.i(); -+ double d0; -+ -+ if (this.o == 0 && this.i == null && this.k == null) { -+ d0 = (double) this.x + 0.5D; -+ double d2 = (double) this.z + 0.5D; -+ -+ if (this.l != null) { -+ d2 += 0.5D; -+ } -+ -+ if (this.j != null) { -+ d0 += 0.5D; -+ } -+ -+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // PaperSpigot end -+ - // CraftBukkit start - Call redstone event - if (this.q() == Blocks.TRAPPED_CHEST) { - int newPower = Math.max(0, Math.min(15, this.o)); -diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -index d76a2b2..339e133 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -16,6 +16,9 @@ public class TileEntityEnderChest extends TileEntity { - } - - this.i = this.a; -+ -+ // PaperSpigot start - Move chest sound handling out of the tick loop -+ /* - float f = 0.1F; - double d0; - -@@ -52,6 +55,8 @@ public class TileEntityEnderChest extends TileEntity { - this.a = 0.0F; - } - } -+ */ -+ // PaperSpigot end - } - - public boolean c(int i, int j) { -@@ -71,11 +76,39 @@ public class TileEntityEnderChest extends TileEntity { - public void a() { - ++this.j; - this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); -+ -+ // PaperSpigot start - Move chest open sound handling down to here -+ double d0; -+ -+ if (this.j > 0 && this.a == 0.0F) { -+ double d1 = (double) this.x + 0.5D; -+ -+ d0 = (double) this.z + 0.5D; -+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // PaperSpigot end - } - - public void b() { - --this.j; - this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j); -+ -+ // PaperSpigot start - Move chest close sound handling down to here -+ float f = 0.1F; -+ double d0; -+ -+ if (this.j == 0 && this.a == 0.0F || this.j > 0 && this.a < 1.0F) { -+ float f1 = this.a; -+ d0 = (double) this.x + 0.5D; -+ double d2 = (double) this.z + 0.5D; -+ -+ this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ -+ if (this.a < 0.0F) { -+ this.a = 0.0F; -+ } -+ } -+ // PaperSpigot end - } - - public boolean a(EntityHuman entityhuman) { --- -1.9.1 - diff --git a/Spigot-Server-Patches/0042-Only-refresh-abilities-if-needed.patch b/Spigot-Server-Patches/0035-Only-refresh-abilities-if-needed.patch similarity index 79% rename from Spigot-Server-Patches/0042-Only-refresh-abilities-if-needed.patch rename to Spigot-Server-Patches/0035-Only-refresh-abilities-if-needed.patch index c5a69fbb9d..9482f51c51 100644 --- a/Spigot-Server-Patches/0042-Only-refresh-abilities-if-needed.patch +++ b/Spigot-Server-Patches/0035-Only-refresh-abilities-if-needed.patch @@ -1,16 +1,16 @@ -From 08fbd413515b6fdb8bb299485d9bd60bbe62c24b Mon Sep 17 00:00:00 2001 +From 07feba646b55b7fd060fb91bdcc66c2d7f8b3baa Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 19 Oct 2014 16:04:28 -0500 +Date: Fri, 28 Nov 2014 13:20:22 -0600 Subject: [PATCH] Only refresh abilities if needed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 096615e..73ec0f7 100644 +index 914187d..6da3b32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1176,12 +1176,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } +@@ -1174,12 +1174,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + @Override public void setFlying(boolean value) { + boolean needsUpdate = getHandle().abilities.canFly != value; // PaperSpigot - Only refresh abilities if needed if (!getAllowFlight() && value) { @@ -22,7 +22,7 @@ index 096615e..73ec0f7 100644 + if (needsUpdate) getHandle().updateAbilities(); // PaperSpigot - Only refresh abilities if needed } - public boolean getAllowFlight() { + @Override -- 1.9.1 diff --git a/Spigot-Server-Patches/0043-Player-lookup-improvements.patch b/Spigot-Server-Patches/0036-Player-lookup-improvements.patch similarity index 77% rename from Spigot-Server-Patches/0043-Player-lookup-improvements.patch rename to Spigot-Server-Patches/0036-Player-lookup-improvements.patch index c1beef2c29..0a64fdc109 100644 --- a/Spigot-Server-Patches/0043-Player-lookup-improvements.patch +++ b/Spigot-Server-Patches/0036-Player-lookup-improvements.patch @@ -1,6 +1,6 @@ -From 6011f2fe47906285314092df74e56b75b73722a7 Mon Sep 17 00:00:00 2001 +From 0d9f4bc43cd3f638de483f1c7b9139896c888bba Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 19 Oct 2014 16:26:55 -0500 +Date: Fri, 28 Nov 2014 13:43:11 -0600 Subject: [PATCH] Player lookup improvements Minecraft and CraftBukkit both use Arrays to store online players, @@ -13,11 +13,11 @@ By using a map based approach for player lookups, player lookup should be consistent in performance regardless of how many players are online. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 79fc999..c6dca57 100644 +index 04d9be9..9595b54 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -49,6 +49,39 @@ public abstract class PlayerList { - private static final SimpleDateFormat h = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); +@@ -48,6 +48,39 @@ public abstract class PlayerList { + private static final SimpleDateFormat i = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); private final MinecraftServer server; public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety + // PaperSpigot start - Player lookup improvements @@ -30,7 +30,7 @@ index 79fc999..c6dca57 100644 + @Override + public EntityPlayer get(Object key) { + // put the .playerConnection check done in other places here -+ EntityPlayer player = super.get(key instanceof String ? ((String)key).toLowerCase() : key); ++ EntityPlayer player = super.get(key instanceof String ? ((String) key).toLowerCase() : key); + return (player != null && player.playerConnection != null) ? player : null; + } + @@ -41,58 +41,58 @@ index 79fc999..c6dca57 100644 + + @Override + public EntityPlayer remove(Object key) { -+ return super.remove(key instanceof String ? ((String)key).toLowerCase() : key); ++ return super.remove(key instanceof String ? ((String) key).toLowerCase() : key); + } + }; + public final Map uuidMap = new java.util.HashMap() { + @Override + public EntityPlayer get(Object key) { + // put the .playerConnection check done in other places here -+ EntityPlayer player = super.get(key instanceof String ? ((String)key).toLowerCase() : key); ++ EntityPlayer player = super.get(key instanceof String ? ((String) key).toLowerCase() : key); + return (player != null && player.playerConnection != null) ? player : null; + } + }; + // PaperSpigot end - private final GameProfileBanList j; - private final IpBanList k; - private final OpList operators; -@@ -258,6 +291,8 @@ public abstract class PlayerList { - cserver.detectListNameConflict(entityplayer); // CraftBukkit - // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below + public final Map f = Maps.newHashMap(); + private final GameProfileBanList k; + private final IpBanList l; +@@ -253,6 +286,8 @@ public abstract class PlayerList { + + public void onPlayerJoin(EntityPlayer entityplayer) { this.players.add(entityplayer); + this.playerMap.put(entityplayer.getName(), entityplayer); // PaperSpigot + this.uuidMap.put(entityplayer.getUniqueID(), entityplayer); // PaperSpigot + this.f.put(entityplayer.getUniqueID(), entityplayer); + // this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); // CraftBukkit - replaced with loop below WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); - - // CraftBukkit start -@@ -344,6 +379,8 @@ public abstract class PlayerList { +@@ -324,6 +359,8 @@ public abstract class PlayerList { worldserver.kill(entityplayer); worldserver.getPlayerChunkMap().removePlayer(entityplayer); this.players.remove(entityplayer); + this.uuidMap.remove(entityplayer.getUniqueID()); // PaperSpigot + this.playerMap.remove(entityplayer.getName()); // PaperSpigot - this.n.remove(entityplayer.getUniqueID()); - ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit - -@@ -424,6 +461,7 @@ public abstract class PlayerList { + this.f.remove(entityplayer.getUniqueID()); + this.o.remove(entityplayer.getUniqueID()); + // CraftBukkit start +@@ -403,6 +440,8 @@ public abstract class PlayerList { EntityPlayer entityplayer; -+ /* // PaperSpigot start - Use exact lookup below ++ // PaperSpigot - Use exact lookup below ++ /* for (int i = 0; i < this.players.size(); ++i) { entityplayer = (EntityPlayer) this.players.get(i); if (entityplayer.getUniqueID().equals(uuid)) { -@@ -435,6 +473,9 @@ public abstract class PlayerList { +@@ -414,6 +453,8 @@ public abstract class PlayerList { while (iterator.hasNext()) { entityplayer = (EntityPlayer) iterator.next(); + */ + if ((entityplayer = uuidMap.get(uuid)) != null) { -+ // PaperSpigot end entityplayer.playerConnection.disconnect("You logged in from another location"); } -@@ -952,6 +993,7 @@ public abstract class PlayerList { +@@ -924,6 +965,7 @@ public abstract class PlayerList { } public EntityPlayer getPlayer(String s) { @@ -101,7 +101,7 @@ index 79fc999..c6dca57 100644 EntityPlayer entityplayer; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -index 1328c17..f1fa713 100644 +index 8be0698..1dc9fb3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -144,14 +144,10 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa @@ -124,10 +124,10 @@ index 1328c17..f1fa713 100644 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ed5bb2e..87eab98 100644 +index dca6f17..2845152 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -522,7 +522,12 @@ public final class CraftServer implements Server { +@@ -397,7 +397,12 @@ public final class CraftServer implements Server { public Player getPlayer(final String name) { Validate.notNull(name, "Name cannot be null"); @@ -141,12 +141,10 @@ index ed5bb2e..87eab98 100644 String lowerName = name.toLowerCase(); int delta = Integer.MAX_VALUE; for (Player player : getOnlinePlayers()) { -@@ -541,17 +546,10 @@ public final class CraftServer implements Server { - @Override - @Deprecated +@@ -418,27 +423,19 @@ public final class CraftServer implements Server { public Player getPlayerExact(String name) { -- Validate.notNull(name, "Name cannot be null"); -- + Validate.notNull(name, "Name cannot be null"); + - String lname = name.toLowerCase(); - - for (Player player : getOnlinePlayers()) { @@ -159,15 +157,31 @@ index ed5bb2e..87eab98 100644 + // PaperSpigot start - Improved player lookup, replace whole method + EntityPlayer player = playerList.playerMap.get(name); + return player != null ? player.getBukkitEntity() : null; -+ // PaperSpigot end ++ // PaperSpigot end } // TODO: In 1.8+ this should use the server's UUID->EntityPlayer map + @Override + public Player getPlayer(UUID id) { +- for (Player player : getOnlinePlayers()) { +- if (player.getUniqueId().equals(id)) { +- return player; +- } +- } +- +- return null; ++ // PaperSpigot start - Improved player lookup, replace whole method ++ EntityPlayer player = playerList.uuidMap.get(id); ++ return player != null ? player.getBukkitEntity() : null; ++ // PaperSpigot end + } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 73ec0f7..52760c0 100644 +index 6da3b32..7f55310 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -102,13 +102,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -103,13 +103,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public boolean isOnline() { diff --git a/Spigot-Server-Patches/0044-Improve-autosave-mechanism.patch b/Spigot-Server-Patches/0037-Improve-autosave-mechanism.patch similarity index 71% rename from Spigot-Server-Patches/0044-Improve-autosave-mechanism.patch rename to Spigot-Server-Patches/0037-Improve-autosave-mechanism.patch index eb40a9b274..7547bfdb80 100644 --- a/Spigot-Server-Patches/0044-Improve-autosave-mechanism.patch +++ b/Spigot-Server-Patches/0037-Improve-autosave-mechanism.patch @@ -1,28 +1,28 @@ -From 38ddbe06c98a3f5e48671e7f11d1542a08406291 Mon Sep 17 00:00:00 2001 +From 1a5cc6ba71f20ad4cf2b739013481cf1ece63736 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 19 Oct 2014 16:30:48 -0500 +Date: Fri, 28 Nov 2014 13:47:24 -0600 Subject: [PATCH] Improve autosave mechanism Only save modified chunks, or chunks with entities after 4 auto save passes diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9454d4f..86a13e7 100644 +index 538ae9c..b840ca7 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -910,7 +910,7 @@ public class Chunk { - if (this.o && this.world.getTime() != this.lastSaved || this.n) { +@@ -927,7 +927,7 @@ public class Chunk { + if (this.r && this.world.getTime() != this.lastSaved || this.q) { return true; } -- } else if (this.o && this.world.getTime() >= this.lastSaved + 600L) { -+ } else if (this.o && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // PaperSpigot - Only save if we've passed 2 auto save intervals without modification +- } else if (this.r && this.world.getTime() >= this.lastSaved + 600L) { ++ } else if (this.r && this.world.getTime() >= + MinecraftServer.getServer().autosavePeriod * 4) { // PaperSpigot - Only save if we've passed 2 auto save intervals without modification return true; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 953a88c..692e74f 100644 +index 189fe12..d585369 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -657,9 +657,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo +@@ -696,9 +696,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs // Spigot Start // We replace this with saving each individual world as this.saveChunks(...) is broken, // and causes the main thread to sleep for random amounts of time depending on chunk activity @@ -35,10 +35,10 @@ index 953a88c..692e74f 100644 server.playerCommandState = false; // this.saveChunks(true); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ea786ae..d67ba8f 100644 +index d5ea292..9bff318 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -687,12 +687,18 @@ public class CraftWorld implements World { +@@ -688,12 +688,18 @@ public class CraftWorld implements World { } public void save() { @@ -54,7 +54,7 @@ index ea786ae..d67ba8f 100644 world.savingDisabled = false; - world.save(true, null); -+ world.save(forceSave, null); // PaperSpigot ++ world.save(forceSave, null); world.savingDisabled = oldSave; } catch (ExceptionWorldConflict ex) { diff --git a/Spigot-Server-Patches/0037-Temporary-fix-for-rails-dupe.patch b/Spigot-Server-Patches/0037-Temporary-fix-for-rails-dupe.patch deleted file mode 100644 index 52352e3894..0000000000 --- a/Spigot-Server-Patches/0037-Temporary-fix-for-rails-dupe.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2dd27493a7bfd7ab89aec74f16473575e64f93e6 Mon Sep 17 00:00:00 2001 -From: Dmck2b -Date: Sun, 31 Aug 2014 18:12:10 +0100 -Subject: [PATCH] Temporary fix for rails dupe - - -diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -index d36aacb..b6b4146 100644 ---- a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -+++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -@@ -105,8 +105,12 @@ public abstract class BlockMinecartTrackAbstract extends Block { - } - - if (flag) { -- this.b(world, i, j, k, world.getData(i, j, k), 0); -- world.setAir(i, j, k); -+ // PaperSpigot start - Rails dupe workaround -+ if (world.getType(i, j, k).getMaterial() != Material.AIR) { -+ this.b(world, i, j, k, world.getData(i, j, k), 0); -+ world.setAir(i, j, k); -+ } -+ // PaperSpigot end - } else { - this.a(world, i, j, k, l, i1, block); - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0045-Configurable-game-mechanics-changes.patch b/Spigot-Server-Patches/0038-Configurable-game-mechanics-changes.patch similarity index 56% rename from Spigot-Server-Patches/0045-Configurable-game-mechanics-changes.patch rename to Spigot-Server-Patches/0038-Configurable-game-mechanics-changes.patch index 6e38a34381..e6d00d16ab 100644 --- a/Spigot-Server-Patches/0045-Configurable-game-mechanics-changes.patch +++ b/Spigot-Server-Patches/0038-Configurable-game-mechanics-changes.patch @@ -1,39 +1,25 @@ -From 87f63a5ecd0f0459f65ccf07aa38b5b47b99a3a8 Mon Sep 17 00:00:00 2001 +From de36e75aad08943806c34e51120a9ce87e0e9b29 Mon Sep 17 00:00:00 2001 From: gsand -Date: Fri, 24 Oct 2014 22:09:58 -0500 +Date: Fri, 28 Nov 2014 13:53:48 -0600 Subject: [PATCH] Configurable game mechanics changes -diff --git a/src/main/java/net/minecraft/server/BlockTorch.java b/src/main/java/net/minecraft/server/BlockTorch.java -index d95aff2..784d4c0 100644 ---- a/src/main/java/net/minecraft/server/BlockTorch.java -+++ b/src/main/java/net/minecraft/server/BlockTorch.java -@@ -32,7 +32,8 @@ public class BlockTorch extends Block { - } else { - Block block = world.getType(i, j, k); - -- return block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL; -+ // PaperSpigot - Allow torch placement on stained glass as well -+ return world.paperSpigotConfig.lessPickyTorches ? block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.STAINED_GLASS || block == Blocks.COBBLE_WALL : block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL; - } - } - diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index c9f2b13..7c4c303 100644 +index dc4f526..45b5ac5 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -337,13 +337,7 @@ public class EntityBoat extends Entity { +@@ -340,13 +340,7 @@ public class EntityBoat extends Entity { if (!destroyEvent.isCancelled()) { this.die(); - for (k = 0; k < 3; ++k) { -- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F); +- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); - } - - for (k = 0; k < 2; ++k) { - this.a(Items.STICK, 1, 0.0F); - } -+ breakNaturally(); // PaperSpigot - Customizable boat drops ++ breakNaturally(); // PaperSpigot } // CraftBukkit end } @@ -41,21 +27,21 @@ index c9f2b13..7c4c303 100644 if (!destroyEvent.isCancelled()) { this.die(); -- int l; +- int i; - -- for (l = 0; l < 3; ++l) { -- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F); +- for (i = 0; i < 3; ++i) { +- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); - } - -- for (l = 0; l < 2; ++l) { +- for (i = 0; i < 2; ++i) { - this.a(Items.STICK, 1, 0.0F); - } -+ breakNaturally(); // PaperSpigot - Customizable boat drops ++ breakNaturally(); // PaperSpigot } // CraftBukkit end } -@@ -495,4 +481,21 @@ public class EntityBoat extends Entity { - public int i() { +@@ -496,4 +482,21 @@ public class EntityBoat extends Entity { + public int m() { return this.datawatcher.getInt(18); } + @@ -67,7 +53,7 @@ index c9f2b13..7c4c303 100644 + this.a(Items.BOAT, 1, 0.0F); + } else { + for (int k = 0; k < 3; ++k) { -+ this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F); ++ this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); + } + + for (int k = 0; k < 2; ++k) { @@ -77,10 +63,10 @@ index c9f2b13..7c4c303 100644 + } } diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index f80c075..6b789e4 100644 +index 9507ab5..f7a256d 100644 --- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -188,4 +188,12 @@ public class PaperSpigotWorldConfig +@@ -180,4 +180,12 @@ public class PaperSpigotWorldConfig removeUnloadedTNTEntities = getBoolean( "remove-unloaded.tnt-entities", true ); removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true ); } diff --git a/Spigot-Server-Patches/0038-PaperSpigot-protocol-warning.patch b/Spigot-Server-Patches/0038-PaperSpigot-protocol-warning.patch deleted file mode 100644 index 63aecc56dd..0000000000 --- a/Spigot-Server-Patches/0038-PaperSpigot-protocol-warning.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ca6ee3b8411b8059ae664b8e5178cf179b49f80c Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sun, 21 Sep 2014 22:10:16 -0500 -Subject: [PATCH] PaperSpigot protocol warning - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ba744b1..0d7a9d6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -160,10 +160,10 @@ public class Main { - } - } - -- System.err.println( "This Spigot build supports Minecraft clients both of versions 1.7.x and of 1.8.x.\n" -+ System.err.println( "This PaperSpigot build only supports Minecraft 1.7.x and 1.8.x clients!\n" - + "*** It is imperative that backups be taken before running this build on your server! ***\n" -- + "Please report any such issues to http://www.spigotmc.org/, stating your client, server, and if applicable BungeeCord versions.\n" -- + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" ); -+ + "Please report issues directly to Paper, and always ensure you're up-to-date!\n" -+ + "*** Any bug reports not running the very latest version of the software will be ignored ***\n\n" ); - - // Spigot end - --- -1.9.1 - diff --git a/Spigot-Server-Patches/0046-Add-async-chunk-load-API.patch b/Spigot-Server-Patches/0039-Add-async-chunk-load-API.patch similarity index 100% rename from Spigot-Server-Patches/0046-Add-async-chunk-load-API.patch rename to Spigot-Server-Patches/0039-Add-async-chunk-load-API.patch diff --git a/Spigot-Server-Patches/0039-Backwards-compatible-PacketPlayOutEntityTeleport-con.patch b/Spigot-Server-Patches/0039-Backwards-compatible-PacketPlayOutEntityTeleport-con.patch deleted file mode 100644 index f05bfbba87..0000000000 --- a/Spigot-Server-Patches/0039-Backwards-compatible-PacketPlayOutEntityTeleport-con.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 8b4d0c8819ed092045e579c6cdfb854e44af037f Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Sat, 13 Sep 2014 02:23:56 -0700 -Subject: [PATCH] Backwards compatible PacketPlayOutEntityTeleport constructor - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -index b637d25..921561c 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -33,6 +33,20 @@ public class PacketPlayOutEntityTeleport extends Packet { - this.heightCorrection = heightCorrection; // Spigot Update - 20140916a - } - -+ /** -+ * PaperSpigot - Backwards compatible PacketPlayOutEntityTeleport contructor -+ */ -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean onGround) { -+ this(i, j, k, l, b0, b1, onGround, false); -+ } -+ -+ /** -+ * PaperSpigot - Backwards compatible PacketPlayOutEntityTeleport contructor -+ */ -+ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1) { -+ this(i, j, k, l, b0, b1, false, false); -+ } -+ - public void a(PacketDataSerializer packetdataserializer) { - this.a = packetdataserializer.readInt(); - this.b = packetdataserializer.readInt(); --- -1.9.1 - diff --git a/Spigot-Server-Patches/0041-Improve-Network-Manager-packet-handling.patch b/Spigot-Server-Patches/0041-Improve-Network-Manager-packet-handling.patch deleted file mode 100644 index fce9b1f7be..0000000000 --- a/Spigot-Server-Patches/0041-Improve-Network-Manager-packet-handling.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 76e7fcd0a61b789ca55fb33bb95be63375ed7f23 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 19 Oct 2014 16:01:51 -0500 -Subject: [PATCH] Improve Network Manager packet handling - -Removes an unnecessary "peek at head of queue", and also makes the number of packets -processed per player per tick configurable, so larger servers can slow down incoming processing. - -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 76a5403..5a5604c 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -154,11 +154,12 @@ public class NetworkManager extends SimpleChannelInboundHandler { - - private void i() { - if (this.m != null && this.m.isOpen()) { -- while (!this.l.isEmpty()) { -- QueuedPacket queuedpacket = (QueuedPacket) this.l.poll(); -- -+ // PaperSpigot start - Improve Network Manager packet handling -+ QueuedPacket queuedpacket; -+ while ((queuedpacket = (QueuedPacket) this.l.poll()) != null) { - this.b(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket)); - } -+ // PaperSpigot end - } - } - -@@ -175,8 +176,10 @@ public class NetworkManager extends SimpleChannelInboundHandler { - } - - if (this.o != null) { -- for (int i = 1000; !this.k.isEmpty() && i >= 0; --i) { -- Packet packet = (Packet) this.k.poll(); -+ // PaperSpigot start - Improve Network Manager packet handling - Configurable packets per player per tick processing -+ Packet packet; -+ for (int i = org.github.paperspigot.PaperSpigotConfig.maxPacketsPerPlayer; (packet = (Packet) this.k.poll()) != null && i >= 0; --i) { -+ // PaperSpigot end - - // CraftBukkit start - if (!this.isConnected() || !this.m.config().isAutoRead()) { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index a7b18e4..df42019 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -169,4 +169,10 @@ public class PaperSpigotConfig - strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D ); - weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D ); - } -+ -+ public static int maxPacketsPerPlayer; -+ private static void maxPacketsPerPlayer() -+ { -+ maxPacketsPerPlayer = getInt( "max-packets-per-player", 1000 ); -+ } - } --- -1.9.1 - diff --git a/applyPatches.sh b/applyPatches.sh index df1518c3fc..fa5c3d0e08 100755 --- a/applyPatches.sh +++ b/applyPatches.sh @@ -8,6 +8,8 @@ function applyPatch { what=$1 target=$2 cd "$basedir/$what" + git fetch + git reset --hard origin/patched git branch -f upstream >/dev/null cd "$basedir" @@ -33,6 +35,7 @@ function applyPatch { echo " Patches applied cleanly to $target" fi } + echo echo "Applying SpigotMC patches to CraftBukkit and Bukkit" echo @@ -40,4 +43,4 @@ applyPatch Bukkit Spigot-API && applyPatch CraftBukkit Spigot-Server echo echo "Applying PaperSpigot patches to Spigot-Server and Spigot-API" echo -applyPatch Spigot-API PaperSpigot-API && applyPatch Spigot-Server PaperSpigot-Server \ No newline at end of file +applyPatch Spigot-API PaperSpigot-API && applyPatch Spigot-Server PaperSpigot-Server diff --git a/pom.xml b/pom.xml index e6529e2c66..807e4a8db8 100644 --- a/pom.xml +++ b/pom.xml @@ -19,8 +19,6 @@ https://github.com/PaperSpigot/Spigot - MinecraftServer - MinecraftRelocate PaperSpigot-Server PaperSpigot-API