Commit graph

2091 Commits

Autor SHA1 Nachricht Datum
feildmaster
dc93da8e34 Pass null help values values as empty strings to HelpTopics
Fixes BUKKIT-2618 and BUKKIT-2561
2012-12-10 01:40:21 -06:00
EdGruberman
f18b3cdc76 [Bleeding] Fix NPE with a null bedSpawnLocation. Fixes BUKKIT-1500 2012-12-10 01:40:20 -06:00
feildmaster
12c7c2f695 Implement FurnaceExtractEvent. Adds BUKKIT-2114 2012-12-08 03:58:34 -06:00
feildmaster
e760d6eb31 Add SlotFurnaceResult for diff visibility 2012-12-08 02:45:50 -06:00
EdGruberman
24abdd556d [Bleeding] Fix NPE in getBedSpawnLocation. Fixes BUKKIT-1949 2012-12-08 02:18:06 -06:00
Dark Arc
090c1a60bd Correctly shoot arrows with the spawnArrow Method. Fixes BUKKIT-3116 2012-12-08 02:15:15 -06:00
Travis Watkins
9973e7cdec Update entity state correctly when marked as persistent. Fixes BUKKIT-3123
When a mob is marked with the persistent flag (animal or anything with
setRemoveWhenFarAway(false)) the entire block of code for checking if they
should be despawned is skipped. However, one part of this code updates the
mob state if a player is close enough to them. It turns out this state is
used by the AI system to decide if the mob should move around randomly or
not. To stop mobs from being frozen in place we now update this state if
the persistent flag is set as well.
2012-12-07 21:18:51 -06:00
Travis Watkins
846a22304c Provide a faster way to get a location. Adds BUKKIT-3120
Currently when a plugin wants to get the location of something it calls
getLocation() which returns a new Location object. In some scenarios this
can cause enough object creation/destruction churn to be a significant
overhead. For this cases we add a method that updates a provided Location
object so there is no object creation done. This allows well written code
to work on several locations with only a single Location object getting
created.

Providing a more efficient way to set a location was also looked at but
the current solution is the fastest we can provide. You are not required
to create a new Location object every time you want to set something's
location so, with proper design, you can set locations with only a single
Location object being created.
2012-12-07 21:15:05 -06:00
feildmaster
c74fd4196f Use shooter constructor for Fireballs. Fixes BUKKIT-3121
Fixes fireballs exploding in the shooter's face and not having a shooter for the projectile. (Two birds with one stone!)
2012-12-07 05:25:20 -06:00
feildmaster
78bc0ad1d5 Add the ability to launch WitherSkulls. Fixes BUKKIT-3106 2012-12-07 05:25:11 -06:00
feildmaster
72ee1f3182 Fix "Commands Only" chat flag. Fixes BUKKIT-2238
Thanks for the commit @mrapple
2012-12-07 05:22:00 -06:00
feildmaster
6a04fd98ad Implement API for wolves collar color. Adds BUKKIT-3109 2012-12-05 18:08:31 -06:00
Travis Watkins
1af83da760 Don't run command blocks in empty worlds. Fixes BUKKIT-3094 2012-12-05 13:37:13 -06:00
feildmaster
09684ba9d7 Persistence isn't just animals. Fix BUKKIT-3105
Also set to this value if the persistence hasn't been updated
2012-12-05 12:28:09 -06:00
feildmaster
fb6d9e1808 Add a custom shutdown message set in bukkit.yml. Addresses BUKKIT-3031 2012-12-05 06:07:10 -06:00
Travis Watkins
320712aba7 Allow placing blocks in spawn if ops.txt is empty. Fixes BUKKIT-3004 2012-12-05 05:01:15 -06:00
Travis Watkins
5409d05d3a Ensure animals don't despawn due to old default setting.
The old default for the persistent flag on mobs was false which was then
written out to their NBT data when they were saved. We now use this data
for all mobs, not just non-animal mobs. However, this means animals that
spawned before that change will now start despawning like monsters do.

To avoid this we add a new flag to the mob's saved data to mark if the
data was saved before or after we started using it and ignore it if it
was before.
2012-12-04 23:15:53 -06:00
Wesley Wolfe
b854320fc8 Fire EntityFormBlockEvent for FallingBlocks. Adds BUKKIT-3078 2012-12-04 22:38:51 -06:00
Travis Watkins
4dadf0e2b5 Implement API for mob despawn when away from players. Adds BUKKIT-2986
As of 1.4 mobs have a flag to determine if they despawn when away from a
player or not. Unfortunately animals still use their own system to prevent
despawning instead of making use of this flag. This change modifies them
to use the new system (defaults to true) and to add API for plugins to adjust
this.
2012-12-04 20:10:23 -06:00
feildmaster
11894784b0 Fix leaky pipes (water flow). Fixes BUKKIT-3085
(Also, fix mistranslation for VehicleBlockCollisionEvent)
2012-12-01 13:33:44 -06:00
feildmaster
c596093c31 [BREAKING] Update BlockFace directions. Fixes BUKKIT-1567, BUKKIT-3069
The answer is 42
2012-12-01 01:14:25 -06:00
Wesley Wolfe
3404318bc5 Fix missed refactoring in EntityWither 2012-11-30 17:50:09 -06:00
Wesley Wolfe
1a6a828156 Add data values to EntityChangeBlockEvent. Adds BUKKIT-3077, BUKKIT-3076
This change affects Endermen and Silverfish, adding a data value for the block change event.
2012-11-30 11:59:29 -06:00
Wesley Wolfe
9bd02495df Use carried item for endermen's changed-block's id. Fixes BUKKIT-3075 2012-11-30 11:49:01 -06:00
feildmaster
0c16afd6e0 Take into account if the shooter is a player before considering pvp mode for projectiles. Fixes BUKKIT-3058 2012-11-27 12:14:53 -06:00
feildmaster
1040a81334 Fix multi-world sounds not being sent correctly. Fixes BUKKIT-3051 2012-11-25 18:05:17 -06:00
feildmaster
aa99d67963 Call EntityInteractEvent for Wood Buttons. Fixes BUKKIT-3022
Prior to this, there was no way to tell when arrows trigger buttons
2012-11-24 01:41:19 -06:00
feildmaster
cd66edd40f Fix the previous fix for "infinite 'breeding' with MonsterEggs" 2012-11-22 21:42:34 -06:00
feildmaster
22e26a5029 Call MapInitializeEvent on newly created maps. Fixes BUKKIT-2907 2012-11-21 16:48:25 -06:00
feildmaster
f0325da814 Add ItemMapEmpty for diff visibility 2012-11-21 16:19:56 -06:00
feildmaster
71b0510f88 Fix teleporting entities with vehicles/passengers teleporting you illegally. Fixes BUKKIT-2821
Also some formatting...
2012-11-20 19:41:56 -05:00
EvilSeph
fed863049d Update invalidItems array. Fixes BUKKIT-2554. 2012-11-20 19:37:01 -05:00
EvilSeph
a17ca07fe8 Add SPAWNER_EGG spawn reason to allow for filtering. Adds BUKKIT-3000 2012-11-20 19:37:01 -05:00
EvilSeph
c36b3da573 Fix infinite 'breeding' with MonsterEggs. Fixes BUKKIT-2997
If the player is not in Creative (i.e. does not have the ability to
instantly build) we need to decrement the MonsterEgg item stack when used
on a breedable parent mob.
2012-11-20 19:37:00 -05:00
feildmaster
5f5dd727b6 Add a DamageEvent for falling blocks which can damage entities. Fixes BUKKIT-2781 2012-11-20 17:16:30 -06:00
Wesley Wolfe
d039986be7 No teleporting people back into the server. Fixes BUKKIT-2298
Stale player references will add a player back into the world when
teleporting them, causing a cascade of issues relating to ghost entities
and servers failing to stop.
2012-11-19 21:38:31 -06:00
Travis Watkins
8f4cde24bd Don't add player to world if join event did it already.
On join we unconditionally add the player to the world they logged out in.
If a plugin teleports a player during PlayerJoinEvent in a way that adds
them to a world (cross-world teleport) we end up with one player in two
places. To avoid this we check to see if the player has changed worlds or
is already added to the world we have we skip adding them again.
2012-11-18 21:27:48 -05:00
EvilSeph
cc78e17312 Fix players losing experience when keepInventory is true. Fixes BUKKIT-2915 2012-11-18 17:45:29 -05:00
Travis Watkins
7ef9adc04e Fix missed rename making withers too cheaty. Fixes BUKKIT-2972 2012-11-18 16:14:08 -06:00
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
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
feildmaster
8fdb006143 Use constant Player for EnderPearls
Also make sure players are online before proceeding to each event
2012-08-22 14:32:10 -05:00
feildmaster
98c98d0f7a Fix entities not having valid "isValid" states. Addresses BUKKIT-2366 2012-08-22 14:16:51 -05:00
V10lator
e3ae188ed2 Fix instances where Signs have null lines. Addresses BUKKIT-684 2012-08-21 20:17:29 -05:00
EdGruberman
450edc3004 Use standard format function to format logs. Addresses BUKKIT-2246
Also fix "excess" Log Levels.
2012-08-21 19:17:29 -05:00
feildmaster
161ab5edc6 Implement API for Sound, and playing the sounds for Worlds and Players. Adds BUKKIT-1430, BUKKIT-1226 and BUKKIT-2019 2012-08-21 19:13:19 -05:00
Travis Watkins
ccc760d629 Use a dynamic pool size for the iterator cache
Many codepaths only end up with one iterator being used at a time and
most of the rest only get up to two being used so using a static pool of
three is wasteful. This also allows us to efficiently handle cases that
exceed 3 iterators in use. Overall this dramatically increases the hit rate
and results in less iterators being created.
2012-08-20 18:44:07 -05:00
feildmaster
e7e643d83a Implement API to retrieve and open EnderChests. Adds BUKKIT-2016 2012-08-20 16:00:53 -05:00
Travis Watkins
feb0327d22 Check unload queue so we don't accidentally leave a chunk loaded 2012-08-19 16:06:14 -05:00
Mike Primm
7dde6cc566 [Bleeding] Stub out MethodProfiler class
Instead of trying to track down every place this class is used we can
simply stub out the entire class so it has no extra overhead.
2012-08-19 09:51:09 -05:00
Mike Primm
e079d9457e [Bleeding] Strip out unused HashSet in IntHashMap 2012-08-19 09:51:07 -05:00
Mike Primm
eaa3154b0e [Bleeding] Cache packet ID instead of doing lookups each time it is needed 2012-08-19 09:51:04 -05:00
Mike Primm
627cf2ef8b [Bleeding] Remove redundant chunkList from ChunkProviderServer
This ArrayList duplicates part of the functionality of the much more
efficient chunk map so can be removed as the map can be used in the few
places this was needed.
2012-08-19 09:51:00 -05:00
Travis Watkins
97ac0a3f14 Add LongObjectHashMap and LongHashSet
Replace uses of LongHashtable and LongHashset with new implementations.
Remove EntryBase, LongBaseHashtable, LongHashset, and LongHashtable as they
are no longer used.

LongObjectHashMap does not use Entry or EntryBase classes internally for
storage so has much lower object churn and greater performance. LongHashSet
is not as much of performance win for our use case but for general use is
up to seventeen times faster than the old implementation and is in fact
faster than alternatives from "high performance" java libraries. This is
being added so that if someone tries to use it in the future in a place
unrelated to its current use they don't accidentally end up with something
slower than the Java collections HashSet implementation.
2012-08-19 09:51:00 -05:00
Travis Watkins
7b20caf8fe Use TrigMath in hotspots
Use our implementation of atan2 in AI routines as profiling shows these are
hotspots and (for these cases) our implementation is much faster.
2012-08-19 09:51:00 -05:00
Mike Primm
8219081385 [Bleeding] Change Vec3DPool to a stack based pool
Avoid overhead of using an ArrayList and resizing it. Also allows for reuse
of objects in the pool during the same tick by explicitly releasing them
back to the pool. This allows for much better cache performance as well
as reduced cache footprint.
2012-08-19 09:50:57 -05:00
Travis Watkins
d628c886d2 Optimize entity AI goal selector
Remove redundant ArrayList to avoid excessive object creation and CPU
overhead, the entries are added to the list then immediately iterated through
to run so just run them directly.

Swap order of some conditionals to perform the more efficient check first
as if it fails the list lookup will not be executed.

Remove profiling hooks including some rather expensive calls to getSimpleName.
2012-08-19 09:50:57 -05:00
Travis Watkins
858d36efc9 Add iterator cache to UnsafeList and use it in hotspots
Adds a specialized iterator for the list and a pool of iterators to avoid
object churn. Also optimizes the clear() method to reduce object creation.
2012-08-19 09:50:57 -05:00
Mike Primm
6d777ade16 [Bleeding] Optimize chunk loading
ChunkSection.e() is called once per chunk section loaded and is quite
expensive (about 20% of CPU time for loading the chunk). This changes the
logic to add a fast path when extended block data is not being used and
reorganizes the loops for more optimal array traversal. Overall this saves
about 20-30% CPU time in this method.
2012-08-19 09:50:45 -05:00
Mike Primm
852602e430 Add files from mc-dev for diff visibility 2012-08-19 09:19:28 -05:00
Mike Primm
5254993510 Fix issues with chunk saving. Fixes BUKKIT-2158, BUKKIT-2018 and BUKKIT-2229 2012-08-19 08:36:47 -04:00
Wesley Wolfe
cacfc71b46 Add more detailed CrashReport for CraftBukkit. Addresses BUKKIT-2319 2012-08-17 23:18:22 -05:00
Wesley Wolfe
acedd049c5 Add CrashReport for diff visiblity 2012-08-17 22:22:20 -05:00
John Driscoll
0bde47a173 Don't extend pistons until data is set. Fixes BUKKIT-2153 2012-08-17 17:06:46 -05:00
Wesley Wolfe
050a9276bc Removed unneeded mc-dev imports. Fixes BUKKIT-682 2012-08-17 16:37:53 -05:00
Travis Watkins
add387dee3 Call PlayerQuitEvent in correct location. Fixes BUKKIT-2193 2012-08-15 12:22:52 -05:00
feildmaster
fc35d000e4 Use correct SlotType's for merchants. Fixes BUKKIT-2257 2012-08-15 06:00:55 -05:00
feildmaster
b059962a5c Implement methods for spawning FallingBlocks and add various FallingBlock methods. Adds BUKKIT-2282 2012-08-14 07:38:23 -05:00
feildmaster
8748c8c757 Enable hardcore support. Fixes BUKKIT-2259
- Hardcore requires a newly generated world
- You will be banned if you die in a hardcore world
- You will NOT be banned if you die in a non-vanilla world
- Your "heart container" will not change without logging back in. (Vanilla bug)
2012-08-12 16:50:00 -05:00
feildmaster
aa92f0e313 Update CreatureSpawner.setSpawnedType(EntityType) to 1.3
They can spawn any valid entities now. What is a "valid" entity? A "valid" entity is an EntityType with a non-null getName(). (for example: PRIMED_TNT, FALLING_BLOCK)
2012-08-12 14:11:36 -05:00
feildmaster
bfc5189818 Fix "block update packet" not being sent to the correct world. Fixes BUKKIT-2023 2012-08-12 14:11:34 -05:00
Wesley Wolfe
342f9c3bd3 Implement player speed API. Addresses BUKKIT-2205 2012-08-10 00:00:04 -05:00
Wesley Wolfe
77cda7e715 Add PlayerAbilities for diff visibility 2012-08-09 23:16:19 -05:00
feildmaster
27c1c85adb Implement BlockBreakEvent block experience. Adds BUKKIT-2033 2012-08-08 19:49:10 -05:00
feildmaster
8d946b88b3 Add BlockMobSpawner and BlockOre for diff visibility 2012-08-08 19:49:08 -05:00
Wesley Wolfe
a16e0b6323 Change socket traffic class try-catch. Fixes BUKKIT-2093 2012-08-08 07:00:41 -05:00
Wesley Wolfe
25fe93479f Restore port to the hostname. Fixes BUKKIT-2124 2012-08-08 07:00:29 -05:00
EvilSeph
24809ef986 Re-add support for full chunk saving so the server save-alls on stop. Fixes BUKKIT-2158 2012-08-08 03:08:46 -04:00
EvilSeph
a133bc7182 Make periodic chunk saving less aggressive and fixed double player data saving. Fixes BUKKIT-1994 and fixes BUKKIT-2144 2012-08-07 18:52:53 -04:00
Wesley Wolfe
2bb7a5f94d Implement new deprecated warning state configuration option 2012-08-06 23:52:49 -05:00
Travis Watkins
bfbdbbd05c Tripwire isn't redstone, only fire interact events. 2012-08-06 19:47:22 -05:00
Travis Watkins
7a3dfecba0 Don't force chunks to load again, causes chunk leaks with multiworld. 2012-08-06 17:31:03 -05:00
Wesley Wolfe
0792b15887 Pistons no longer extend before they are pistons. Fixes BUKKIT-1999 2012-08-06 09:55:38 -05:00
feildmaster
59aaa6a80a Fix dispenser removing data from items. Fixes BUKKIT-2045 2012-08-06 09:09:05 -05:00
THDigi
7dc47892a4 Don't rotate ShapedRecipes. Fixes BUKKIT-1334
ShapedRecipe's getShape() always returns a 90deg rotated shape of the original shape, this commit fixes it.
2012-08-06 07:11:35 -05:00
Travis Watkins
164c066453 Fix "moved too quickly" detection. 2012-08-05 23:57:22 -05:00
Travis Watkins
e1a4273957 Fire events for tripwire and hooks. 2012-08-05 23:57:22 -05:00
Travis Watkins
982efb8c24 Add BlockTripwire and BlockTripwireHook from mc-dev for diff visibility. 2012-08-05 23:57:22 -05:00
Travis Watkins
304cb019e4 Fire EntityDeathEvent for pigs. Fixes BUKKIT-2100 2012-08-05 23:57:22 -05:00
Wesley Wolfe
9cccb1c89e Fix Vec3DPool; don't pool objects indefinitely or O(n^2) clear() 2012-08-05 21:36:25 -05:00
Wesley Wolfe
f5777cc0b7 Add Vec3DPool for diff visibility 2012-08-05 21:36:09 -05:00
Wesley Wolfe
44234c47ce Cease execution if block is AIR. Fixes BUKKIT-2104 2012-08-05 21:32:01 -05:00
Travis Watkins
a574ec54cc Put forceChunkLoad back to its original value. 2012-08-05 20:03:12 -05:00
Travis Watkins
beb71069b7 Don't use Packet56 and clear client cache on world changes. 2012-08-05 18:42:03 -05:00
Wesley Wolfe
0e013fa4b0 Fixed PlayerManager ConcurrentModificationExceptions. Fixes BUKKIT-1972 2012-08-04 22:12:16 -05:00
Wesley Wolfe
9804665fec Fix bounding box pool to use a dynamic cache size
Also changed insane array copy routine. This should reduce server lag
spikes that occur periodically.
2012-08-04 21:11:28 -05:00
Wesley Wolfe
14a470985d Add AABBPool for diff visibility 2012-08-04 21:06:17 -05:00
Travis Watkins
e5acb6cf3a Don't tick chunks or entities on chunks that are queued for unload.
Treat chunks in the unload queue as if they are already unloaded to prevent
processing on them removing them from the unload queue and leaking.
2012-08-04 18:08:26 -05:00
Travis Watkins
fdd01feb8c Avoid CME when lightning strikes by making a copy. Fixes BUKKIT-2055 2012-08-04 18:02:30 -05:00
Wesley Wolfe
a5da834258 Fix chat not being cancellable when not using deprecated API. 2012-08-04 05:44:23 -05:00
feildmaster
9bed5272d3 Re-implement code missing from leaving the end. Fixes BUKKIT-2003 2012-08-04 04:11:21 -05:00
feildmaster
823e3fb0c6 Correctly detect invalid PistonExtension's to allow removal of StickyPistons. Fixes BUKKIT-2059 2012-08-04 04:10:55 -05:00
feildmaster
ab8b7c7e33 Potentially fix chunk leaking, needs further examination 2012-08-04 01:43:17 -05:00
Steve Anton
f90bd7e7cc Fix PlayerBucketEmptyEvent handling. Fixes BUKKIT-2002 and fixes BUKKIT-1997
The method this.a(world, d0, d1, d2, i, j, k) is responsible for
actually placing the lava or water source block in the world. The event
is currently called after this method, thus canceling the event will
cause the player to keep their water/lava bucket but the water/lava will
still appear where they attempted to place it.

In addition, the check for whether a player has creative inventory is
short circuiting before the event fires, so the event will not be called
for these players.

This moves the event call and cancelled check above these two calls to
ensure it always fires and the results of it are honored.

Closes GH-835.
2012-08-03 23:44:45 -05:00
Wesley Wolfe
02d6703da7 Implement new AsyncPlayerChatEvent. Addresses BUKKIT-2064
Added two utility collections for use with PlayerChatEvents allowing lazier
initialization of events and less need to synchronize against the player
list.

Provided a hidden queue system for similar logic to pre-1.3 chat. When a
plugin is listening for the deprecated PlayerChatEvent, all chat will be
delayed to be mirror executed from the main thread. All developers are
encouraged to immediately update to the developmental Bukkit chat API as a
minimum transition for server stability.

Additionally, changes were required to bring thread-safety to the flow
logic. CopyOnWriteArrayList is the only viable means to produce thread
safety with minimal diff; using a sane pre-implemented collection would
require reworking of sections of NMS logic.

As a minor change, implemented expected functionality for
PlayerCommandPreProcessEvent. Setting the player should now change the
player executing the command.
2012-08-03 23:44:45 -05:00
Travis Watkins
4942f5184a Don't merge items with enchantments. Fixes BUKKIT-2050 2012-08-03 19:30:04 -05:00
feildmaster
8834d1423e Fix 1.3 changes that prevent nether and the_end to save level data. 2012-08-03 18:58:47 -05:00
md_5
07794300d0 [Bleeding] Fire inventory close event. Fixes BUKKIT-2036 2012-08-03 02:41:48 -05:00
Mike Primm
fe8fc6b90e Process entity ticks on worlds without players. Fixes BUKKIT-2031
Both the CB 1.3.1 code, and vanilla 1.3.1 code, have modified the
behavior of entity tick processing in a way that can lead to disabling
of entity cleanup. Specifically, the tickEntities() call in n.m.s.World,
which processes both the entity cleanup (removing from the world entity
list) and tile entity tick processing (furnaces and such) does not get
called by n.m.s.MinecraftServer's q() method (which drives tick
processing calls in general) when no players are on the given world.
This causes a serious memory leak when automation processes, like dynmap
mapping, load and unload chunks - as entities on unloaded chunks are
only cleaned up during entity tick processing. It also will cause issues
with any mods that use persistent chunk loading (that is, keeping chunks
loaded so that tile entities will continue being processed), since such
processing will no longer function without at least one player on the
given world.

In any case, the tickEntities() call should be called in the same
fashion as under 1.2.x (each tick, independent of player population, as
opposed to being suspended indefinitely when no players are on the given
world). The specific memory leak observed, with removing the unloaded
entites from the world, requires this call be made regularly (or, at
least, whenever the entity unload queue (world.g) is not empty.

Closes GH-832
2012-08-03 01:19:10 -05:00
Travis Watkins
f5794937a9 Print short message on exception to avoid spamming console. Fixes BUKKIT-2018 2012-08-03 01:04:16 -05:00
Travis Watkins
dcf83bc1b5 Restore configurable connection throttle. 2012-08-03 01:04:10 -05:00
Travis Watkins
e156354a60 Add DedicatedServerConnectionThread from mc-dev for diff visibility. 2012-08-03 00:48:07 -05:00
EvilSeph
d5fea5fd0d Fixed translation issue breaking custom world generation. Fixes BUKKIT-1975 2012-08-02 23:47:41 -04:00
Mike Primm
c711827e94 Fix mapping of ChunkSection nibble data to snapshot. Fixes BUKKIT-1977 2012-08-02 21:45:54 -05:00
Luke Granger-Brown
35a3d701a9 Add trailing / to BukkitDL URLs. Fixes BUKKIT-2015.
Also adds CraftBukkit version number to user agent when communicating with
BukkitDL.
2012-08-02 21:38:32 -05:00
Travis Watkins
8dc52123bf Fix dispenser event handling 2012-08-02 17:55:13 -05:00
feildmaster
d18972eca2 Fix Nether and The End having the same world names. 2012-08-02 11:02:14 -05:00
feildmaster
402b177be4 Add missing callWorldInitEvent on startup. 2012-08-02 10:14:01 -05:00
feildmaster
a43d621c01 Update CraftBukkit to Minecraft 1.3.1 2012-08-02 04:58:50 -05:00
Wesley Wolfe
a4d7691299 Detect and disconnect 1.3 clients properly. Fixes BUKKIT-1952 2012-07-26 01:17:09 -05:00
Wesley Wolfe
b00de5f176 Cleaned up CraftBukkit comments in NMS.
Added newlines at the end of files
Fixed improper line endings on some files
Matched start - end comments
Added some missing comments for diffs
Fixed syntax on some spots
Minimized some diff
Removed some no longer used files
Added comment on some required files with no changes
Fixed imports of items used once
Added imports for items used more than once
2012-07-23 23:55:31 -05:00
Steve Anton
8b9aad8c2b Add remaining missing setLastDamageCause's 2012-07-14 17:57:31 -05:00
feildmaster
79189c1c13 Add missing setLastDamageCause. Thanks MonsieurApple 2012-07-13 22:57:42 -05:00
feildmaster
46125dc6cf Implement getExpToLevel method. Fixes BUKKIT-1906 2012-07-11 17:14:07 -05:00
feildmaster
cf9544c1d9 Reuse ItemInWorldManager, and stop applying ability changes. Fixes BUKKIT-1811 2012-07-09 18:07:53 -05:00
Mike Primm
08740d7f91 [Bleeding] Include chunk biome data for refresh chunk. Fixes BUKKIT-1166 2012-07-08 19:11:51 -05:00
feildmaster
dba9349ed4 Factor invulnerableTicks into getNoDamageTicks. Fixes BUKKIT-1324 2012-07-04 15:12:29 -05:00
feildmaster
d7272f42ef Implement getMotd, and reload the motd. Adds BUKKIT-1799 2012-07-03 18:00:37 -05:00
feildmaster
00efc8c464 Apply setLastDamageCause after processing events and the event has not been canceled. Fixes BUKKIT-1881
This allows previous causes to be available during the event, as well as making the damage cause a valid one. If EntityDamageEvent is canceled, then it's not the last DamageCause.

Also prevents setting DamageCause involuntarily through construction.
2012-07-02 22:22:03 -05:00
feildmaster
e4e994f710 Treat ComplexParts as proxies for setLastDamageCause. Fixes BUKKIT-1821 2012-07-02 22:22:03 -05:00
feildmaster
0a0d5ebf20 Clean entity.damage functions. Fixes BUKKIT-1822 2012-07-02 22:22:03 -05:00
Wesley Wolfe
ff09ff07f9 Fix deprecated spawnCreature. Fixes BUKKIT-1880 2012-07-02 15:36:49 -05:00
H31IX
6093bcc445 Fix client crash on InventoryClick cancel. Fixes BUKKIT-1841 2012-06-28 19:34:51 -05:00
Travis Watkins
a21f038fc3 Mark entities as invalid when they get despawned. Addresses BUKKIT-810 2012-06-28 19:34:31 -05:00
Wesley Wolfe
f5b6abfae1 Fix double overflow/underflow calculations with explosions. Fixes BUKKIT-1865 2012-06-27 21:17:20 -05:00
TomyLobo
412b7eaa12 Implement LivingEntity.hasLineOfSight. Addresses BUKKIT-1255 2012-06-23 10:48:08 -05:00
Travis Watkins
78acee359e Use LinkedHashSet to make redstone update order consistent. Fixes BUKKIT-1850 2012-06-23 10:47:38 -05:00
V10lator
ea4d3662be Deprecate spawnCreature and add spawnEntity. Addresses BUKKIT-1168 2012-06-23 10:18:50 -05:00
feildmaster
568fae2e86 Trigger EntityBlockChangeEvent for Silverfish. Adds BUKKIT-1560 and BUKKIT-1593 2012-06-23 06:42:08 -05:00
feildmaster
23d5922bbf Added EntitySilverfish for diff visibility 2012-06-23 06:42:06 -05:00
Wesley Wolfe
57763845d0 Implement plugin channel events. Addresses BUKKIT-1844 2012-06-21 02:39:59 -05:00
Travis Ralston
9f37f70527 Fire PlayerItemBreakEvent. Addresses BUKKIT-1600 2012-06-21 01:10:30 -05:00
Ammar Askar
8bc42ba8c9 Clear animal owner when untamed. Fixes BUKKIT-1482 2012-06-20 12:45:17 -05:00
H31IX
0095add08c Add query-plugins setting. Addresses BUKKIT-1781 2012-06-20 12:40:12 -05:00
Wesley Wolfe
6bbae461d5 Fix Heisenplayers 2012-06-17 01:25:01 -05:00
Jeff Wardian
ae98a6f051 Changes '/whitelist list' to ignore comments. Addresses BUKKIT-1804 2012-06-14 23:33:21 -05:00
Jeff Wardian
ae94a3308d Preserve whitelist ordering. Addresses BUKKIT-1805 2012-06-14 23:33:13 -05:00
obnoxint
e35f6f2526 Fire NotePlayEvent. Fixes BUKKIT-1779 2012-06-14 20:58:57 -05:00
obnoxint
72d64b516c Add TileEntityNote from mc-dev for diff visibility. 2012-06-14 20:58:57 -05:00
Wesley Wolfe
9002690651 Implement asynchronous pre-login event; Addresses BUKKIT-1213 2012-06-13 23:00:46 -05:00
Wesley Wolfe
ed6d4c7759 Support asynchronous events; Addresses BUKKIT-1212 2012-06-13 23:00:46 -05:00
Jake King
f58e514192 Don't send kick message if the message is empty. Fixes BUKKIT-1789 2012-06-13 22:21:40 -05:00
H31IX
01fe76733f Fire PlayerToggleFlightEvent. Fixes BUKKIT-1696 2012-06-13 22:21:35 -05:00