Commit Graph

2595 Commits

Author SHA1 Message Date
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