Commit graph

2137 Commits

Autor SHA1 Nachricht Datum
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
EvilSeph
95098c9435 Updated version to 1.4.6-R0.4-SNAPSHOT for development towards next release. 2012-12-31 01:14:07 -05:00
EvilSeph
2e1033215b Updated version to 1.4.6-R0.3 in pom.xml for Beta. 2012-12-31 01:00:18 -05: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
EvilSeph
6bb240cdf0 Updated version to 1.4.6-R0.3-SNAPSHOT for development towards next release. 2012-12-29 22:27:49 -05:00
EvilSeph
4047542d65 Updated version to 1.4.6-R0.2 in pom.xml for Beta. 2012-12-29 22:19:49 -05: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
EvilSeph
adc1c2f982 Updated version to 1.4.6-R0.2-SNAPSHOT for development towards next release. 2012-12-22 01:24:14 -05:00
EvilSeph
e6f14b4be5 Updated version to 1.4.6-R0.1 in pom.xml for Beta. 2012-12-22 01:12:16 -05: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