Commit Graph

1948 Commits

Author SHA1 Message Date
Travis Watkins
58636c2dd8 Don't do case lookups when we have the right case already.
This is a missed part of the original "[Bleeding] Use case from player data
for OfflinePlayer. Fixes BUKKIT-519" commit. It avoids doing (somewhat
expensive) lookups of player data to find the correct capitalization inside
getOfflinePlayers() as we're already loading their name from the player data
and thus have the correct capitalization.
2012-11-18 10:51:52 -06:00
Travis Watkins
1044c32a54 Lower compression level to avoid overloading the thread. Fixes BUKKIT-2963
When sending chunks to a player we use their writer thread to do chunk
compression to avoid blocking the main thread with this work. However,
after a teleport or respawn there are a large number of chunk packets to
process. This causes the thread to spend a long period handling compression
while we continue dumping more chunk packets on it to handle. The result of
this is a noticable delay in getting responses to commands and chat
immediately after teleporting.

Switching to a lower compression level reduces this load and makes our
behavior more like vanilla. We do, however, still give this thread more
work to do so there will likely still be some delay when comparing to
vanilla. The only way to avoid this would be to put chunk compression back
on the main thread and give everyone on the server a poorer experience
instead.
2012-11-18 09:16:50 -06:00
Karl Fritsche
028860399b Implement sound changes for Minecraft 1.4.2 changes. Fixes BUKKIT-2849 2012-11-17 15:06:18 -06:00
James Clarke
a575e6b075 Use correct itemstack for dispenser behavior chaining. Fixes BUKKIT-2886
When an event changes the item to be dispensed we check to see if the new
item has special behavior for dispensing and if so pass it on to that
behavior handler. However, we are actually checking the old itemstack and
passing the new itemstack so this check fails.
2012-11-17 15:06:18 -06:00
EdGruberman
293474d99b [Bleeding] Use case from player data for OfflinePlayer. Fixes BUKKIT-519
If a plugin looks up a player that is offline they may not know the correct
capitalization for the name. In this case they're likely to get it wrong
and since we cache the result even after the player joins the server all
future request for an OfflinePlayer will return one with incorrect case.

When looking up a player who has played on the server before we can
get the correct case from the player data file saved by the server. If
the player has never played before this point we cannot do anything and
will still have the same issue but this is not a solvable problem.
2012-11-17 15:06:18 -06:00
Travis Watkins
20c074ec6c Don't show a player on map if they're vanished. Fixes BUKKIT-1882 2012-11-17 15:06:06 -06:00
Travis Watkins
2d832bf148 Don't kick player when they travel too far. Fixes BUKKIT-2968
If a player travels past 32,000,000 blocks on the X or Z coordinates they
will be kicked for having an illegal position. On kick their player data
is saved which includes their (illegal) position. This means on join they
are immediately kicked again for the same reason and are stuck. Instead of
kicking at all in this case just teleport the player back to their previous
position just like the moved wrongly check does.
2012-11-17 15:00:14 -06:00
James Clarke
bd0868ae1e Implement API for Skeleton and Zombie types. Fixes BUKKIT-2818 2012-11-17 15:00:14 -06:00
Travis Watkins
dca54ff187 Fire BlockSpreadEvent for vine growth. Fixes BUKKIT-1097 2012-11-17 15:00:14 -06:00
Travis Watkins
0c78ce40e5 Add BlockVine.java from mc-dev for diff visibility. 2012-11-17 15:00:14 -06:00
Travis Watkins
9ab40b1ab3 Fire BlockFadeEvent when soil turns back to dirt. Fixes BUKKIT-1854 2012-11-17 14:59:41 -06:00
Travis Watkins
558411692a Don't wait for main thread when processing commands.
In order to correctly handle disconnects for invalid chat we setup a
Waitable and pass it to the main thread then wait for it to be processed.
However, commands are also chat packets and they are already on the main
thread. In this case, waiting will deadlock the server so we should just
do a normal disconnect.
2012-11-17 11:48:22 -06:00
Travis Watkins
9add7d3000 Don't create tile entity when block placement fails. Fixes BUKKIT-2924
End portals can only be placed in the end during the dragon's death.
Attempts to place them outside of this window causes the block to remove
itself. However, we still create the tile entity for the portal which
leads to exceptions spamming the console about a tile entity existing
without the appropriate block. In these cases we should not place the tile
entity at all.
2012-11-16 16:56:49 -06:00
Travis Watkins
d21c5f3871 Ignore empty custom payload packets. Fixes BUKKIT-2957 2012-11-16 16:15:41 -06:00
Wesley Wolfe
6466aa1d25 Use synchronous calls and wait for chat disconnect. Fixes BUKKIT-2946
When invalid chat is detected we currently drop the connection with no
hint as to why as anything else is not allowed while we're off the main
thread. To give valid disconnect reasons and fire proper events instead
pass these off to the main thread and wait for it to process them.
2012-11-16 15:56:13 -06:00
Travis Watkins
82c8cf4234 Update tile entity when interact event is cancelled.
If a plugin cancels a PlayerInteractEvent when left clicking a block the
client may have removed this block if they are in creative mode or if the
block breaks in a single hit. In this case, we need to update the client's
tile entity as well as telling it the block still exists.
2012-11-16 13:46:52 -06:00
Travis Watkins
6952ad1e59 Update CraftBukkit to Minecraft 1.4.5. 2012-11-16 10:13:34 -06:00
feildmaster
8e806550d7 Remove fire ticks if damage has been canceled. Fixes BUKKIT-2933 2012-11-15 19:26:39 -06:00
Travis Watkins
6149fc3e78 Don't thread single chunk compression. Fixes BUKKIT-2927
Packet 51 is used to send updates about large changes to single chunks
and to remove chunks from the client when they get out of range. In the
first case a single packet object is created and queued for all relevant
players. With our current chunk compression scheme this means the first
player to have the packet processed will start the compression and get the
packet correctly but the rest will get garbage.

Since this packet never contains much data it is better to simply handle
compression of it on the main thread like vanilla does instead of putting in
locks and dealing with their overhead and complexity.
2012-11-15 16:09:21 -06:00
Travis Watkins
e1afee008f Update tile entity on client on cancelled block break. Fixes BUKKIT-2935
When a client tries to break a block it assumes it has done so unless told
otherwise by the server. This means the client also wipes out any tile
entity data it has for the block as well. We do not send this data when
updating the client so clients lose things like text on signs, skull type,
etc when they aren't allowed to break the block.
2012-11-14 20:14:47 -06:00
Travis Watkins
df69ea8814 Rework skull dropping. Fixes BUKKIT-2930 and BUKKIT-2820
Skulls need their tile entity in order to create an item correctly when
broken unlike every other block. Instead of sprinkling special cases all
over the code just override dropNaturally for skulls to read from their
tile entity and make sure everything that wants to drop them calls this
method before removing the block. There is only one case where this wasn't
already true so we end up with much less special casing.
2012-11-14 20:14:47 -06:00
Wesley Wolfe
092800af26 Fixed some async tasks running synchronously. Fixes BUKKIT-2934
Additionally refactored cancel method to be more object-oriented.
2012-11-14 16:47:21 -06:00
Travis Watkins
c2bae0bebb Add crafting result slot for sheep breeding. Fixes BUKKIT-2926
Sheep now use the crafting system when breeding to determine what color
their baby should be. This triggers an event but the event wants the
crafting inventory to have a result slot which sheep do not have. This
event could be useful for plugins to control the output of sheep breeding
so instead of disabling it we add a result slot so the event fires without
issue.
2012-11-14 13:27:45 -06:00
Travis Watkins
188a71ad5b Clear out empty extended block ID array. Fixes BUKKIT-2923
If a chunk gets a block added to it that requires the extended block id
nibble array (block id greater than 255) the array is created and saved
with the chunk. When the blocks are verified to make sure they exist these
entries are erased but the extended block id array is not. This causes the
server and client to disagree about how much data a chunk has which makes
the client crash while trying to load the chunk for rendering.

To resolve these issues we now clear the extended block id array on chunk
load if there is no valid data in it.
2012-11-14 11:36:06 -06:00
Travis Watkins
2b22ae2d45 Potentially fix glitch with falling entities.
When a block creates a falling entity the block is not immediately removed
from the world. Instead, the falling entity is responsible for removing it
but only if the block still exists. Due to certain piston mechanics it is
possible to move the block before this check happens and thus the block is
not removed. This should be fine as the entity will kill itself in this
situation. However, the code does not stop here and continues running the
rest of the entity logic which includes either placing a block in the world
or placing a block item in the world depending on the circumstances.
2012-11-13 23:34:43 -06:00
Travis Watkins
db43197ecf Add EntityFallingBlock from mc-dev 2012-11-13 23:23:04 -06:00
Travis Watkins
5a999a2660 Correct digging behavior. Fixes BUKKIT-2780
If a block is air we return immediately so miss the cleanup work that would
normally happen in this case in vanilla. This causes us to get in to a
situation where, due to odd packet sending from the client, we never
properly stop an attempt by the client to break a block and thus it
eventually breaks.

We also use our own variable for block damage and never sync it up with the
vanilla one so damage reporting to other clients is not always correct.
2012-11-13 21:42:36 -06:00
Travis Watkins
7f7192f8fd Update CraftBukkit to Minecraft 1.4.4. 2012-11-13 16:09:52 -06:00
EvilSeph
f683d5568f Migrate world data with world when switching from vanilla Minecraft to
Bukkit. Fixes BUKKIT-2816 and BUKKIT-2760
2012-11-02 21:12:02 -04:00
md_5
53d24e2b22 [Bleeding] Fix mistranslation affecting time of the server vs time of day.
Fixes BUKKIT-2797
2012-11-02 16:36:43 -04:00
Wesley Wolfe
3dd0580d50 Improved the potion test to detect missing PotionType values. 2012-11-02 00:24:11 -05:00
Travis Watkins
87d25c4cc6 Fix compile issue with chunk generation. 2012-11-02 00:12:49 -05:00
feildmaster
a4892dfa72 Delegate recreateStructures to nms provider. Fixes BUKKIT-2760
This was a miss when updating to 1.4.2
2012-11-01 21:32:28 -05:00
Wesley Wolfe
1c14586c49 Add CraftArt mappings for Wither. Fixes BUKKIT-2667.
The static assertions are not normally evaluated in the JVM, and failed
to fail when the enums went from size 25 to size 26. This meant missing
values would not be detected at runtime and instead return null,
compounding problems later. The switches should never evaluate to null
so will instead throw runtime assertion errors.

Additional unit tests were added to detect new paintings and assure they
have proper, unique mappings. The test checks both that a mapping
exists, is not null, and does not duplicate another mapping.
2012-11-01 03:06:47 -05:00
Wesley Wolfe
9a88e615d4 Change ItemFrame to actually provide a defensive copy. Fixes BUKKIT-2784
If a defensive copy is not used in the API, changes to the item are
reflected in memory, but never updated to the client. It also goes
against the general contract provided in Bukkit, where setItem should be
the only way to change the underlying item frame.
2012-11-01 01:34:54 -05:00
EvilSeph
1623bf0f9b Fire HangingBreakEvent when explosions remove hanging entities. Fixes BUKKIT-2764 2012-10-31 14:24:03 -04:00
Travis Watkins
87a1cd3d43 Add inventory and slot types for new containers. Fixes BUKKIT-2741 2012-10-31 13:25:53 -04:00
Travis Watkins
347fd3cb6e Fix NPE when blowing up an item frame. Fixes BUKKIT-2763 2012-10-31 13:09:57 -04:00
Travis Watkins
f479aa84a4 Implement API for ambient mob spawn limit. Add spawn-limit.ambient to
bukkit.yml. Adds BUKKIT-2765
2012-10-31 13:01:48 -04:00
Travis Watkins
46d7cd1e05 Use BlockCommandSender for dispatching Command block commands
Also allow commands that don't start with a / to match vanilla behavior
2012-10-31 06:37:46 -05:00
feildmaster
9e4e2c62af Expose API for managing and using GameRules. Adds BUKKIT-2757 2012-10-31 03:40:43 -04:00
Travis Watkins
59dc403a61 Hook command block up to ConsoleCommandSender. Fixes BUKKIT-2684
This will need to have its own CommandSender but this makes command blocks
work for now with any command console can run.
2012-10-31 02:39:56 -05:00
h31ix
63eaf74d44 Implement the API for ItemFrames. Adds BUKKIT-2668 2012-10-31 01:18:59 -05:00
h31ix
02ca9be079 [Bleeding] Fire damage is no longer a valid reason for hanging entity removal 2012-10-31 00:45:47 -04:00
h31ix
54cce5bf92 [Bleeding] Implement new Hanging events. Adds BUKKIT-2754 2012-10-31 00:21:31 -04:00
EvilSeph
4efd06a6b5 Remove Anvil debug. Fixes BUKKIT-2732 2012-10-30 19:11:34 -04:00
md_5
42391009f7 [Bleeding] Prevent players from appearing to be sneaking after they change dimensions whilst doing so. 2012-10-30 19:11:34 -04:00
EvilSeph
b7886d1421 Disable portal support for entities for now. Restore allowNether check.
Relates to:
BUKKIT-2695 BUKKIT-2675
2012-10-30 19:11:33 -04:00
EvilSeph
6bf705dd08 Expose API for clearing a player's inventory with a successful count
return. Adds BUKKIT-2745
2012-10-30 04:55:02 -04:00
feildmaster
856fdc2ab6 Update map cursors to reflect 1.4 changes. Fixes BUKKIT-2740 2012-10-29 23:29:40 -04:00
EvilSeph
3047a424bb Expose API for giving and taking experience levels for use with ExpCommand's new behaviour with Minecraft 1.4. Adds BUKKIT-2739 2012-10-29 23:18:37 -04:00
feildmaster
aba7e2faf1 Revert changing EntityType.FIREBALL to LARGE_FIREBALL 2012-10-29 20:17:52 -05:00
Travis Watkins
216cddb2ab Get skull data before destroying block. Fixes BUKKIT-2723
Skull blocks store their type in a tile entity and use their block data
as rotation. When breaking a block the block data is used for determining
what item to drop. Simply changing this to use the skull method for getting
their drop data is not enough because their tile entity is already gone.
Therefore we have to special case skulls to get the correct data _and_ get
that data before breaking the block.
2012-10-29 12:54:16 -05:00
EvilSeph
14f4bd9024 Fix bug preventing non bed-reliant spawns from being successfully set. Fixes BUKKIT-2708 2012-10-29 04:56:30 -04:00
Travis Watkins
d16f8c5e65 Drop skulls like every other block. Fixes BUKKIT-2678
Instead of having a special case for skulls just use the normal logic for
breaking a block. This avoids issues when interacting with API.
2012-10-29 02:28:27 -05:00
EvilSeph
f4cdf8fe98 Add isHardcore API to check if the server is in hardcore mode or not. Adds BUKKIT-2707 2012-10-29 01:46:14 -04:00
EvilSeph
442b7a69f1 Prevent health from wrapping around. 2012-10-28 23:55:40 -04:00
h31ix
db49a57694 Update PotionEffects on player death. Fixes BUKKIT-2673
On player death player PotionEffects need to be updated so that a player's
invisibility and other effects are removed, otherwise they will persist
after a respawn. This is a carry-over from our use of persistent player
entities.
2012-10-28 23:27:02 -04:00
Travis Watkins
0fb806c566 Clamp difficulty levels to prevent invalid values
Some features added in 1.4.2 use the difficulty value as an index to an
array so while before having it set to an invalid value would do nothing
or maybe cause an odd side effect somewhere it now crashes the server. This
patch ensures difficulty values are clamped between 0 and 3, inclusive.
2012-10-28 10:07:11 -05:00
Travis Watkins
37a0d6757d Don't filter item data for anvils. Fixes BUKKIT-2640
Filtering item data is usually a good idea to make sure we don't have
invalid data or data on items that shouldn't have it. However, anvils
use item data in slightly different way and so running its code for
filtering here causes the data to be corrupted.
2012-10-28 09:37:47 -05:00
Travis Watkins
9841b77009 Use correct variable for squid Y motion. Fixes BUKKIT-2648 2012-10-28 03:23:48 -05:00
Travis Watkins
c675cc0b3b Fix missed rename for ore exp dropping. Fixes BUKKIT-2662 2012-10-28 02:43:23 -05:00
Travis Watkins
d97d193b91 Add new entities to World.spawn method. Fixes BUKKIT-2658 2012-10-28 02:21:34 -05:00
h31ix
788e9e84cf Fix incorrect method names missed during update. Fixes BUKKIT-2653
A couple method names were changed between 1.3.2 and 1.4.2 but were missed
in the update. One of these affects being able to enchant bows and the
other is used for updating player animations while firing.
2012-10-28 03:06:59 -04:00
EvilSeph
11d65171cd These books are too powerful! 2012-10-28 03:05:28 -04:00
EvilSeph
784f9e31a8 Remove spawn-radius setting in bukkit.yml in favour of spawn-protection in
server.properties. Fixes BUKKIT-2657
2012-10-28 01:55:27 -04:00
EvilSeph
5fe8523023 Fixed generator-settings not being set. Fixes BUKKIT-2652 2012-10-28 01:00:28 -04:00
Travis Watkins
5469311a36 Don't pass vanilla plugin channels to plugins. Fixes BUKKIT-2638
Vanilla has its own handlers for plugin channel messages for things like
texture packs, books, and anvils. When vanilla handles one of these messages
we should not also pass it to plugins because they will be duplicating work
and potentially running in to situations our plugin system isn't setup to
handle. This is how 1.3.2 worked but was lost in the 1.4.2 update.
2012-10-27 23:25:10 -05:00
Travis Watkins
60819c6693 Update CraftBukkit to Minecraft 1.4(.2). 2012-10-27 22:19:03 -04:00
EvilSeph
df7f86d028 Made books less powerful, though you should still read them! 2012-10-27 20:44:16 -04:00
Wesley Wolfe
4166af1d3a Implement chat tab completion API. Fixes BUKKIT-2608. Adds BUKKIT-2607.
The chat tab completion implementation also includes a sanity check to
assure type-safety in the list.
2012-10-17 04:31:36 -05:00
Score_Under
3ce954bb86 Delegate tab-completion. Fixes BUKKIT-2181. Adds BUKKIT-2602
CommandMap now contains the functionality for tab completion. This
commit replaces the vanilla implementation and simply delegates it to
the Bukkit API.
2012-10-15 03:18:59 -05:00
Wesley Wolfe
05e889f346 Queue tasks from secondary threads. Fixes BUKKIT-2546 and BUKKIT-2600
This change affects the old chat compatibility layer from an
implementation only standpoint. It does not queue the 'event' to fire,
but rather queues a runnable that allows the calling thread to wait for
execution to finish.

The other effect of this change is that rcon connects now have their
commands queued to be run on next server tick using the same
implementation.

The internal implementation is in org.bukkit.craftbukkit.util.Waitable.
It is very similar to a Future<T> task, but only contains minimal
implementation with object.wait() and object.notify() calls
under the hood of waitable.get() and waitable.run().

PlayerPreLoginEvent now properly implements thread-safe event execution
by queuing the events similar to chat and rcon. This is still a poor way
albeit proper way to implement thread-safety; PlayerPreLoginEvent will
stay deprecated.
2012-10-14 17:26:53 -05:00
Wesley Wolfe
93a79cd0e6 Implement new scheduler API. Adds BUKKIT-836
The implementation for the new methods mimics the old methods. The final
call for the old methods now maps to the new methods with an additional
call to get id.
2012-10-14 01:21:58 -05:00
Travis Watkins
506a1a0765 Ensure entity isn't destroyed when trying to show it. Fixes BUKKIT-2038
If two players (or a player and any other entity) are teleported to the
same location in the same tick they will both get added to the other's
destroy queue then have a new entity spawn packet sent. Next tick the
destroy queue will be processed and they will then be invisible to each
other. To prevent this situation we remove the entity from the destroy
queue when sending out a spawn packet for them.
2012-10-13 15:27:45 -05:00
EdGruberman
59d6b60c0a Update entity target data to reflect current AI status. Fixes BUKKIT-2280
The new AI system introduced by Minecraft 1.2 no longer relies on the
target field in the entity so it is frequently out of sync with what the
entity is actually doing. This modifies the AI goal to update the target
so our API can return the correct information.
2012-09-28 15:04:32 -05:00
Travis Watkins
62a9b8815b Allow data values on mushroom and mob spawner blocks. Fixes BUKKIT-2346
In 1.2.5 and older versions of CraftBukkit we allowed the use of data
values on bug mushroom and mob spawner blocks for use with plugins.
For the 1.3 update the mechanism for doing this was changed and I
accidentally used the wrong value when adding these, indicating that
they should not have data instead of our actual intent. This change
corrects this regression.
2012-09-28 15:00:02 -05:00
Travis Watkins
b5580b6d95 Remove player from destroy queue when they go visible. Fixes BUKKIT-2071
If a plugin calls player.hidePlayer(other); then player.showPlayer(other);
in the same tick the other player will be added to the entity destroy queue
then a spawn packet will be sent. On the next tick the queue will be
processed and a destroy packet will be sent that renders the other player
invisible. To correct this we ensure the destroy queue is in sync with use
of the vanish API.
2012-09-28 14:53:28 -05:00
Travis Watkins
244a39d209 Use this world instead of the one in the entity. Fixes BUKKIT-2315
In some situations an entity or tile entity can be added to the world but
have its own 'world' field be null or otherwise incorrect. As the entity
was added to this world to be ticked assume it actually is in this world.
2012-09-28 14:46:30 -05:00
Wesley Wolfe
fc0e35a67c Fix typo causing a task to be repeated in debug. Addresses BUKKIT-2549
An internal method for making the debug output for CraftScheduler's
async tasks was erroneously using the 'this' reference when the loop
should be referencing the current task.
2012-09-28 02:39:22 -05:00
Wesley Wolfe
03f12497b2 Map org.bukkit.Sound to String values for sending to client.
This change was done to remove the internal sound names from the API.
Along with moving the internal names into CraftBukkit, a unit test was
added for any new sounds added in the API to assure they have a non-null
mapping.
2012-09-26 19:02:05 -04:00
Travis Watkins
74b3be57b7 Replace LongObjectHashMap with a more efficient implementation
After further testing it appears that while the original LongHashtable
has issues with object creation churn and is severly slower than even
java.util.HashMap in general case benchmarks it is in fact very efficient
for our use case.

With this in mind I wrote a replacement LongObjectHashMap modeled after
LongHashtable. Unlike the original implementation this one does not use
Entry objects for storage so does not have the same object creation churn.
It also uses a 2D array instead of a 3D one and does not use a cache as
benchmarking shows this is more efficient. The "bucket size" was chosen
based on benchmarking performance of the HashMap with contents that would
be plausible for a 200+ player server. This means it uses a little extra
memory for smaller servers but almost always uses less than the normal
java.util.HashMap.

To make up for the original LongHashtable being a poor choice for generic
datasets I added a mixer to the new implementation based on code from
MurmurHash. While this has no noticable effect positive or negative with
our normal use of chunk coordinates it makes the HashMap perform just as
well with nearly any kind of dataset.

After these changes ChunkProviderServer.isChunkLoaded() goes from using
20% CPU time while sampling to not even showing up after 45 minutes of
sampling due to the CPU usage being too low to be noticed.
2012-09-21 11:20:10 -05:00
Wesley Wolfe
9f70c1f386 Set last accessed variables after grabbing chunk. Fixes BUKKIT-1033
This fix changes the 'state' of the last accessed variables to be more
accurate. Changing the coordinates of the last accessed chunk should
never precede actually setting the last accessed chunk, as loading a
chunk may at some point call back to getChunkAt with a new set of
coordinates before the chunk has actually been loaded. The coordinates
would have been set, but the actual chunk would not. With no check for
accuracy, this causes fringe case issues such as null block states.

Big thanks to @V10lator for finding where the root of the problem was
occurring.
2012-09-20 23:00:34 -05:00
Wesley Wolfe
cebc8cffec CraftBukkit comment fixes 2012-09-14 01:53:42 -04:00
mbax
4b1f6aff3f [Bleeding] Check visibility API for sounds. Fixes BUKKIT-2210
This implementation of a visibility API check for sounds
was created by adding extra methods carrying the source entity
in WorldManager and ServerConfigurationManagerAbstract and
adding a test for canSee in the SCMA sendPacketNearby method.
This approach involves no logic copying, just method addition.
I opted to cast to WorldManager as:
1) IWorldAccess is not in CraftBukkit at the moment
2) There is no other IWorldAccess implemented in CraftBukkit,
  nor is there likely to be one soon. If that day comes, easy fix.
2012-09-14 01:53:42 -04:00
EvilSeph
349cb0bba6 What is dead may never die. 2012-09-14 01:53:34 -04:00
EvilSeph
412b4624c3 Update the client after a FoodLevelChange event is fired. Fixes BUKKIT-2510 2012-09-12 22:06:36 -04:00
Mike Primm
9a4b85c931 [Bleeding] Avoid spawn checks on empty worlds. Fixes BUKKIT-2508
Change a server wide check for players to be world specific. Worlds
without players will not spawn entities.
2012-09-12 22:06:36 -04:00
EvilSeph
4c0dd6964e Reverted changes to chunk saving behaviour. 2012-09-12 22:06:35 -04:00
Mike Primm
beee3ce2da [Bleeding] Add autosave interval setting in bukkit.yml. Adds BUKKIT-2507
The new setting is located at "ticks-per.autosave". By changing this
value, it affects how often a full save is automatically executed,
measured in ticks.

This value is defaulting to 0 (off) because we believe that the vast
majority of servers already have a third-party solution to automatically
saving the server at set intervals. Having the built in auto-save disabled
by default ensures that we are not saving things twice; doing so leads to
absolutely no benefits, but results in detrimental and noticeable
unnecessary performance decrease.

For servers that do not use an automated external script to perform saves,
this setting can be turned on by setting the value higher than 0, with 900
being the value used in vanilla.
2012-09-12 22:05:52 -04:00
Wesley Wolfe
e2b1514daf Bulk pending cleanup. 2012-09-09 23:19:28 -05:00
Luke Granger-Brown
b1f6d16bfa Change local jline checks to not use String literals. Fixes BUKKIT-2455.
Refactoring dependencies 'changes' the string literal in the code. This
commit changes the literal to instead use a char[] to initialize a new
String. On a bytecode level, there will not exist a String literal for these
two values; the shade plugin will no longer refactor them.

Refactoring jline also changes the other String literals we use for
notifying jline of the current state. To insure that our local code reflects
the inner logic in jline, the key value was changed to the static final
variable located in TerminalFactory. Likewise, UnsupportedTerminal uses the
explicit class name (as reflection is used later with the value that has
been set).
2012-09-09 17:02:48 -05:00
Wesley Wolfe
27d58a299c Add information about async tasks to CrashReports. Addresses BUKKIT-2491
Async tasks are notorious for causing CMEs and corrupted data when
accessing the API. This change makes a linked list to track recent tasks
that may no longer be running. It is accessed via the toString method on
the scheduler. This behavior is not guaranteed, but it is accessible as
such currently.

Although toString is located in the scheduler, its contract does not
guarantee an accurate or up to date call when accessed from a second
thread.
2012-09-09 00:34:41 -05:00
Wesley Wolfe
4d5894e4cb Fix crash from console-commands throwing exception. Fixes BUKKIT-2479
When 1.3.1 was released, a try-catch block was removed from the tick
loop that called the method in NMS to handle commands. This restores a
try-catch to prevent the console from crashing the server.
2012-09-06 22:11:17 -05:00
feildmaster
c710ca827f Fix BUKKIT-2419: PlayerAbilities not being updated on teleport/respawn
Minecraft resets abilities based on what it knows client side, when someone dies and is in "survival," by default they should be in "survival." However, we allow modification of the PlayerAbilities, so we send this update out to the client.

Oh and, the format of the commit is like this to see if it looks any good. :)
2012-08-27 12:02:25 -05:00
Wesley Wolfe
3307d489da Fix Future task waiting logic. Fixes BUKKIT-2408
Previously, the timeout would erroneously get converted to milliseconds
twice. The second conversion was removed.

Spurious wakeups were not handled properly, and would instead throw a
TimeoutException even if the waited time was not reached..
2012-08-26 10:25:11 -05:00
feildmaster
cb84d6b994 Fix empty chunks not sending biome properly and causing client side issues. Fixes BUKKIT-2396 2012-08-25 08:59:33 -05:00
Travis Watkins
b8cc862083 Update to 1.3.2 2012-08-25 00:54:21 -04:00
feildmaster
35cff16da5 Fix EmptyChunk's not sending to the Client correctly. Fixes BUKKIT-2206 2012-08-23 14:58:23 -05:00
Wesley Wolfe
dcd01bf0c0 Rewrite scheduler. Fixes BUKKIT-1831, and BUKKIT-845
The new scheduler uses a non-blocking methodology. Combining volatile
references to make a linked reference chain, with the atomic reference
handling the tail, tasks are queued without waiting for locks. The main
thread will no longer limit the length of time spend for scheduled tasks,
but no task will run twice in the same tick. Scheduling a new task inside of
a synchronous task will always run the new task during the same tick,
assuming there is no supplied delay > 0.

Asynchronous tasks are now run using a thread pool. Any thread-local
implemenation should now account for threads being reused between
executions.

Race conditions were carefully examined and the order of logic is now very
important. Each task is placed in a secondary collection before removal from
primary collections. Thus, by reading tasks from the collections in the same
order they travel, it retains state-safety. This does make modifications
less responsive in some situations, as the task may be transitioning before
the modifier accesses it. This cost outweighs the requirement to synchronize
on the scheduler; previously any conflict would be first-come-first-serve,
with the main thread backing out arbitrarily.
2012-08-22 16:41:46 -05:00