Use correct method for getting player's team. Fixes BUKKIT-4050

The method getTeam gets the team from name of, as opposed to getting the
team a player belongs to.

This also addresses BUKKIT-4002 and partially BUKKIT-4044

Remapped by Srg2Source from Bukkit/CraftBukkit@28a404acfc4112b2e2ed6fca361e7ebc36e28d53
Change perspective of team checking. Fixes BUKKIT-4044

The method's return value was being incorrectly calculated from the
perspective of this.canHurt(that), where it's actually used from the
this.canBeHurtBy(that) perspective.

Remapped by Srg2Source from Bukkit/CraftBukkit@07e33d03cfc9048c0fbc961cc7714e77f2bc0d37
Update orebfuscator mode 2 to fix #728: Move ITERATOR to method-local

This will prevent any possible multi-thread whackiness with double-incrementing ITERATOR.

https://github.com/riking/Spigot/commit/a1971ad758a162bc0472b43fc0958719aa090784
https://github.com/EcoCityCraft/Spigot/pull/32
Spigot patch: 0044 Anvil Exploit Fix

https://github.com/EcoCityCraft/Spigot/blob/c7cc53537f4b0e89a2f273cb98e471c42c3fb1bd/CraftBukkit-Patches/0045-Anvil-Exploit-Fix.patch
Spigot patch update: Update netty to 4.0.0.CR1

https://github.com/EcoCityCraft/Spigot/commit/c7cc53537f4b0e89a2f273cb98e471c42c3fb1bd
Fix world ticking (soil hydration, crop growth, leaf decay). Fixes #734.

tickBlocksAndAmbiance() was broken in in build 283 by this merge:
https://github.com/MinecraftPortCentral/MCPC-Plus/commit/6f4d7cf6343d9ba260879f498f2ba3ae7a454fbb
the super.tickBlocksAndAmbiance() call was erroneously removed
during the merge, causing no block ticking to occur.

Re-add the missing call to fix farmland hydration, crop growth, leaf
decay, etc. Closes #734.
Tweak default setting for aggregate-chunkticks

Spigot adds configurable chunk ticking for improved performance.
The default aggregate-chunkticks is well-suited for larger servers,
especially those which choose Spigot over vanilla CraftBukkit for
high-performance. However, on smaller servers this behavior may
be unexpected, leading to confusion when switching from vanilla Forge
to MCPC+.

This commit sets the default aggregate-chunkticks to 0, matching
vanilla behavior. If desired this option can be changed in bukkit.yml,
to Spigot's default of 4 or another value as desired. For more details
on configuring Spigot's features see this guide:
http://www.spigotmc.org/threads/spigot-configuration-guide-last-updated-3-24-2013.802/
Add support for non-enderdragon bosses (e.g. hydra). Fixes #125.

When the Twilight Forest hydra launched its explosive "mortar" attack,
MCPC+ would crash with a ClassCastException while trying to cast the
EntityTFHydra to EntityDragon. This occurred because CraftComplexPart
getParent() hardcodes EntityDragon in getParent().

This commit changes the cast to the more generic Entity class instead
of EntityDragon, adding support for other boss entities. getBukkitEntity()
is implemented in Entity so the same code is called in both cases. The
casting is from the vanilla IEntityMultiPart interface, only implemented by
EntityDragon in vanilla, but in any case will implemented by an
Entity subclass so this cast is safe. Should fix issue #125.
Allow Forge dimension hotloading via DimensionManager.initDimension. Closes #746.
Add .gitattributes to normalize line endings. Fixes BUKKIT-3797
Update coding guidelines for MCPC+
Check connection status before setting scoreboard. Fixes BUKKIT-4064

Two connection status checks were added to setting a scoreboard for a
player. The first checks to see if a player has logged in yet, which
implicates the ability to receive packets. The second checks to affirm
that the CraftPlayer reference is still to a logged in player; setting
it while not logged in would maintain a stale player reference in the
scoreboard manager.

Remapped by Srg2Source from Bukkit/CraftBukkit@98f726e7751d22d3f42b190f75292d878be5fcd6
Fix formatting in avaje ebean
Fix plugin load failure when mods have '+' in their filename. Fixes #748.

When a plugin using ebean (such as SimpleSpawn) loads, it searches
the classpath, including mods. But due to an avaje bug, mod filenames
containing the "+" character (such as Barrels Mod) will be decoded as
a space, and therefore the plugin loading will fail. To fix this we
URL-encode the character before decoding, allowing the plugin to load
successfully. Kinda ugly, open to better fixes..
Add missed CB edit for disabling plugins on server shutdown. Fixes #744.
Boats can only die once.

In certain scenarios a boat can be killed multiple ways in a single tick.
Due to improper guards this can cause the death code to run multiple times
creating item drops. To correct this we insert the appropriate death check.

Remapped by Srg2Source from Bukkit/CraftBukkit@eb3ab5a40453f38a9c08665aafde0a5711afbb72
Fetch tile entities from chunks instead of world. Fixes BUKKIT-4055

When looking up tile entities for a chunk to send to a player we currently
loop through every tile entity in the world checking if it is within the
bounds of the relevant chunk. Instead of doing this we can just use the
tile entities list stored in the chunk to avoid this costly searching.

As a further optimization, we also modify the generic range-based lookup
to use chunks as well. For most lookups this will give a smaller search
pool which will result in faster lookups.

Thanks to @mikeprimm for the idea and most of the implementation.

Remapped by Srg2Source from Bukkit/CraftBukkit@e51c31cea73f3f48b8311657ff55b29fc4f3e451
Correct vehicle movement issues. Fixes BUKKIT-2993, BUKKIT-4056

When a player comes into range of an entity in a vehicle they will often be
sent the spawn packet for the rider before receiving one for the vehicle.
This causes the attachment packet to fail client side because it attempts
to attach the rider to a vehicle that doesn't exist on the client. To
correct this we account for both possible orderings and send the
attachment packet appropriately.

Vanilla also sends an new attach packet every 60 ticks even if the vehicle
has not changed. As this packet is a toggle this resulting in players
teleporting around randomly. Since we handle attachments properly now we
simply revert this section to use the 1.4 logic.

Remapped by Srg2Source from Bukkit/CraftBukkit@3d906d134417cfeefe7f71b916fee4d105e7650f
Various minor performance improvements

Add a check to avoid doing movement work if an entity doesn't move. This
usually will not ever happen in the current server but is useful when it
does and will be more useful in the future.

Only process mob on mob (non-player) collisions every other tick. Players
tend to pack a lot of mobs into a small space (sheep farm, mob grinder, etc)
so they do a lot of work processing collisions. To help alleviate some of
this we only run these calculations every other tick. This has no visible
effect on the client but can be a huge win on the server depending on
circumstances.

Use generic entity inWater checking for squids. Squids have their own logic
currently for determining if they are in water. This check is almost
identical to the generic entity checking which is run anyway. To avoid
doing duplicate work we just remove the squid version. This does not
have any noticeable effect on gameplay since the checks are so similar.

Use HashSet for tile entities instead of ArrayList. Using an ArrayList for
storing tile entities in a world means we have very expensive inserts and
removes that aren't at the end of the array due to the array copy this
causes. This is most noticeable during chunk unload when a large number of
tile entities are removed from the world at once. Using a HashSet here uses
a little more memory but is O(1) for all operations so removes this
bottleneck.

Remapped by Srg2Source from Bukkit/CraftBukkit@ca5b52dedc92ae527f066e7479bc5ea4851b3600
Update Forge addTileEntity edits for CraftBukkit TE collection type change