Commit Graph

2612 Commits

Author SHA1 Message Date
Kodekpl
3e896afe6b Implement SpawnReason.NETHER_PORTAL and DISPENSE_EGG. Fixes BUKKIT-3148
Previously any entities spawned through dispensers (monster eggs) or
by nether portals were given the incorrect SpawnReason of SPAWNER_EGG.
This made it impossible to distinguish what exactly happened in regards
to the creature being spawned.

A method in ItemMonsterEgg has been added to further fine tune reasons
for spawning creatures. This permits the DISPENSE_EGG reason to be used
correctly and accuratly as well as the NETHER_PORTAL reason due to how
BlockPortal spawns the mobs.

The redirected method, a(World, int, double, double, double), is still
called by the ItemMonsterEgg itself and therefore uses the default reason
of SPAWNER_EGG. This does not change previous behaviour.
2014-02-01 22:29:15 -07:00
turt2live
c59ba98ae6 [Bleeding] Handle players disconnecting during respawn. Fixes BUKKIT-4327
Prior to this commit, a player disconnected during a respawn event would
remain in memory. This causes a ghosting issue of players in the slot
count and player list, as well as a reference leak.

This commit avoids re-adding the player to the player list (and world) if
they are disconnected. This ensures that the remainder of the respawn
logic is completed as well as ensuring a duplicate player is not left on
the server.

This commit also saves the player's file at the end of the method if they
have been disconnected to ensure that their next login is accurate to the
respawn event's actions. A player that was revived and disconnected will
reconnect as revived.
2014-02-01 22:52:01 -06:00
Travis Watkins
d7d81fa68f Load all already generated chunks via async chunk system
Currently we use the async chunk loading system only when players trigger
chunk loading. If a chunk is loaded for any other reason it goes through
a separate codepath. This means if a player has trigged a chunk load and
before the chunk loads something else wants the same chunk we will load it
twice and throw away the second result. With this change we instead use
the sync processing feature of the AsynchronousExecutor to load the chunk
which will pull it out of the queue if it was already queued to load. This
means we only ever load a chunk once. Because chunk generation is not
thread safe we still fallback to the vanilla chunk loading system if the
chunk does not currently exist.
2014-02-01 22:03:04 -06:00
Wesley Wolfe
4a6a81e724 Allow AsynchronousExecutor.getSkipQueue() to pull tasks from the queue 2014-02-01 17:57:52 -06:00
Travis Watkins
842962530a Don't call duplicate interact air events. Fixes BUKKIT-5359
Previously we attempted to call interact events in cases that were missing
by modifying the arm swing logic. This, however, was too broad and started
triggering events in cases we already covered leading to duplicates. Since
the only case we can handle cleanly and the primary point of the previous
fix was fluids we now instead simply treat fluids as air for this check.
This also ensures we do not get duplicate events when the player is in a
fluid and hits a normal block, unlike the previous change.

This reverts commit 68b702f7 and replaces it with a better fix.
2014-01-31 14:55:01 -06:00
t00thpick1
9907271071 [Bleeding] Store correct block type when hitting blocks. Fixes BUKKIT-5209
The block obtained and stored within the block object higher up does not
reflect the block at the location being hit, rather it is the air block
the arrow was previously in.  Thusly when the variable is used to check
if the arrow is still in the block, it fails.
2014-01-30 21:47:44 -07:00
t00thpick1
e0da846352 [Bleeding] Fix support for several entities in World.spawn(). Fixes BUKKIT-3284 2014-01-30 21:47:44 -07:00
t00thpick1
2fc5d59303 [Bleeding] Use correct yaw and pitch when spawning arrows. Fixes BUKKIT-3320 2014-01-30 21:47:44 -07:00
t00thpick1
b4c4c8ed78 [Bleeding] Directly set direction in EntityFireball. Fixes BUKKIT-1154
Because EntityFireball.setDirection() adds a random offset to passed
parameters, it is not appropriate for use in an API method. As such,
the values need to be directly set to remain accurate.
2014-01-30 21:47:44 -07:00
t00thpick1
1fa4b69bd8 [Bleeding] Implement setCharged and getCharged for WitherSkull. Addresses BUKKIT-3060 2014-01-30 21:47:44 -07:00
t00thpick1
8a5ad89a68 [Bleeding] Implement ProjectileSource API. Addresses BUKKIT-1038, BUKKIT-1156 2014-01-30 21:47:44 -07:00
MorphanOne
ac53442e7e Add setCritical and isCritical methods to CraftArrow.java. Adds BUKKIT-5113 2014-01-30 21:47:44 -07:00
Likaos
fb8c5547b3 Add methods to get and set arrow knockback. Adds BUKKIT-5103 2014-01-30 21:47:44 -07:00
GJ
7f22899456 [Bleeding] Re-add EntityShootBowEvent lost in e93a3eb3b4c5234e3e3936bc697d566a42d3b30e. Fixes BUKKIT-4214
In the 1.2 update for CraftBukkit, a missed diff resulted in Skeletons no longer firing an EntityShootBowEvent when they shoot an arrow.
2014-01-30 21:47:44 -07:00
GJ
e962b1bc09 [Bleeding] Add support for ThrownExpBottle and Fish to launchProjectile(...). Fixes BUKKIT-1536
Previously, trying to launch a ThrownExpBottle or Fish projectile would
result in an IllegalArgumentException. This commit adds support for both
ThrownExpBottle and Fish, which means that all current projectiles are
now properly supported by this method.
2014-01-30 21:47:44 -07:00
GJ
855b5f8ae3 [Bleeding] Instantiate logger earlier in CraftServer. Fixes BUKKIT-4253.
Previously, if an error occurred during CraftServer initialization before the
logger was instantiated, it would cause an NPE and the server would never
finish loading properly. By instantiating the logger before attempting to
load anything else in CraftServer, we ensure that a logger will always be
available in the case of any errors.
2014-01-30 21:44:36 -07:00
GJ
19521b7f1c [Bleeding] Fire interact events for Weighted Pressure Plates. Fixes BUKKIT-5053
In 1.7, Minecraft changed Weighted Pressure Plates to allow players and
entities to interact with them, rather than simply changing redstone signal
based on the number of items on the pressure plate. This commit adds calls to
PlayerInteractEvent or EntityInteractEvent for every entity that steps on the
plate.
2014-01-30 21:44:36 -07:00
GJ
6a00959980 Add BlockPressurePlateWeighted.java for diff visibility 2014-01-30 21:44:36 -07:00
Nate Mortensen
e4ba663d2a Relocate NaN check on PacketPlayInFlying. 2014-01-29 18:13:14 -07:00
Travis Watkins
6e6ad530e7 Readd connection throttle 2014-01-28 14:54:53 -06:00
Wesley Wolfe
516a02b8bb Fix stacking for items after setting empty meta. Fixes BUKKIT-5331
ItemStacks do not stack if one has null for a tag, while the other has an
empty tag. In CraftItemStack, if you set an item to an empty ItemMeta, it
will create an empty tag for the internal ItemStack.

This changes the setItemMeta function to check for empty meta, and then
use null for the tag instead of an empty NBTTagCompound.
2014-01-23 23:24:59 -06:00
Wesley Wolfe
a46eac8bce Implement API for ServerListPingEvent. Adds BUKKIT-5121, BUKKIT-2465 2014-01-19 15:56:27 -06:00
t00thpick1
030cf5a6d1 [Bleeding] Properly handle EntityBreakDoor event canceling. Fixes BUKKIT-5318
The method being called was renamed during the 1.4.2 update process
but the function call was not replaced accordingly, leading to a
missed diff from 314051580a0a8e4745d3a539f232b552916eb302.
2014-01-18 15:52:54 -06:00
t00thpick1
771c41c691 [Bleeding] Account for null in EntityDamageEvent handling. Fixes BUKKIT-5317
Damage caused by explosions will return null for the event as of
6588d6f72bbca74bf150de65593ac575b846111b. As such, a null check is
now necessary when handling non-living entity damage events.
2014-01-18 15:52:54 -06:00
t00thpick1
fef9f9692f [Bleeding] Check that vanilla recipes actually exist. Fixes BUKKIT-5277
When falling back to vanilla recipes in the iteration of recipes,
a check is necessary to ensure that vanilla recipes are present.
RecipeIterator has been modified to account for the multi-map setup.
2014-01-18 15:52:22 -06:00
t00thpick1
b8143c63c2 [Bleeding] Implement methods for /achievement command. Addresses BUKKIT-4932 2014-01-16 00:51:09 -06:00
t00thpick1
622a2976d9 [Bleeding] Fix Achievements and Statistics API. Fixes BUKKIT-5305 2014-01-16 00:51:04 -06:00
t00thpick1
dd12820c58 Add StatisticManager.java for diff visibility. 2014-01-16 00:50:57 -06:00
Wesley Wolfe
05ed0a3139 Implement UnsafeValues for give command. Addresses BUKKIT-5286 2014-01-14 22:38:03 -06:00
t00thpick1
81919478fc [Bleeding] Implement setIdleTimeout and getIdleTimeout. Addresses BUKKIT-4932. 2014-01-14 17:38:07 -07:00
Wesley Wolfe
fd65b29a0c Consider repair cost when checking ItemMeta emptiness. Fixes BUKKIT-5304 2014-01-14 18:15:04 -06:00
Wesley Wolfe
1f9f6a51c2 Add failing unit test for ItemMeta-repairability 2014-01-14 18:13:13 -06:00
Travis Watkins
32d9db82e5 Only delay removing containers. Fixes BUKKIT-5238
In commit f94b7af8 I delay removing the block until after running the
block's cleanup code to avoid errors. However, this causes problems of
its own due to blocks not being written with this in mind. To avoid blocks
getting recursively removed we now only delay removing containers since
they are the only ones we had problems with to begin with.
2013-12-24 21:51:15 -06:00
Travis Watkins
c57e45dcdc Process block cleanup first. Fixes BUKKIT-4103
When setting a block the server sets the new block ID, calls the cleanup
on the old block, then calls the placement logic for the new block. This
would normally work correctly but we have logic to prevent errors that is
causing one here. When trying to clean up the old block we notice the block
ID has changed and try to fix things, this causes the cleanup logic to
fail. To ensure cleanup happens correctly we now do all the cleanup before
changing the block which avoids triggering the fixup code.
2013-12-24 15:24:35 -05:00
EvilSeph
4a5de4249c Updated version to 1.7.2-R0.3-SNAPSHOT for development towards next release. 2013-12-21 03:08:41 -05:00
EvilSeph
025548445d Updated version to 1.7.2-R0.2 in pom.xml for Beta. 2013-12-21 02:51:50 -05:00
t00thpick1
1ecc59d4d9 [Bleeding] Handle custom furnace recipes separately. Fixes BUKKIT-1657, BUKKIT-3846
Due to vanilla blanket comparing data values, and the unspecified
order of hashmap iterators, we need to run through custom recipes
first, and therefore separately, to ensure that they are actually
used. By not adding the custom results to the experience table, we do
not override the experience gains from vanilla smelting recipes.
2013-12-20 23:37:58 -06:00
t00thpick1
3c209a9884 [Bleeding] Fix crash involving horse passengers. Fixes BUKKIT-5212
Setting a horse's passenger to a non-living entity will cause a
server crash when the horse ticks, we need to check that it is
a living entity before casting, and skip otherwise.
2013-12-20 23:37:57 -06:00
t00thpick1
9bc3b7df24 [Bleeding] Call event when reflecting fireballs. Adds BUKKIT-5214 2013-12-20 23:37:56 -06:00
t00thpick1
624603cd41 [Bleeding] Send short version string on ping. Addresses BUKKIT-5206
With the update in 1.7 that improved the server ping, it was made to
include a long version string for CraftBukkit. This value is too long
for proper display so we now send a shortened string consisting of
the server implementation and the minecraft version.
2013-12-20 23:37:56 -06:00
EvilSeph
dfcff7eabf Account for different reach limit in Survival/Creative. Fixes BUKKIT-4257
When we first added the reach limiter in CraftBukkit there was no
difference between how far the client could reach in vanilla while in
Survival or Creative. At some point in Minecraft's cycle Creative was
given a block extra to work with and our protection was not updated to
account for this. We need to respect the possibility of different game
modes in Minecraft providing the client with varying reach distances.
2013-12-20 23:38:18 -05:00
EvilSeph
6d9a6fbb4b Fix attributes not clearing on death. Fixes BUKKIT-5213
Due to an incorrect mapping of this method to a friendly name, we're
unfortunately calling the wrong method within EntityPlayer.reset() to
reset attributes. Instead of what we've mapped as "removeAllEffects", we
should be calling EntityLiving.aP(). This mapping should be corrected in
the next naming version.
2013-12-20 15:33:06 -05:00
EvilSeph
330dbbf78c Updated version to 1.7.2-R0.2-SNAPSHOT for development towards next release. 2013-12-18 01:01:25 -05:00
EvilSeph
bda2179ae9 Updated version to 1.7.2-R0.1 in pom.xml for Beta. 2013-12-18 00:23:43 -05:00
t00thpick1
3cd64185a9 [Bleeding] Correctly generate torches on portal. Fixes BUKKIT-746
In the CraftBlockState implementation, updating the blockstate onto
a block will force the block state data value onto the block.
Unlike vanilla which relied on block data being set when the type
changed, we must instead explicitely set the data in the blockstate.
2013-12-17 22:29:12 -05:00
Nate Mortensen
8da5126282 Add new setResourcePack method. Fixes BUKKIT-5015
Minecraft now uses resource packs instead of texture packs, which broke
the setTexturePack method, as the client no longer listens on the MC|TPack
channel.

This commit fixes the issue by adding in a setResourcePack method, and by
deprecating setTexturePack and rewriting it to call the newly added
setResourcePack.  In order to simplify the method and prevent this from
happening in the future, setResourcePack calls EntityPlayer.a(String) to use
the same logic as minecraft when sending resource packs.
2013-12-17 20:17:38 -07:00
mbax
091fb2ea9e Process URLs as clickable. Adds BUKKIT-4917
In Minecraft 1.7, URL processing was removed from the client while the
server gained the ability to designate a URL to be launched in response to
clicking text. However, this functionality is not implemented in the
vanilla server. This commit adds that functionality to messages sent to
the client, processing URLs as clickable.

Additionally, char array iteration is replaced with regex.
2013-12-17 21:15:11 -05:00
Travis Watkins
0f48e9b06d Check pending blocks before falling back to world. Fixes BUKKIT-5122
When growing trees we use a BlockChangeDelegate which queues up the block
changes so plugins can modify/block/log tree growing. However, we always
check the actual world when checking for existing blocks. This means when
the tree growing code checks to see if putting a leaf in a block is valid
it may incorrectly overwrite a log block that should exist in that
location. To ensure trees grow correctly we now check the delegate itself
for blocks that match the queried location before checking the world.
2013-12-17 17:36:49 -06:00
EvilSeph
4f63a5f255 Fix mistranslation issue for PlayerToggleFlightEvent. Fixes BUKKIT-5172
Thanks for pointing it out RingOfStorms!
2013-12-17 18:05:56 -05:00
frymaster
fbdc3a7a74 Remove references to chunklist. Fixes BUKKIT-5190
Commit c576054539790bdeb35285f62863d74b48c0782d removed the chunklist
collection stored in ChunkProviderServer, however it has been partially
restored in some places by 7e1ac0a77129b169704c1e222ff2deb3ab6cd2d2. As
not all references to this were restored, this has caused the chunklist
and chunks collections to become out of sync, resulting in a memory leak.

This commit removes chunklist from ChunkProviderServer again.
2013-12-17 16:55:57 -06:00