Commit Graph

2005 Commits

Author SHA1 Message Date
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
Wesley Wolfe
708252c020 Implement 1.4.6 ItemMeta. Adds BUKKIT-3236, BUKKIT-3237
Some meta functionality is refactored into common methods.

CraftItemStack uses the ItemMetaKey identifiers for enchantments.

Refactored unit test to include extra functionality; initially only
checking the presence of the DelegateDeserialization annotation.
2012-12-21 10:36:34 -06:00
Wojciech Stryjewski
f377a7680f Add API to allow plugins to request players switch to a texture pack. Adds BUKKIT-2579
The setTexturePack method causes the player's client to
download and switch to a texture pack specified by a URL.

Note: Players can disable server textures on their client, in which
case this API would not affect them.
2012-12-20 22:09:38 -05:00
feildmaster
f4836fb428 Add the ability to make Enchanted Books. Fixes BUKKIT-3220 2012-12-20 20:51:51 -06:00
feildmaster
bd0daa6d54 Remove obsolete fix for the end
The end was getting block offsets, causing client side issues.
2012-12-20 19:15:37 -06:00
Travis Watkins
ca7f67da9d Fetch correct info for skulls in block.getDrops(). Fixes BUKKIT-3205 2012-12-20 15:06:01 -06:00
Mike Primm
ed2dd31a80 [Bleeding] Fix exception in getChunkSnapshot() - sky light can be null 2012-12-20 14:22:25 -06:00
feildmaster
686807e387 Filter invalid ItemStacks from Packets.
Invalid ItemStacks are causing Fireworks to disconnect players and
prevent them from reconnecting
2012-12-20 10:52:44 -06:00
feildmaster
23b6764374 Update CraftBukkit to Minecraft 1.4.6 2012-12-20 10:43:00 -06:00
mbax
924a46469d [Bleeding] Check visibility API for sounds. Fixes BUKKIT-3114
With 1.4, entity sound tracking changed for the better.
Our previous method additions can now be removed.
All that's left is checking if the source can be seen
by the recipient of the sound packet. Thanks, Mojang!
2012-12-18 19:02:20 -06:00
feildmaster
d9708d032e Fix PotionMeta not applying the correct Id. Fixes BUKKIT-3193 2012-12-18 18:43:53 -06:00
feildmaster
d73e5ab469 Add missing name in PotionEffect for Wither 2012-12-18 18:20:11 -06:00