should be fully working now as I pretty much fell back to existing
methods so anything touching the unloadQueue set should behave correctly.
And maintained NMS Reflection safe change too
While the previous logic was logically correct, some CB API's before
would request a chunk without removing it from the unload queue.
While this is logically wrong, some plugins seem to be causing unload issues.
This change will make anything using that one API that use to not remove from
queue, no longer remove from queue.
Hopefully other activities on the server will touch the chunk if it REALLY is in use.
Use an optimized method to test if a block position meets a desired light level.
This method benefits from returning as soon as the desired light level matches.
Also Optimize Grass more
Mojang included some sanity checks on arguments passed to the BlockData.
This code results in the Hash look up occuring twice per call, one to test if it exists
and another to retrieve the result.
This code should ideally never be hit, unless mojang released a bad build. We can discover bugs with this as furthur code that never expects a null
would then NPE, so it would not result in hidden issues.
This is super hot code, so removing those checks should give decent gains.
Removing chunks from the unload queue when performing chunk lookups is a costly activity.
It drastically slows down server performance as many methods call getChunkAt, resulting in a bandaid
to skip removing chunks from the unload queue.
This patch optimizes the unload queue to instead use a boolean on the Chunk object itself to mark
if the chunk is active, and then insert into a LinkedList queue.
The benefits here is that all chunk unload queue actions are now O(1) constant time.
A LinkedList will never need to resize, and can be removed from in constant time when
used in a queue like method.
We mark the chunk as active in many places that notify it is still being used, so that
when the chunk unload queue reaches that chunk, and sees the chunk became active again,
it will skip it and move to next.
First, Enchantment order would blow away seeing 2 items as the same,
however the Client forces enchantment list in a certain order, as well
as does the /enchant command. Anvils can insert it into forced order,
causing 2 same items to be considered different.
This change makes unhandled NBT Tags and Enchantments use a sorted tree map,
so they will always be in a consistent order.
Additionally, the old enchantment API was never updated when ItemMeta
was added, resulting in 2 different ways to modify an items enchantments.
For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
If the server lags out and skips multiple ticks, Furnace cooking behavior would not
cook in the expected amount of time as the cook time was not decremented correctly.
This patch ensures that furnaces cook to the correct wall time expectation.
Metadata is not meant to persist reload as things break badly with non primitive types
This will invalidate metadata on reload so it does not crash everything if a plugin uses it.
Under previous behavior, plugins were not able to check if a player had a permission
if it was defined in permissions.yml. there is no clean way for a plugin to fix that either.
This will change the order so that by default, permissions.yml loads BEFORE plugins instead of after.
This gives plugins expected permission checks.
It also helps improve the expected logic, as servers should set the initial defaults, and then let plugins
modify that. Under the previous logic, plugins were unable (cleanly) override permissions.yml.
A config option has been added for those who depend on the previous behavior, but I don't expect that.
Sometimes a chunk region file is closed prematurely, resulting in a "Stream Closed" error on chunk saving.
Ultimately there is a race condition that causes it, but re-trying the save will avoid the issue.
Retry the save 5 times to try our best to avoid rollbacks due to chunk save failures.
Entities collision is checking for scoreboards setting.
This is very heavy to do map lookups for every collision to check
this setting.
So avoid looking up scoreboards and short circuit to the "not on a team"
logic which is most likely to be true.
I don't know what the person who wrote that code was smoking, but I
don't think it was good.
Gets rid of the WeakHashMap that mojang was abusing purely to be lazy
on clean up, and handles registering and deregistering navigation
upon world add/remove operations.
People are able to abuse the way Bukkit handles teleportation across worlds since it provides a built in teleportation safety check.
To abuse the safety check, players are required to get into a location deemed unsafe by Bukkit e.g. be within a chest or door block. While they are in this block, they accept a teleport request from a player within a different world. Once the player teleports, Minecraft will recursively search upwards for a safe location, this could eventually land within a player's skybase.
Example setup to perform the glitch: http://puu.sh/ng3PC/cf072dcbdb.png
The wanted destination was on top of the emerald block however the player ended on top of the diamond block. This only is the case if the player is teleporting between worlds.