Commit graph

2216 commits

Author SHA1 Message Date
Wesley Wolfe
acd637d48b Properly copy collection references in ItemMeta.clone(). Fixes BUKKIT-3913
When cloning an item, all references are copied to the new item. For
collections, this makes internal changes become visible in both the old and
new items.

In CraftMetaItem, clone was not making copies of the appropriate collections
and has been fixed for non-null values.

In CraftMetaEnchantedBook and CraftMetaPotion, clone was using possible empty
collection references and has been changed to explicitly null-check instead.
2013-03-28 20:01:01 -05:00
Travis Watkins
1a7e5a75ae Correct missed diff on skeletons. Fixes BUKKIT-3912 2013-03-28 19:42:27 -05:00
Andre LeBlanc
08f3df82eb Improve calling of ProjectileHitEvent. Fixes BUKKIT-3872 2013-03-26 07:13:14 -04:00
riking
45d3e2514d Add missing semicolon
I should try to compile before I say "this change is okay".
I should try to compile before I say "this change is okay".
I should try to compile before I say "this change is okay".
I should try to compile before I say "this change is okay".
for i in range(100)
2013-03-25 17:12:22 -07:00
Kristofer Henriksson
3c02fb02a1 Allow plugins to enchant already enchanted items. Fixes BUKKIT-1956
This causes the server to generate PrepareItemEnchantEvent even in the
case that an item is already enchanted or otherwise would normally not
be enchantable.
2013-03-25 15:56:15 -07:00
Black-Hole
02a5d09ddf Call EntityChangeBlockEvent when boats destroy blocks. Fixes BUKKIT-3871 2013-03-25 16:55:48 -04:00
Andre LeBlanc
18d7bc7ca3 Allow fishing success rate to be adjustable. Adds BUKKIT-3837 2013-03-25 14:45:24 -04:00
GJ
96ba65d506 Add methods to check conflicting enchantments. Adds BUKKIT-3830 2013-03-25 10:51:54 -04:00
Travis Watkins
5f089137ee Cleanup comments, formatting, etc 2013-03-25 00:51:36 -05:00
Patrick Seidel
7c40a073d8 Add ability to change player item in hand. Adds BUKKIT-3318 2013-03-24 14:04:27 -04:00
Travis Watkins
b532042973 Don't assume all hoppers are blocks. Fixes BUKKIT-3883 2013-03-24 12:38:57 -05:00
riking
8d3ba07f93 Add check for Thorns damage - Fixes BUKKIT-3505 2013-03-23 19:45:46 -07:00
Carlos Cobo
62c6d223e4 Include ThrownPotion in spawn methods. Adds BUKKIT-2542 2013-03-23 19:05:14 -07:00
EdGruberman
e1b50b0110 Identify outside slot independent of inventory type. Fixes BUKKIT-2768 2013-03-23 16:23:03 -07:00
Dennis Bliefernicht
e61a6bab05 Implement InventoryMoveItemEvent. Adds BUKKIT-3765
This makes droppers, hoppers and hopper minecarts fire an
InventoryMoveItemEvent whenever an item is being moved from or to another
inventory.
2013-03-23 16:12:52 -06:00
me4502
b10474253c Fire VehicleEnterEvent for loaded chunks only. Fixes BUKKIT-3831 2013-03-23 10:58:01 -06:00
James Clarke
3ad423af07 ANSI color codes now reset text attributes. Fixes BUKKIT-3508
The client resets all formatting after a color code is received, but currently the ANSI codes do not, and so the console does not accurately reflect the appearance of the formatted text. Instead, the ANSI color codes are now set to reset all text attributes.
2013-03-23 00:26:22 -04:00
Travis Watkins
444ced306a Cleanup and rework physical interaction events. Fixes BUKKIT-3686
Currently when dealing with physical interactions with pressure plates
and tripwires we immediately block their activation as soon as a single
entity involved has their event cancelled. We also fire events whenever
an entity intersects the block a wooden button is in even if they aren't
actually pressing it. To correct this we move the button interaction to
the correct place and modify all three to only block the activation if
every entity is blocked from using them instead of just one of them.
2013-03-22 17:18:19 -05:00
Xephi
ae19f2c46f Implement Dropper interface. Adds BUKKIT-3750 2013-03-21 22:33:16 -06:00
Xephi
978de7e9da Add BlockDropper for diff visibility 2013-03-21 21:42:47 -06:00
Travis Watkins
6f9e4f8541 Stationary lava is also a LAVA ignition cause. 2013-03-21 16:59:45 -05:00
Olof Larsson
abee107830 Add ability to modify ThrownPotion properties. Adds BUKKIT-3197 2013-03-21 15:18:27 -04:00
AlphaBlend
2c5b2a8f6f Add method to get the source of a TNTPrimed. Adds BUKKIT-3815 2013-03-21 12:47:46 -06:00
Andre LeBlanc
83e0e0770a Add Fish (Hook) entity to PlayerFishEvent. Adds BUKKIT-1025 2013-03-20 15:58:37 -07:00
nitnelave
ddec7117ee Implement unit test for hasGravity(). Adds BUKKIT-3832 2013-03-20 18:44:22 -04:00
Travis Watkins
696543cf3f Update CraftBukkit to Minecraft 1.5.1 2013-03-20 15:09:23 -05:00
Travis Watkins
6aaa1e83df Really don't filter out -1 data in ItemStack. 2013-03-20 11:11:47 -05:00
Travis Watkins
b325ffc8f6 Handle filled buckets dispensing up and down. Fixes BUKKIT-3814 2013-03-20 10:24:22 -05:00
Travis Watkins
2fc755cc65 Don't filter out -1 data in ItemStack. Fixes BUKKIT-3824 2013-03-20 09:44:17 -05:00
Travis Watkins
26d1f9189a Readd missed diff for minecart container size. Fixes BUKKIT-3826 2013-03-20 09:44:17 -05:00
Nate Mortensen
dc19d3788f BlockState for Command Blocks. Adds BUKKIT-3805. 2013-03-19 20:54:38 -06:00
Edmond Poon
e639690e45 Validate Server method input. Addresses BUKKIT-3687
CraftServer methods that implement the Server interface will throw an
IllegalArgumentException if a method cannot operate on a null input
and given a null pointer.

This causes methods to fail early and identify that a plugin is
responsible for passing in an invalid argument. This will only
change the exception thrown, if there originally was a thrown
exception. This helps with hunting down legitimate problems
with CraftBukkit.
2013-03-18 23:40:10 -06:00
Travis Watkins
51d4e647fb Only filter data on block items, not all items. 2013-03-18 18:22:13 -05:00
Travis Watkins
d26336eb40 Add /testfor command support to command block. Adds BUKKIT-3813 2013-03-18 17:12:21 -05:00
Travis Watkins
596047aa6b Only set player weather if a plugin requested it.
If the server changes the weather it will set the per-player weather
variable and future changes will not apply. We should only set this
variable when a plugin is requesting per-player weather and not when
the server it doing it.
2013-03-18 13:58:16 -05:00
T00thpick1
1bde25bb33 Implement per-player Weather API. Adds BUKKIT-812 2013-03-18 13:03:54 -05:00
Yariv Livay
a7a5f273e3 Implement new cause versions of BlockIgniteEvent. Addresses BUKKIT-3609, BUKKIT-3656, BUKKIT-3657 2013-03-18 12:47:01 -05:00
Travis Watkins
2e6cfdb3cc Implement InventoryPickupItemEvent. Adds BUKKIT-3798 2013-03-18 12:35:43 -05:00
Michael Limiero
2642fbdf7e Make CraftMinecartHopper work as InventoryHolder. Adds BUKKIT-3796 2013-03-18 12:16:37 -05:00
Chad Waters
93fd33e218 Implement Entity.isOnGround(). Adds BUKKIT-3787 2013-03-17 22:25:05 -05:00
Travis Watkins
5df704bf5a Use name given to command block instead of "@". Fixes BUKKIT-3803 2013-03-17 20:19:32 -05:00
Michael Limiero
d802168cd5 Implement Hopper block state and inventory methods. Adds BUKKIT-3749 2013-03-17 12:59:27 -05:00
Travis Watkins
6f68fc4ba4 Add missing getOwner method for container minecarts. 2013-03-16 18:32:01 -05:00
Travis Watkins
737e8c5127 Allow special crafting data value on items. Fixes BUKKIT-3780 2013-03-16 18:16:00 -05:00
Travis Watkins
5515b0ee2b Handle double trapped chest inventory. Fixes BUKKIT-3772 2013-03-16 17:14:21 -05:00
Travis Watkins
0e60f1f7b8 Fire BlockDispenseEvent for new dispenser behaviors. Fixes BUKKIT-3774 2013-03-16 16:55:27 -05:00
Travis Watkins
fbe609bdbe Add new DispenseBehavior files from mc-dev for diff visibility. 2013-03-16 16:48:08 -05:00
Travis Watkins
ff1c1daf69 Allow data on tool items. Fixes BUKKIT-3773 2013-03-16 14:51:22 -05:00
Travis Watkins
2e47a1eb80 Comment out vanilla debug message. 2013-03-16 13:45:42 -05:00
Travis Watkins
515830cda9 Filter negative values for all items. 2013-03-16 13:26:29 -05:00
Travis Watkins
6d88d545e9 Filter data for items that shouldn't have it and filter wool.
We used to fall Item.filterData() for this but that method is meant for
converting item data to block data during placement and does the wrong
thing for this case. Instead we just see if the item should have data and
if not set it to zero. We also have to filter wool data explicitly because
clients crash when given invalid wool data.
2013-03-16 13:14:09 -05:00
Travis Watkins
a76a5bd36f Ignore invalid inventory slots. Fixes BUKKIT-3737 2013-03-16 10:28:12 -05:00
Travis Watkins
9a38f2022a Use Chest block state for trapped chests. Fixes BUKKIT-3762 2013-03-16 09:46:32 -05:00
Travis Watkins
5903b9f5ca Don't set health directly, will interfere with scoreboard system. 2013-03-16 08:57:57 -05:00
Travis Watkins
7466321212 Limit mob names to 64 chars to avoid client crash. Fixes BUKKIT-3753 2013-03-16 08:32:31 -05:00
Travis Watkins
4fa8c24e42 Always consume bonemeal when used on a sapling. Fixes BUKKIT-3755
In Minecraft 1.5 saplings do not grow with a single use of bonemeal anymore.
Our code assumes they will and only takes away bonemeal from the player
when the tree grows successfully (not cancelled by a plugin). Instead we
now always remove a bonemeal even if a plugin is the reason a tree didn't
grow as this matches the vanilla logic more closely.
2013-03-16 08:05:03 -05:00
Travis Watkins
d47849df8c Remove duplicate place logic for snow. Fixes BUKKIT-3756 2013-03-16 07:38:54 -05:00
Wesley Wolfe
2cb9cbf05c Handle the newly refactored minecarts. 2013-03-16 02:15:51 -05:00
Travis Watkins
b2c72b968e Use proper naming convention for boolean methods. 2013-03-15 14:25:37 -05:00
Travis Watkins
83d29e461c Update CraftBukkit to Minecraft 1.5 2013-03-15 13:28:59 -05:00
Wesley Wolfe
ba6e4c38cf Fix compilation error with exception names 2013-03-02 16:33:35 -06:00
Nate Mortensen
032c7366ad Use the correct CB object for ContainerBrewingStand. Fixes BUKKIT-3357 2013-03-02 16:01:14 -06:00
Eimref
cf7dfeda62 Add proper logging for custom channel exceptions. 2013-03-02 15:57:00 -06:00
Travis Watkins
f6c574dd04 Implement PlayerItemConsumeEvent. Adds BUKKIT-2349 2013-03-02 00:33:46 -06:00
Andrzej Pomirski
993e19b3fb Close inventory on teleport. FIXES BUKKIT-3021. 2013-02-10 17:22:34 -06:00
EdGruberman
d06e597ca5 Check TravelAgent.findOrCreate(Location) for null; Fixes BUKKIT-3590
If a custom TravelAgent is used and returns null for findOrCreate method
a NullPointerException will occur.
Conflicts:
	src/main/java/net/minecraft/server/PlayerList.java
2013-02-10 17:21:59 -06:00
James Clarke
5bb81b75c7 Set CraftTravelAgent.DEFAULT to a non-null value. Fixes BUKKIT-3578
Currently, CraftTravelAgent will call s() on the passed-in WorldServer in order to set DEFAULT. However, s() will always return null at this point, because WorldServer.P will still be null, as it is set after the constructor is called. Instead, we set CraftTravelAgent.DEFAULT to the instance that is being constructed.
2013-02-06 16:45:22 -06:00
feildmaster
2e99e02094 Use entity UUID instead of EntityID for metadata. Fixes BUKKIT-3582
The entity id is a non-unique, non-persistent value, and will cause
entities to lose their respective meta data on chunk unloading, and
teleportation.
2013-02-06 16:32:19 -06:00
EdGruberman
efe8e9a7f5 Always return a TravelAgent; Fixes BUKKIT-3541
Recent changes caused PlayerPortalEvent to suddenly return null
unexpectedly and could end up in NPEs resulting that did not before.
This commit addresses that situation by always ensuring a TravelAgent
instance is returned.

The TravelAgent for world 0 is returned arbitrarily in an effort to
compensate for plugins that are implementation dependent and expect some
form of a TravelAgent to be accessible in the event at all times.
2013-02-04 18:53:06 -06:00
James Clarke
4d3865a036 Fix players spawning above portals. Fixes BUKKIT-3542.
Vanilla does not check for blocks in which the player could
suffocate when changing dimension, so portals will happily spawn
players in blocks when using a portal under certain
circumstances. However, we currently check for these instances
and move the player up until they will not suffocate. This means
that players can sometimes be taken to above the target portal,
making it seem as if a portal was not created. Instead, we now
disable this suffocation check when moveToWorld is called from
changeDimension, mirroring vanilla behavior more accurately.
2013-02-04 18:53:05 -06:00
James Clarke
d661c67a70 Always use the set exit location for portal events. Fixes BUKKIT-3555. 2013-02-04 18:53:04 -06:00
James Clarke
94da64ee93 Use the result of EntityPortalExitEvent. Fixes BUKKIT-3559. 2013-02-04 18:53:03 -06:00
feildmaster
b4b7cacf5e Fix NPE when getting bed spawn location. 2013-01-29 17:25:39 -06:00
feildmaster
37975946a2 Fix contract with Player.getBedSpawnLocation. Fixes BUKKIT-3525
Getting the bed spawn location is supposed to check if the bed is
valid, however, it currently did not do so.
2013-01-29 10:11:57 -06:00
feildmaster
0576395ddd When leaving the end, always target the main world. Fixes BUKKIT-3517 2013-01-29 09:48:52 -06:00
feildmaster
b0e43c8097 Make command blocks only select players on its world. Fixes BUKKIT-3515 2013-01-28 17:01:08 -06:00
EdGruberman
132fdbc4ac Target default world when returning from The End; Fixes BUKKIT-3494
Due to the having to generate new logic to avoid using the customized
PlayerConnection.moveToWorld, entities returning from The End were not
properly calculating their exit target.  This commit corrects that
logic.
2013-01-28 11:26:32 -06:00
Wesley Wolfe
50e74b3b49 Remove erroneous break statement in scheduler. Fixes BUKKIT-3395 2013-01-27 23:00:14 -06:00
feildmaster
1053a1e29d Update Fireballs to account for ExplosionPower. Fixes BUKKIT-3460
Adds BUKKIT-3516
2013-01-27 16:43:30 -06:00
feildmaster
f20d6e3595 Ignore block functions for skulls on BlockPlace. Fixes BUKKIT-3495
Skulls don't normally get block data applied to them, so we shouldn't
apply it either.
2013-01-27 11:31:27 -06:00
feildmaster
899b9c17cc Direct all BlockPlaceEvents to a singular location. Fixes BUKKIT-3438
By having a single function to process BlockPlacement logic, we make
it so that there is consistent behavior throughout all BlockPlace
events. This should allow for easier troubleshooting and less diffs
in source.

This also fixes BUKKIT-3463 by including the correct coordinates that
were clicked to the event.
2013-01-27 10:44:32 -06:00
feildmaster
528bbbdcd8 Fix TileEntities and Blocks getting out of sync. Fixes BUKKIT-3501
Also fixes: BUKKIT-3477 and BUKKIT-3488

Minecraft likes to double check that tile entities get set after they
are placed, however we didn't set tile entities until after our event
was called. This caused the world to have multiple tile entities in a
single block location; to fix this we now set tile entities before
the event.
2013-01-27 10:34:59 -06:00
QuarterAnimal
6e438ccb32 Call BlockGrowEvent for Cocoa plants. Fixes BUKKIT-2525 2013-01-24 19:57:52 -06:00
QuarterAnimal
d74cf36f1c Add BlockCocoa for diff visibility. 2013-01-24 19:57:15 -06:00
QuarterAnimal
b82375a596 Preserve source block in mushroom spread event. Fixes BUKKIT-3354 2013-01-24 19:50:21 -06:00
feildmaster
f10c986136 Properly calculate level cost for books. Fixes BUKKIT-3410 2013-01-24 18:10:03 -06:00
feildmaster
f1efe717bd Call BlockPlaceEvent for skulls the same as other blocks. BUKKIT-3406
When the skull BlockPlaceEvent was added it was made so the event
would be called after all the data has been set, however this is a
behavior change that is inconsistent with other BlockPlaceEvents.
Instead, if people wish to get the block data they should schedule
a task.

Relates to: BUKKIT-3438
2013-01-23 20:41:05 -06:00
EdGruberman
9df87d3399 Compensate for allow-nether/allow-end as false; Fixes BUKKIT-3466
When either of those settings are false, the worlds are not loaded and
therefore will not be targeted for portal exits.  Existing worlds are
iterated directly to avoid defaulting to the first world if a direct
dimension match is not found.

Plugins must also specify exit from custom Bukkit worlds to comply with
original commit: https://github.com/Bukkit/CraftBukkit/commit/2dc2af0

This commit introduces a constant to clarify the dependency on the
CraftBukkit implementation of custom worlds having a dimension offset.
2013-01-23 20:11:01 -06:00
feildmaster
488e45b4ff Reload ban files when reloading the server. Adds BUKKIT-3470 2013-01-23 06:24:40 -06:00
feildmaster
641ecc4f34 Return the valid max value for piston direction. Fixes BUKKIT-2191
By returning the following value (7) we remove the need to special
case pistons in any way (other than the original purpose of this
check, which is to ensure pistons have valid data)
2013-01-23 06:15:21 -06:00
feildmaster
9ba0ddc292 Refactor processBlockPlace logic. Fixes BUKKIT-3406 and BUKKIT-3454
The previous logic was faulty since it lost the logic of "placing" the
block. It was also taking into account data that could have been
changed outside of the processing of this event, which is irrelevant
to the processing of this event.
2013-01-19 08:14:17 -06:00
feildmaster
6a499c8589 Fix broken null contract with Jukebox.setPlaying, Fixes BUKKIT-3429
The javadocs state that a null may be used to remove the currently
playing sound, however this causes a NullPointerException.

It also doesn't process registering the record correctly, along with
processing non-valid items.
2013-01-19 08:14:17 -06:00
EdGruberman
d834ca4c6c [Bleeding] Add experimental support for entity portal traveling 2013-01-19 06:20:33 -06:00
EdGruberman
9cb320654d Add BlockEnderPortal for diff visibility 2013-01-19 06:20:32 -06:00
Wesley Wolfe
01fc296fef Improve the item meta deserialization code-style
Fixed the ItemMetaFireworkTest

Add set power unit tests for FireworkMeta
2013-01-18 02:58:07 -06:00
Zloteanu Nikita
5934a65729 Always call PotionSplashEvent. Fixes BUKKIT-3363
This change allows plugins to add recipients to a PotionSplashEvent
when it would have otherwise had none.
2013-01-17 22:55:09 -06:00
feildmaster
d577b840d4 Place beds with the correct data. Fixes BUKKIT-3447 2013-01-17 12:17:37 -06:00
feildmaster
e59af9908b Update CraftBukkit to Minecraft 1.4.7 2013-01-17 03:50:24 -06:00
feildmaster
315127782a Initialize entity data before spawning them. Fixes BUKKIT-3209
Vanilla does the initialize before spawning everywhere except in the
SpawnerCreature, our spawn event depends on this behavior to be
consistent.
2013-01-16 23:05:18 -06:00
bloodmc
b581068464 Fix entities traveling sideways. Addresses BUKKIT-3443
Original: Update mappings to correct 1.4.6 version.
2013-01-16 23:05:18 -06:00
feildmaster
ccbd3d84e8 Get the BlockState before changing the block. Fixes BUKKIT-3441 2013-01-16 20:21:38 -06:00
feildmaster
98aea835b5 Handle beds and doors the same way as other blocks. Fixes BUKKIT-3437
Relates to: BUKKIT-3438
2013-01-16 08:06:00 -06:00
feildmaster
614ef2f8c5 Throw BlockPlaceEvent when placing double slabs. Fixes BUKKIT-2469 2013-01-16 08:05:59 -06:00
Wesley Wolfe
647b82032b Add ItemStackMapTest
This test was missing from c056293b38cb9a1296937d91746b175252be044a
2013-01-15 01:22:53 -06:00
cexikitin
8bc9e712e1 Spawn monsters without prematurely exiting. Fixes BUKKIT-3425
By using return 0, we exit the loop prematurely preventing other
creature types from being spawned if one type is set to 0. By using
continue we move on to the other types and allow them to spawn
properly.
2013-01-14 19:24:08 -06:00
Wesley Wolfe
dd7ba4a258 Various ItemMeta fixes.
Fixes BUKKIT-3408, BUKKIT-3190, BUKKIT-3191, BUKKIT-3407

These changes relate mostly to semantical changes for serialization
contract, exception of changing the map scaling value from byte to boolean,
what it should have been in the first place. Appropriate unit tests were
added for CraftMapMeta, as they were missing.
2013-01-09 05:04:08 -06:00
Wesley Wolfe
43865e8e67 Update unit test to reflect firework color fix. Fixes BUKKIT-3382
The ItemDye color-int array uses dye data values, not wool.
2013-01-05 17:16:19 -06:00
Wesley Wolfe
182681e384 Update calls to DyeColor getData and getByData. Addresses BUKKIT-2786
These two methods are now deprecated and replaced by the strictly
equivalent calls using wool data.
2013-01-05 17:15:49 -06:00
feildmaster
baaf8e1d86 Implement fishing experience. Adds BUKKIT-3348 2013-01-01 23:59:47 -06:00
feildmaster
fb0be1fc0a Move the tile entity with the falling block. Adds BUKKIT-3349
Allows for interesting things to be done with world.spawn()
2013-01-01 23:58:46 -06:00
feildmaster
8f0c1aed6b Fix "setSitting" on tameable animals. Fixes BUKKIT-1534
This makes it so animals (tame or not) will sit properly and not move
around.

Wild animals that are sitting may override the sitting position if
they are attacking.
2013-01-01 22:28:44 -06:00
feildmaster
05512942db Add PathfinderGoalSit for diff visibility 2013-01-01 22:28:43 -06:00
Mike Primm
32924f9757 [Bleeding] Fix corruption due to thread safety issues. Fixes BUKKIT-3333
The 'tag' NBTTagCompound field of the ItemStack assumes that it is OK to
save a reference to an NBT supplied via load() and assumes it is OK to
supply a reference to the internal field during a save(). Neither is true,
as Chunk NBT structures are required to be read-only once created (due to
being written asynchronously off the server thread AND due to the potential
to be passed to a new Chunk if the same chunk is reloaded before the
writing of the NBT is completed by the File I/O thread). Keeping a live
reference to the NBT copy passed in, or to the NBT value passed back
during saving, creates serious thread safety issues which can result in
corrupted data being written to the world data files.

The specific issue here was uncovered by the recent change to use
setName("") on the ItemStack.tag object. When a chunk is being loaded
again before its save is completed, this results in name of the field
in the NBT being set to "". This causes it to be saved as "" instead
of "tag" resulting in it not being properly reloaded in the future which
results in the itemstack losing all of its metadata.
2012-12-30 23:31:22 -06:00
Wesley Wolfe
bb83795815 Return the level, not ID. Fixes BUKKIT-3326
CraftItemStack was erroneously using the enchantment ID instead of level
for the return value of remove enchantment.
2012-12-29 20:53:27 -06:00
Wesley Wolfe
8954cb291c /dev/null does not accept EnchantmentThorns 2012-12-29 19:18:37 -06:00
feildmaster
7b5a8d0c23 Don't teleport entities that are considered dead. Addresses BUKKIT-1331
Teleportation should never be processed on dead entities. If you wish
to teleport an entity, do it on a living entity. If you wish to
teleport a player, set their respawn location in PlayerRespawnEvent.
2012-12-29 19:18:36 -06:00
Mike Primm
fb0eed177a [Bleeding] Implement periodic chunk garbage collector
This adds two settings to bukkit.yml, allowing activation and control of
two chunk garbage collection triggering conditions:
chunk-gc/period-in-ticks controls a periodic GC, run once every N ticks
(default is 600); chunk-gc/load-threshold causes the GC to run once
after every N calls to loadChunk() on a given world (this call is an API
call used by plugins, and is distinct from the path taken for routine
player movement-based loading).  In both cases, setting to zero will
disable the given GC scheduling strategy.

In either case, the act of doing the GC is simply one of scanning the
loaded chunks, seeing which are NOT being used by one or more players
(due to view-distance) and which are not already queued for unload, and
queueing them for a normal unload.  Ultimately, the unload is then
processed the same as if the chunk were unloaded due to leaving the
view-distance range of all players, so the impact on plugins should be
no different (and strategies such as handling the ChunkUnloadEvent in
order to prevent unload will still work).

The initial interval for the periodic GC is randomized on a per-world
basis, in order to avoid all world being GCed at the same time -
minimizing potential lag spikes.
2012-12-29 16:50:05 -06:00
feildmaster
538de63a03 Fix persistence on tamed pets. Fixes BUKKIT-3300
With the persistence api introduced, pets did not have their
persistence flag updated to reflect their persistence. This caused
tame ocelots to not persist under specific conditions.
2012-12-28 20:27:41 -06:00
feildmaster
509e3d2a32 Update maxhealth for entities that have variable max health. Fixes BUKKIT-3308
Slimes and wolves have health that can change based on certain
conditions. So we check if their max health should be updated, and if
it has been customized in any way.

We also scale the wolf's health for their tail
2012-12-27 21:05:40 -06:00
feildmaster
b908c192bf Fix removing enchantments causing the enchantment tag to remain. 2012-12-27 20:48:56 -06:00
feildmaster
54b2707ba7 Fix discrepancies in NBT and ItemMeta. Fixes BUKKIT-3279
An ItemStack gains the tag name "tag" when the stack is serialized
to NBT, however items don't have a tag *until* they are serialized at
least once. So to solve this, we remove the tag name when loading the
NBT data.

Another problem with NBT are TagLists, when transferring tag lists
between the server and the client the names are lost, and so we
simply don't add a name to the tag.
2012-12-27 20:45:21 -06:00
Travis Watkins
25732f0487 Fire BlockRedstoneEvent for repeaters. Fixes BUKKIT-1157 2012-12-27 15:40:18 -06:00
Travis Watkins
186a679730 Add BlockDiode from mc-dev for diff visibility. 2012-12-27 15:26:49 -06:00
Wizjany
5963da294f Don't update physics until after the place event. Fixes BUKKIT-3316
If you cancel a BlockPlaceEvent for a sign the world is updated as if
the block was placed and then destroyed. To avoid this we set the block
without updating physics then apply the update after the event.
2012-12-27 15:22:19 -06:00
cexikitin
49da990ee3 Never remove players when unloading chunks. Fixes BUKKIT-3129
When unloading chunks we have a check to ensure we do not remove players
from the world due to the issues this would cause. However, our check
to see if the player is in this chunk is reversed and is in fact entirely
wrong. Even if the player isn't currently in this chunk we do not want
to remove them as that will still cause the same issues.
2012-12-27 15:16:33 -06:00
feildmaster
3a0c5aff0c Fix fireballs being motionless (again). Fixes BUKKIT-3299
The key "direction" incorrectly mapped to variables that were already
set in the entity. In order to prevent loading incorrect data we
renamed "direction" to "power."
2012-12-25 05:58:49 -06:00
feildmaster
155b83e2c7 Perform permission removals after the quit event. Fixes BUKKIT-3303
The player would have no permissions (other than their OP status)
when checked in the Quit event. This is because we removed permissions
before the event occurred. By calling it afterwards, we can persist
the data until the server finally removes the player.
2012-12-24 22:11:04 -06:00
feildmaster
f726d07f11 Fix Skull BlockState setting illegal values on owner. 2012-12-24 14:32:08 -06:00
feildmaster
8292b73f30 Fix fireworks being short lived. Fixes BUKKIT-3291 2012-12-23 17:06:26 -06:00
feildmaster
edd90ccf16 Properly update fireworks. Fixes BUKKIT-3289 2012-12-23 08:59:15 -06:00
feildmaster
ced0646351 Implement entity max health methods. Adds BUKKIT-266 2012-12-23 07:29:06 -06:00
feildmaster
4e1793f363 Report valid health when getting Entity health. Fixes BUKKIT-3210 2012-12-23 07:29:05 -06:00
Wesley Wolfe
ed6aab8200 Remove runner leak on async tasks. Fixes BUKKIT-3288
In some situations, an async task could be cancelled with no tasks
pending. This means the finally {} block from run() never gets executed
properly on the last async task to have run, as it expected to be
executed again.

This fix takes the only spot that the task period is set to cancelled
and will check to see if the task should be purged from the runners
list.
2012-12-23 05:13:33 -06:00
Travis Watkins
717fbbeffa Update firework power when modifying meta. Fixes BUKKIT-3272 2012-12-22 13:07:18 -06:00
Travis Watkins
f72a08c22e Fire BlockDispenseEvent for fireworks. Adds BUKKIT-3246 2012-12-22 13:07:18 -06:00
Travis Watkins
da571ef428 Add DispenseBehaviorFireworks and EntityFireworks for diff visibility 2012-12-22 13:06:55 -06:00
feildmaster
dc85940526 Allow fireworks to be created. Adds BUKKIT-3262 2012-12-22 12:24:16 -06:00
Wesley Wolfe
6dc13b688a One record per JukeBox. 2012-12-22 05:48:11 -06:00
Wesley Wolfe
2fd78a6549 Add BlockJukeBox for diff visibility 2012-12-22 05:45:52 -06:00
feildmaster
2ee62eb580 Implement API to get and set FireworkMeta on Firework entities 2012-12-21 23:56:54 -06:00
meiskam
fdb4b2d911 Implement Skull BlockState. Adds BUKKIT-3259 2012-12-21 22:47:11 -06:00
meiskam
39e2af7bd1 Added TileEntitySkull for diff visibility 2012-12-21 21:56:47 -06:00
Wesley Wolfe
78d384de93 Zero is not less than zero. Fixes BUKKIT-3259 2012-12-21 21:48:09 -06:00
feildmaster
a0cf0d03f4 Check file existence before determining readOnly. Fixes BUKKIT-3255 2012-12-21 19:31:39 -06:00
feildmaster
ec211ed952 Update enchantment handling to 1.4.6. Fixes BUKKIT-3256 2012-12-21 19:31:28 -06:00
feildmaster
f71be2506d Fix loading Items entities with an invalid item. Addresses BUKKIT-3249 2012-12-21 16:07:59 -06:00
feildmaster
118682ce5c Don't save server properties when it's read only. Fixes BUKKIT-3250 2012-12-21 15:40:39 -06:00
feildmaster
0216d09033 Fix command line arguments being ignored. Fixes BUKKIT-3247 2012-12-21 15:40:39 -06:00
feildmaster
e937307596 Add a null check for Item Entities. Fixes BUKKIT-3249 2012-12-21 15:40:27 -06:00
Wesley Wolfe
b870755edb Use max inventory size for new stack. Fixes BUKKIT-3240 2012-12-21 11:10:23 -06:00