Commit Graph

2549 Commits

Author SHA1 Message Date
t00thpick1
bed3f7f8f5 [Bleeding] Repair missing diff in Explosion. Fixes BUKKIT-5662
The blast protection enchantment dampers explosions, however
the functionality was only added to block explosions, and not
entity explosions.
2014-06-22 15:23:15 -05:00
Travis Watkins
5b9950b5f7 Avoid checking for loaded chunks for lighting and entity ticking.
When a chunk is loaded the server tries to ensure it has its initial light
calculations done before sending it to the player. When ticking entities
the server tries to ensure the entity does not walk into an unloaded chunk.
To accomplish these the server checks a one chunk radius around the chunk
to be lit or a two chunk radius around the chunk the entity is in. These
lookups happen every tick even though their result is unlikely to change
that often. To reduce the cost of these checks we replace them with a
system to keep track of what neighbor chunks a chunk has loaded and update
it when chunks load or unload which is a much less frequent action. On a
server with ten players this change removes about 100,000 calls a tick to
LongObjectHashMap's containsKey method.
2014-06-21 21:12:46 -05:00
Travis Watkins
ea126f98ad Don't check unload queue before ticking things anymore.
In commits 71a238ee and c8591397 we added checks while ticking to ensure
we never ticked anything in a chunk meant to be unloaded. We did this to
prevent these chunks being removed from the unload queue and leaked.
However, this causes a ridiculously large number of lookups on the queue
for a somewhat rare occurance. We also now have the chunk GC which will
take care of these leaked chunks when they do happen. With this in mind
we now remove these checks which removes almost all uses of the
LongHashSet backing the unload queue.
2014-06-21 21:03:00 -05:00
bloodshot
1b48298d25 Add special case for handling place event with lilies. Fixes BUKKIT-5641 2014-06-01 00:23:06 -05:00
Travis Watkins
1c13d076af Improve ItemStack filtering. 2014-06-01 00:23:06 -05:00
Nate Mortensen
47b57e6bcf Some assumptions are better than others. 2014-06-01 00:22:58 -05:00
Daniel Naylor
0a45c3ebf7 Use UUIDs in CraftPlayer equals and hashCode methods. Fixes BUKKIT-5634 2014-05-26 19:45:07 -05:00
Travis Watkins
38fbe60d46 Handle null targets in target event. Fixes BUKKIT-5635 2014-05-26 19:34:45 -05:00
Nate Mortensen
3fbf4d3b5f Fix ItemStack state during BlockPlaceEvent. Fixes BUKKIT-5632 2014-05-26 17:54:51 -06:00
Travis Watkins
e080bafa58 Rework mob item dropping on death. Fixes BUKKIT-5625
After the changes in d611cff2 we started including a mob's equipment when
calling EntityDeathEvent so plugins can access this data. However, the
changes to enable this triggered a bug that makes skeletons and pig zombies
no longer drop equipment because they handle this differently than the rest.
On top of this we don't handle dropping equipment for mobs that cannot
pick up items in vanilla even though vanilla does drop equipment for them
if you summon them with it. We also do not include a horse's inventory
in the event so they drop their saddle, armor, chest, and chest contents
with no way for a plugin to control this.

To solve this issues we revert mob item dropping back to vanilla logic
and instead just capture all their drops in the method they all call to
spawn them into the world. We also move horse inventory dropping so it
happens at a time when we're capturing these drops. With these changes
all items mobs drop on death should now be included in the event and
we have less diff to worry about for future updates.
2014-05-26 18:42:47 -05:00
Wesley Wolfe
4ab4fa5bb1 Fix polarity of Bat.isAwake() and Bat.setAwake(boolean). Fixes BUKKIT-5624 2014-05-20 03:18:26 -05:00
Travis Watkins
89d5265da6 Ensure we always log commands and log the right thing.
Waiting to log until after PlayerCommandPreprocessEvent makes the server
not log anything if the event is cancelled. It also makes the server log
what a plugin changed the command to instead of what the player actually
tried to run. As the point of the log is to have a record of every command
a player attempts to run these are both not desirable.
2014-05-14 14:28:52 -05:00
Wesley Wolfe
fa1b6ba834 Update CraftBukkit to use new YamlConfiguration encoding changes 2014-05-14 05:49:04 -05:00
Wesley Wolfe
8daacb9017 Implement awake flag for bats. Adds BUKKIT-5606 2014-05-13 20:38:42 -05:00
Wesley Wolfe
730a62c96a Handle chat packets correctly 2014-05-13 20:13:16 -05:00
Travis Watkins
65a6e97785 Handle inventory max stack sizes even better. Fixes BUKKIT-5595
In 7e37cf96 we modified the container logic to handle custom max stack
sizes better and ensure the client stays in sync with this scenario. This
had the effect of sending an extra set slot packet for every inventory
click a player did which was not wanted. These extra packets also cause the
client to recalculate recipes which breaks the result slot for custom
recipes. To avoid the extra packets in general we now only send them if the
max stack is not the one we started with. In the case of a setting a custom
max stack size on a workbench this is still not enough so we also now send
another extra packet to make sure the result slot is always correct.
2014-05-13 00:01:23 -05:00
Travis Watkins
5610337b4f Only set skull profile if it is a player skull. Fixes BUKKIT-5605 2014-05-12 23:22:04 -05:00
Travis Watkins
690a908b97 Avoid using the user cache in skull meta.
To handle changes in 1.7.9 we changed skull meta to use GameProfile
instances instead of strings of player names. This reflects what vanilla is
actually storing for skulls now. As skulls still require a name our API was
not changed and we instead look up the rest of the profile information from
the name. The way this was implemented made it so that deserializing a skull
or setting its name potentially involved a network request. As skull meta
itself does not actually require a complete profile we now simply create one
that only contains a name and leave populating it to the server when it is
actually needed.
2014-05-03 17:49:59 -05:00
GJ
33e472229e [Bleeding] Fix stack overflow with Ender Crystals. Fixes BUKKIT-5583 2014-05-03 10:59:32 -05:00
eueln
2bf22a9c49 Implement inventory creation by type and title. Fixes BUKKIT-4045
With the current API it is possible to create an inventory with a specific
type, but it is not possible to give such an inventory a title other than
the default.

The commit changes that by adding a method to optionally supply the title
for the given inventory type and holder, creating the functionality to
display any supported inventory type with a 32 character length String.

If the inventory title supplied is larger than 32 characters then an
IllegalArgumentException is thrown stating so.
2014-04-30 22:50:58 -06:00
GJ
c3e4767a79 [Bleeding] Recheck persistence for chicken jockeys each tick. Fixes BUKKIT-5577 2014-04-29 17:29:07 -06:00
GJ
5195513866 [Bleeding] Include equipment in EntityDeathEvent loot. Fixes BUKKIT-5566 2014-04-29 17:28:47 -06:00
GJ
76e6277175 [Bleeding] Allow generation of cocoa trees. 2014-04-28 10:18:55 -04:00
GJ
d91ee7d7ab [Bleeding] Correct issues with MEGA_REDWOOD trees. Fixes BUKKIT-5568
In commit 6efeddfe57, TALL_REDWOOD was used instead of the proper TreeType
of MEGA_REDWOOD. Additionally, this fixes an issue in CraftWorld with an
improper boolean flag related to the generation of MEGA_REDWOOD trees.
2014-04-28 09:49:33 -04:00
bloodshot
576758bc55 Refactored BlockPlaceEvent and BlockChangeDelegate. Adds BUKKIT-5558
23 classes have been removed as they are no longer needed using the new
capture logic. This should help quite a bit with future MC updates.

BlockPlaceEvent Refactor

Before calling Item.interactWith, a recording flag is turned on for
setTypeAndData to capture a blockstate for each block that attempts to be set.
When a block place event is cancelled, the recorded blockstate, stack
size, and metadata will revert back to the captured state. If the event is
not cancelled, a notification will be sent to clients and block physics
will be updated.

BlockChangeDelegate Refactor

Now that we have the ability to capture blockstates through world, there
is no need to modify world gen classes with BlockChangeDelegate. Instead
we will simply capture blocks during world generation in order to "replay"
all of the captured blockstates to send back to delegates.
StructureGrowDelegate and BlockSapling.TreeGenerator have also been
removed as part of this change. BlockSapling and BlockMushroom will
capture blockstates the same as block placement and revert back any grow
events if needed.
2014-04-23 21:25:55 -06:00
Travis Watkins
de97b62b89 Don't limit anvil stack size.
After the changes in c549609d anvils started incorrectly limiting their
inputs to single item stacks. Vanilla allows for full size stacks here and
this is useful for using materials to repair items so now we do too.
2014-04-23 20:48:37 -05:00
Travis Watkins
5dfb74032c Handle inventory max stack sizes better. Fixes BUKKIT-5564
Make sure we check the inventory's max stack size where appropriate and
don't assume the inventory slot is able to take our entire stack just
because it is empty. We also ensure the client is updated with the correct
slot contents and cursor contents in cases where the max stack changes
result in different behavior than the client expected.
2014-04-23 20:48:32 -05:00
Yariv Livay
c99de378c6 Faux sleepers wake up normally. Fixes BUKKIT-3667 2014-04-18 13:24:28 -05:00
Andre LeBlanc
5d24f2b9c0 Make AnvilInventory.getItem() use both containers. Fixes BUKKIT-2788
The AnvilInventory reports its size as the sum of the ingredient and
result inventories, but when trying to access the slots, only the
ingredient inventory is used, leading to an ArrayIndexOutOfBounds exception.

This change overrides getItem(I) and setItem(I) to use both inventories,
with the slot number adjusted based on their size.
2014-04-18 13:21:21 -05:00
Andre LeBlanc
47367210f3 Allow plugins to enchant normally unenchantable items. Adds BUKKIT-1849
It's currently not possible for a plugin to allow enchanting of an
otherwise un-enchantable item using the enchanting table. This commit
causes EnchantItemEvent to be called with an empty list of enchantments,
allowing a plugin to provide it's own set of enchantments when vanilla
Minecraft would not allow any. It also bypasses the unsafe enchantment check
since a plugin should be permitted to apply any enchantments they like, and
vanilla should not generate unsafe enchantments of its own.
2014-04-18 13:13:01 -05:00
PaulBGD
941650b9b2 Fix setting entity's target. Fixes BUKKIT-1358
Setting the goal target overrides the entity's will to do something
else. This makes it so entities like wolves with attack another player
with .setTarget(), instead of hanging next to their owner.
2014-04-18 12:55:07 -05:00
bloodshot
4c9bf34bf3 Update client stack when block place is cancelled. Fixes BUKKIT-5284
Currently, whenever a player places a block in a protected area the
equipped itemstack size on client is never updated properly since the
client thinks the block was placed. The reason this happens is because
ItemStack.matches returns true since the server does not decrement stack
size if a BlockPlaceEvent is cancelled. To correct this on cancel we set
the flag to always update the client regardless of matching.
2014-04-18 12:52:13 -05:00
bloodshot
5c115116ef Update chest animation after cancelling open event. Fixes BUKKIT-1440
Currently if a plugin cancels an InventoryOpenEvent for vanilla chests,
the chest animation for clients is stuck in the open state since
IInventory's closeContainer method is never called. To fix the issue,
closeContainer is called before exiting the display GUI method.
2014-04-18 12:47:32 -05:00
Devin Ryan
d0be633ed9 Catch exceptions when abandoning conversions. Fixes BUKKIT-5436
If a conversation is abandoned due to a player disconnecting and an
exception is thrown in a ConversationAbandonedListener, the server will
crash. This commit prevents the exception from propagating further up
the stack and instead just logs the error.
2014-04-18 12:33:56 -05:00
Des Herriott
8a6ed3a88b Check that item in hand is not null after book event. Fixes BUKKIT-5443 2014-04-18 12:30:53 -05:00
Brokkonaut
a86bc7aeb3 Call event when boat is destroyed by falling. Fixes BUKKIT-5500 2014-04-18 12:25:41 -05:00
Brokkonaut
0092460086 Removing broken chunk caching from World. Fixes BUKKIT-5425
Chunk caching in the World class does not know about outdated cache values.
This caused various problems when accessing previously unloaded chunks. The
caching also did not improve the performance so it is removed.
Synchronization is also not necessary, because all accesses to getChunkAt
may only come from the main thread.
2014-04-18 12:17:48 -05:00
GJ
890a4af12f [Bleeding] Call EntityTargetEvent in many new places.
Adds BUKKIT-5388, BUKKIT-5387, BUKKIT-5386, BUKKIT-5483, BUKKIT-5484.
Fixes BUKKIT-5389.
2014-04-18 10:43:06 -05:00
GJ
3abba82315 Add files from mc-dev for diff visibility. 2014-04-18 10:42:54 -05:00
GJ
7df7778ccb [Bleeding] Call BlockRedstoneEvent for all rails. Adds BUKKIT-4080
Previously, Detector Rails were the only rails that properly called
BlockRedstoneEvent when they changed from powered to unpowered. This commit
adds BlockRedstoneEvent calls for both Powered Rails and Activator Rails.
2014-04-18 10:29:07 -05:00
GJ
610c58c733 Add BlockPoweredRail.java from mc-dev for diff visibility. 2014-04-18 10:28:58 -05:00
GJ
730adbbf42 [Bleeding] Don't allow null display names. Fixes BUKKIT-5254
Currently, plugins can set a player's display name to null, which could
cause issues for other calls to getDisplayName that aren't expecting a null
value. This changes setDisplayName to follow the same logic as
setPlayerListName, which sets the player's name back to their unmodified
"vanilla" name if it receives a null value as a parameter.
2014-04-18 10:21:33 -05:00
GJ
2a2cdd4885 [Bleeding] Ice in the nether fades to air. Fixes BUKKIT-5373
Previously, whenever BlockFadeEvent was called for ice melting, it returned
the new BlockState with a type of Material.STATIONARY_WATER. However, in
the Nether, ice melting does not form water, but is simply replaced by air
instead. This changes the event to use the proper BlockState based on
whether the block is located in the Nether or not.
2014-04-18 10:18:52 -05:00
GJ
0a179711aa [Bleeding] Fix some inventories not using maxStack. Fixes BUKKIT-2883
CraftBukkit adds the ability to specify the maxStack size for most
inventories. However, some inventories were not overriding the getMaxStack
method properly, and so the functionality was unavailable. This fixes the
maxStack setting for Anvils, Minecarts, PlayerInventory, and Hoppers.
2014-04-18 10:11:23 -05:00
GJ
a4fe7cd3c4 [Bleeding] Return correct player SlotType. Fixes BUKKIT-3188
Previously, the SlotType for the last 4 slots in a player's inventory
returned QUICKBAR when it should have returned SlotType.CONTAINER. This
updates the code for determining slot type to return the proper value.
2014-04-18 10:01:31 -05:00
GJ
9c251595d4 [Bleeding] Return correct furnace SlotType. Fixes BUKKIT-5400
Previously, the SlotType for the 0 slot in a furnace returned CONTAINER,
when it should have returned SlotType.CRAFTING. This updates the code for
determining slot type to return the proper value.
2014-04-18 10:01:24 -05:00
GJ
ec41228fb5 [Bleeding] Ensure skeletons spawn with equipment. Fixes BUKKIT-2836
Previously, when a skeleton was spawned via the spawn(...) function, the
resulting skeleton had no equipped bow and therefore could not properly
attack. This fix gives all skeletons the proper equipment and ensures that
they are able to attack.
2014-04-18 09:52:04 -05:00
GJ
81e560621f [Bleeding] Add all blocks needed to PortalCreateEvent. Fixes BUKKIT-5464
Due to changes in how portals were created in Minecraft 1.7, the code that
was previously used to find the blocks involved in the PortalCreateEvent
no longer detected all blocks. Additionally, in the process of updating to
1.7.2, a missed diff resulted in some blocks that were found not being
properly added to the blocklist. This commit corrects that missed diff,
while also adding a check to ensure that the top and bottom of the portal
frame are included in the blocklist.
2014-04-18 09:42:02 -05:00
GJ
729df1a734 [Bleeding] Add many missing SpawnReasons.
Adds BUKKIT-5370, BUKKIT-5377, BUKKIT-5378, BUKKIT-5379, BUKKIT-5380,
BUKKIT-5381, BUKKIT-5382. Adds reasons for zombies infecting villagers and
zombie villagers being cured. Readds reason for a skeleton being spawned as
a spider jockey. Adds reason to distinguish ocelot babies from the parent
they spawned with. Adds reasons for chunk generation causing the ender
dragon, villagers, and witches to spawn. And finally, adds a reason for
spawning a chicken mount for a baby zombie.
2014-04-18 09:34:08 -05:00
GJ
b6831792ec Add files from mc-dev for diff visibility. 2014-04-18 09:28:18 -05:00
GJ
d4fe10394a [Bleeding] Add many missing event calls. 2014-04-18 09:01:11 -05:00
GJ
286c71329d Add BlockTallPlant.java from mc-dev for diff visibility. 2014-04-18 09:01:04 -05:00
GJ
eb43d0637c [Bleeding] Add missing HangingBreakEvent. Fixes BUKKIT-3943
The old PaintingBreakByEntityEvent was deprecated and replaced by
HangingBreakByEntityEvent. However, in the case of being struck by
lightning, only the deprecated event was being called. This fixes that so
that both the new and old events are called appropriately.
2014-04-18 08:45:35 -05:00
Travis Watkins
a81f26716d Handle profiles in SkullMeta, they don't store a string anymore. 2014-04-17 14:09:53 -05:00
Nate Mortensen
7e54acc8bd Update CraftBukkit to Minecraft 1.7.9 2014-04-17 13:44:03 -05:00
Travis Watkins
98555224aa Handle expired bans correctly. Fixes BUKKIT-5541 2014-04-17 11:03:51 -05:00
Travis Watkins
3e911dba54 Make bans pretend to use names like before 1.7.8.
Bans require a name and UUID but our API only allows for a single string
identifier for a ban entry. Until this is sorted out go back to the old
name based setup since we can always get a UUID given a name.
2014-04-17 10:45:10 -05:00
Travis Watkins
a8d5c1224f Make skulls pretend to only use names like before 1.7.8.
Any new API here needs more thought, skulls require a name but OfflinePlayer
is not guaranteed to have one. There is a Mojang approved way to get a
complete profile from a name but not from a UUID so for now just pretend
this still only uses names.
2014-04-17 08:41:29 -05:00
Travis Watkins
6ad36f09e5 Fix getting white list, ban list, and op list. Fixes BUKKIT-5538
The getEntries methods on these return player names instead of UUIDs.
As we need the UUIDs for our API we add a getValues method to get at
the data we need. To further ensure we get the most data possible we
also add a way to get at the stored GameProfile to ensure we always
have both the UUID and the name from the list.
2014-04-17 03:31:49 -05:00
Travis Watkins
5cbbcae9a9 Import files from mc-dev for diff visibility 2014-04-17 03:17:55 -05:00
t00thpick1
dc194a97bb [Bleeding] Re-add missed diff in 1.7.5 update. Fixes BUKKIT-5536
In the 1.7.5 update the diff that called book edit events when editing
books was accidentally dropped because of nms changes within the file.
This commit re-adds the craftbukkit call to restore event behavior.
2014-04-17 02:17:25 -05:00
Travis Watkins
fc39b27d7c Don't do a lookup for obviously invalid usernames 2014-04-17 01:57:35 -05:00
Travis Watkins
5557856144 Add methods to use arbitrary entries in scoreboards. Adds BUKKIT-3977 2014-04-13 23:21:36 -05:00
Travis Watkins
3dcf159ec1 Fix missed diff and other small things 2014-04-13 04:29:21 -05:00
Travis Watkins
d82e34da59 Use world-container when finding players to convert. Fixes BUKKIT-5530 2014-04-13 00:13:42 -05:00
Travis Watkins
b689cfa83a Check actual whitelist for CraftOfflinePlayer too 2014-04-12 07:45:32 -05:00
Travis Watkins
f6a93775bf Check the actual whitelist for Player#isWhitelisted()
The server's check is for whether or not a player can pass the whitelist
not just if the player is on it. That seems like more useful information
but the API has always just checked if they are on it so this commit
restores that.
2014-04-12 07:21:01 -05:00
Travis Watkins
7b409ed4e9 Use fetched GameProfile for getOfflinePlayer(String)
When getting an OfflinePlayer by name we lookup their UUID and then
use that to fetch the OfflinePlayer. If the player has not played on
this server before the resulting OfflinePlayer will return null for
getName(). As this is unintuitive we now create the OfflinePlayer directly
using the profile we looked up and make OfflinePlayer prefer that data.
2014-04-12 03:12:26 -05:00
Travis Watkins
8f771c7378 Update CraftBukkit to Minecraft 1.7.8 2014-04-11 22:28:35 -05:00
Patrick Seidel
0df7555cec Add method to send fake sign updates to players. Adds BUKKIT-2300 2014-04-02 18:05:03 -05:00
BlackHole
903575ff2e Add player unique ID to (Async)PlayerPreLoginEvent. Adds BUKKIT-5108 2014-04-02 17:28:18 -05:00
Jeremy Wood
8d77687e7a Add equals for CraftInventory objects. Adds BUKKIT-4110
When working with inventories you regularly end up with different
Inventory objects that have the same underlying Minecraft inventory.
Currently, even those these point to the same thing, they are not
considered equal. With this commit comparing any Inventory object that
represents the same inventory will result in equals(Object) returning
true.
2014-04-02 17:26:11 -05:00
feildmaster
434f15c847 Store last known player names in preparation for name changing 2014-03-31 14:42:33 -05:00
Travis Watkins
21e7ba8d22 Implement API for dealing with player UUIDs. Adds BUKKIT-5071 2014-03-29 16:50:17 -05:00
Travis Watkins
acc9f20b00 Fix issues with leashes and weather due to missed diff 2014-03-26 04:39:39 -05:00
Travis Watkins
4992df25ec Correct missed diff 2014-03-24 15:22:15 -05:00
Nate Mortensen
d51463d162 Fix PotionEffect removal.
The method in EntityLiving to remove a potion effect was remapped during
the 1.7.5 update.  The method invocation in CraftLivingEntity was not
updated to invoke the remapped method, which has led to a random method in
LivingEntity being called in its place.

This commit corrects the behavior of removePotionEffect by changing the
method to invoke the remapped method as opposed to EntityLiving#m(float).

Thanks to @gabizou for finding this issue.
2014-03-23 21:25:14 -06:00
Travis Watkins
58267995eb Fix missed diff making horses lose their saddle 2014-03-22 22:52:03 -05:00
Travis Watkins
019a33f50d Fix teleport failing right after join. Fixes BUKKIT-5479
Teleporting a player checks to see if the player is disconnected to
try to avoid creating ghost players. The check it uses, however, randomly
fails when the player is in the middle of joining the server. The check
that would work correctly here does not work correctly when the player
actually disconnects. To work around this we add a new flag which is
cleared on the first tick of the new player and assume they are connected
if the flag is set.
2014-03-22 19:39:03 -05:00
WolfieMario
4873b12890 Increment loop index whether or not command succeeded. Fixes BUKKIT-5455
When VanillaCommandWrapper dispatches a command containing a
PlayerSelector wtih c>-1 (implicitly true for @a), it loops over the
selected players and exectures the command with each player. However, the
loop index is only incremented if the command fails. As a result, a
successful command is repeated on the same player indefinitely, locking up
the server. This commit fixes the issue by incrementing the loop index
regardless of whether the command succeeds, ensuring the command is only
executed once per player identified by the PlayerSelector.
2014-03-22 13:55:20 -06:00
Nate Mortensen
385ace970e Update CraftBukkit to Minecraft 1.7.5 2014-03-21 23:56:34 -04:00
Travis Watkins
afb3511a4a Remove chunks from queue if we don't need them anymore. 2014-02-12 02:05:12 -05:00
EvilSeph
d9e04a5b24 Check if entity is in list before decrementing. Fixes BUKKIT-5404 2014-02-11 14:55:59 -05:00
EvilSeph
00b3721f07 Update/improve configuration documentation. 2014-02-11 00:49:07 -05:00
EvilSeph
9131f5b550 Ignore player selectors if not a Command Block. 2014-02-11 00:49:07 -05:00
EvilSeph
776e256ff1 Add PlayerSelector.java for diff visibility. 2014-02-11 00:49:06 -05:00
EvilSeph
8234570795 Rename Minecraft command permission nodes to meet fallback spec. 2014-02-11 00:48:39 -05:00
Travis Watkins
533c48996b Hide message from connection throttle on startup. Fixes BUKKIT-5403 2014-02-10 16:23:42 -06:00
Travis Watkins
393ece9ec5 Readd diff missed in the 1.7 update. 2014-02-10 15:43:56 -06:00
Travis Watkins
826643c606 Handle removing entity while ticking. Fixes BUKKIT-1331
If a plugin causes an entity to be removed from the world while the
world is ticking entities the ticking loop gets out of sync and fails due
to trying to go beyond the end of the entity array. To ensure this doesn't
happen we store the loop position as a field so we can fix it up in the
entity remove method just like the tick method does when it removes an
entity.
2014-02-10 15:43:49 -06:00
Wesley Wolfe
1113d54dae Add method to forget callbacks in AsynchronousExecutor 2014-02-10 09:33:20 -06:00
Aikar
ce4b13c1a5 Readd BlockPlaceEvent for half slab to full block. Fixes BUKKIT-5390 2014-02-09 02:40:43 -06:00
Travis Watkins
219f4e2c25 Match old alias behavior when migrating.
Previously the alias system would pass all arguments from the alias
to its command(s) implicitly. The new system requires arguments to be
explicitly passed so server owners can have more control over where and
how they are passed. To ensure this isn't a breaking change during the
migration from bukkit.yml to commands.yml we now add the $1- argument
to the alias commands to match the previous behavior.
2014-02-08 15:02:44 -06:00
t00thpick1
553acdf0cd [Bleeding] Implement Mojang command fallback system. Adds BUKKIT-5385 2014-02-08 03:17:14 -06:00
mbax
b18bedd848 Implement banning API. Adds BUKKIT-3535
Previously no implementation existed to access various additional
information fields regarding bans. This implementation expands on the
information outlined in the sister Bukkit commit to provide access to
the Minecraft implementation of the ban system.

This implementation of the banning API contains 2 new classes which
provide access to the internal workings of the built-in banning
system within Minecraft.

The CraftBanEntry class simply supports the representation of an internal
Minecraft BanEntry object. The data that may be modified within this new
object must be manually saved to the list contained within the
CraftBanEntry using it's save() method.

The CraftBanList class supports the representation of an internal
Minecraft BanList object through proxy methods. These methods do
validation on the passed objects where needed to ensure safe input to the
backed Minecraft objects.

These changes additionally re-route the existing banning API to the newer,
more detailed, system. Functionality prior to this change still behaves
as documented by the contract defined by the methods changed.
2014-02-08 00:03:14 -07:00
t00thpick1
66471a5326 [Bleeding] Correctly enchant books. Fixes BUKKIT-5302
Books can now recieve more than one enchantment.  As such, breaking out of
the loop after only 1 enchantment is applied is not the correct behavior.

This commit also reworks some of the logic surrounding the application of
enchantments to the item. By checking if the event doesn't add any
enchantments rather than if the original enchantments list is empty, the
application code is only reached if enchantments are applied, rendering
the "applied" boolean no longer necessary. The ItemStack's Item should only
be set once, so it is now set outside of the loop based upon whether or not
"flag" is true (with "flag" being whether or not the ItemStack's Item is a
book).
2014-02-06 16:49:10 -07:00
EdGruberman
068d8a807b Update clients when ItemFrame direction is set. Fixes BUKKIT-3371
Hanging entities are placed into the entity tracker and updates are sent
out to clients for the initial placement. Thereafter data watchers are
configured to monitor the item inside the frame. However, if the
direction the ItemFrame facing changes the entity tracker will not send
out updates.

This commit removes and recreates the ItemFrame entity in the same way
that was already done for Painting entities. This causes clients to
be updated appropriately.
2014-02-02 00:37:59 -07:00
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
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
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
t00thpick1
0e809d8318 [Bleeding] Fix incorrect Cocoa Bean orientation. Addresses BUKKIT-5182
When ItemDye is used to place a Cocoa Block, the postPlace() method
should not be called, as data is handled within the ItemDye class.
However, if Cocoa is placed via its block item, postPlace() should
still be called to mirror vanilla behavior.
2013-12-17 16:49:38 -06:00
BlackHole
9a6d035998 Add missed tree types for Minecraft 1.7. Adds BUKKIT-5042
This commit adds support for the Tree Types that weren't added in the
initial update to Minecraft 1.7.

Pulled from PR #1277
2013-12-16 19:47:49 -07:00
BlackHole
2191599f4b Fix generation of jungle trees. Fixes BUKKIT-5043
Due to changes in the generation of trees, the name of the class responsible
for the generation of jungle trees has changed from WorldGenMegaTree to
WorldGenJungleTree.  As such, references to WorldGenMegaTree need to be
updated to WorldGenJungleTree to generate the correct type of tree.

Pulled from PR #1277
2013-12-16 19:44:03 -07:00
GJ
cee6a7bab5 [Bleeding] Correct naming of sounds for 1.7. Fixes BUKKIT-5065
Several sounds were renamed in Minecraft 1.7, and have been updated
accordingly. Additionally, two sounds, HURT and BREATH, were removed from
Minecraft.
2013-12-16 19:32:29 -07:00
Travis Watkins
24ff27b408 Don't try to teleport to a null world. Fixes BUKKIT-5145 2013-12-14 17:23:34 -06:00
t00thpick1
a565486ee1 [Bleeding] Return correct drops for Cocoa blocks. Fixes BUKKIT-5159
For Cocoa Blocks, Block.getDropType() returns the item form of the Cocoa
block, rather than the Cocoa Bean item. Because of this, Cocoa blocks need
to have explicit handling in order to return the proper drop contents.
2013-12-13 22:42:39 -07:00
GJ
1ff8132bdd [Bleeding] Fix witches dropping empty ItemStacks on death. Fixes BUKKIT-3554 2013-12-13 22:21:12 -07:00