Commit graph

2277 commits

Author SHA1 Message Date
Wesley Wolfe
7939572c33 Check connection status before setting scoreboard. Fixes BUKKIT-4064
Two connection status checks were added to setting a scoreboard for a
player. The first checks to see if a player has logged in yet, which
implicates the ability to receive packets. The second checks to affirm
that the CraftPlayer reference is still to a logged in player; setting
it while not logged in would maintain a stale player reference in the
scoreboard manager.
2013-04-12 21:31:24 -05:00
Wesley Wolfe
3e0d8331be Change perspective of team checking. Fixes BUKKIT-4044
The method's return value was being incorrectly calculated from the
perspective of this.canHurt(that), where it's actually used from the
this.canBeHurtBy(that) perspective.
2013-04-11 23:22:41 -05:00
Wesley Wolfe
ac593849ae Use correct method for getting player's team. Fixes BUKKIT-4050
The method getTeam gets the team from name of, as opposed to getting the
team a player belongs to.

This also addresses BUKKIT-4002 and partially BUKKIT-4044
2013-04-11 23:03:37 -05:00
feildmaster
77d1524b3d Refactor EntityDamageEvents. Adds BUKKIT-1944 & BUKKIT-3684 2013-04-10 21:33:33 -05:00
Wesley Wolfe
535a85a5b0 Make auxiliary worlds use the main scoreboard. Addresses BUKKIT-3984
When a world is created using our API, it does not use secondary world
server and will maintain a reference to its own scoreboard. In vanilla,
this is not an issue as there is only ever one world.

Similarly to maps, an overwrite to the scoreboard reference has been
added for when another world has been created.

This should also address BUKKIT-3982 and BUKKIT-3985
2013-04-04 23:35:16 -05:00
Travis Watkins
2a5e90fb8b Handle large chests correctly for hopper events. Fixes BUKKIT-3979
In commit 7710efc5f9 we corrected the handling of large chests as the
destination for hoppers moving items but did not apply the same fix for
large chests being the source or for droppers. This commit updates these
to have the same fix.
2013-04-04 12:59:47 -05:00
Wesley Wolfe
055c13461d We compile for 1.5 2013-04-04 01:22:50 -05:00
mbax
d95a4705cb Implement Scoreboard API. Adds BUKKIT-3776
This implementation facilitates the correspondence of the Bukkit Scoreboard
API to the internal minecraft implementation.

When the first scoreboard is loaded, the scoreboard manager will be created.
It uses the newly added WeakCollection for handling plugin scoreboard
references to update the respective objectives. When a scoreboard contains no
more active references, it should be garbage collected.

An active reference can be held by a still registered objective, team, and
transitively a score for a still registered objective. An internal reference
will also be kept if a player's specific scoreboard has been set, and will
remain persistent until that player logs out.

A player's specific scoreboard becomes the scoreboard used when determining
team structure for the player's attacking damage and the player's vision.
2013-04-04 01:13:21 -05:00
Wesley Wolfe
5634d9f701 Add a WeakCollection utility class.
This class is designed to be an invisible layer between a normal collection,
and one that silently loses entries because they are only weakly referencable.
Some operations have additional overhead to be semantically correct, but it
maintains the equals contract for all entries, as opposed to identity.

It does not support the equals or hash code method as it cannot easily have
the transitive and commutative properties.
2013-04-04 01:05:47 -05:00
mbax
3f637d1724 Add ScoreboardServer from mc-dev for diff visibility 2013-04-04 01:05:03 -05:00
EvilSeph
0c6b9bba15 Updated version to 1.5.1-R0.2-SNAPSHOT for development towards next release. 2013-04-04 00:18:59 -04:00
EvilSeph
e5ebb143d2 Updated version to 1.5.1-R0.1 in pom.xml for BETA. 2013-04-03 22:40:36 -04:00
gjmcferrin@gmail.com
5ede9ce5f7 Add missing calls to BlockRedstoneEvent. Adds BUKKIT-3926
This adds calls to BlockRedstoneEvent for the new daylight sensor and
trapped chest blocks. Note that the redstone level for trapped chests
cannot be modified, as it is based on the number of players currently
viewing the chest's inventory.
2013-04-03 02:48:58 -05:00
gjmcferrin@gmail.com
1d6ff3461d Add BlockDaylightDetector from mc-dev for diff visibility 2013-04-03 02:48:47 -05:00
h31ix
743d0fb603 Properly return contents of Inventory. Fixes BUKKIT-3930
When an array of an inventory's contents is requested, we loop through the contents of the NMS inventory's ItemStacks in order to return Bukkit ItemStacks that can be used through the API. However, the NMS ItemStack can, in some cases, be larger than the physical size of the inventory. Using the size of the NMS array as a limit on the loop that follows can result in an ArrayIndexOutOfBoundsException because the Bukkit array's length is the actual size of the inventory, and thus will be smaller.

With this commit we use the smaller of the two arrays' length as the limit in the loop, thus eliminating the possibility that the smaller array will be asked for an index higher than its length.
2013-04-02 16:10:04 -05:00
Travis Watkins
c33908509a Set world on fixed tile entity to avoid NPE. Addresses BUKKIT-3949 2013-04-01 00:06:09 -05:00
Travis Watkins
311f0c86a4 Fix mismatched tile entities for new blocks. Fixes BUKKIT-3949 2013-03-31 19:38:25 -05:00
Travis Watkins
71a475f076 Don't update physics when block place is cancelled. Fixes BUKKIT-3939
When a block placement happens we currently update physics on the
attempted placement and update again if the placement is cancelled.
To correct the first one we simply set the block without applying
physics. To correct the second we have to add a new method to
BlockState that lets us update without applying physics and use
this method method when putting the block back.
2013-03-31 19:18:42 -05:00
Travis Watkins
d3dbb1bb50 Correct slot types for brewing stand. Fixes BUKKIT-3937 2013-03-31 18:41:36 -05:00
Wesley Wolfe
f859d45727 Throw exception for disabled plugin tasks. Fixes BUKKIT-3951
Without this check, any non-null reference to a plugin is considered
'valid' for registering a task in the scheduler. This is obviously
unintentional behavior and has been changed to throw an
IllegalPluginAccessException. It is now consistent with the
SimplePluginManager event registration contract.

This in affect also addresses BUKKIT-3950 for uninitialized plugin
references (ones without a description).
2013-03-31 15:37:17 -05:00
Travis Watkins
af964c8331 Limit hopper to valid directions. Fixes BUKKIT-3940 2013-03-31 13:29:13 -05:00
Travis Watkins
06ebe6b705 Add BlockHopper from mc-dev for diff visibility. 2013-03-31 13:20:30 -05:00
Travis Watkins
a1c38cd8f3 Include anvil result in inventory size. Fixes BUKKIT-3741 2013-03-30 02:51:26 -05:00
Travis Watkins
af7ea28bc7 Only call event when turning pressure plate on. Fixes BUKKIT-3881 2013-03-29 22:48:49 -05:00
Travis Watkins
82e05d435b Special case large chests for hopper events. Fixes BUKKIT-3916
Large chests work in a different fashion as they are a combination of
two other inventories. This causes their getOwner method to always return
null as their is no correct return. To compensate for this for the hopper
events we special case them to use their CraftBukkit counterpart that has
the information we need for the event.
2013-03-29 22:27:07 -05:00
Travis Watkins
ee572114dd Add Beacon block state for hopper events. Fixes BUKKIT-3932 2013-03-29 22:26:27 -05:00
EdGruberman
377be0a79e Call PotionSplashEvent even for no effects. Fixes BUKKIT-3618
When a splash potion has no applicable effects we currently do not call
PotionSplashEvent. This means plugins are unable to make custom
potions with reliable splash handling as they have to relicate the
functionality themselves.

With this commit we simply make the event fire regardless of the effects
on the potion.
2013-03-28 21:14:48 -05:00
gjmcferrin@gmail.com
adbee6049e Call appropriate event for zombies igniting players. Adds BUKKIT-3915 2013-03-28 21:10:42 -05:00
Wesley Wolfe
acd637d48b Properly copy collection references in ItemMeta.clone(). Fixes BUKKIT-3913
When cloning an item, all references are copied to the new item. For
collections, this makes internal changes become visible in both the old and
new items.

In CraftMetaItem, clone was not making copies of the appropriate collections
and has been fixed for non-null values.

In CraftMetaEnchantedBook and CraftMetaPotion, clone was using possible empty
collection references and has been changed to explicitly null-check instead.
2013-03-28 20:01:01 -05:00
Travis Watkins
1a7e5a75ae Correct missed diff on skeletons. Fixes BUKKIT-3912 2013-03-28 19:42:27 -05:00
Andre LeBlanc
08f3df82eb Improve calling of ProjectileHitEvent. Fixes BUKKIT-3872 2013-03-26 07:13:14 -04:00
riking
45d3e2514d Add missing semicolon
I should try to compile before I say "this change is okay".
I should try to compile before I say "this change is okay".
I should try to compile before I say "this change is okay".
I should try to compile before I say "this change is okay".
for i in range(100)
2013-03-25 17:12:22 -07:00
Kristofer Henriksson
3c02fb02a1 Allow plugins to enchant already enchanted items. Fixes BUKKIT-1956
This causes the server to generate PrepareItemEnchantEvent even in the
case that an item is already enchanted or otherwise would normally not
be enchantable.
2013-03-25 15:56:15 -07:00
Black-Hole
02a5d09ddf Call EntityChangeBlockEvent when boats destroy blocks. Fixes BUKKIT-3871 2013-03-25 16:55:48 -04:00
Andre LeBlanc
18d7bc7ca3 Allow fishing success rate to be adjustable. Adds BUKKIT-3837 2013-03-25 14:45:24 -04:00
GJ
96ba65d506 Add methods to check conflicting enchantments. Adds BUKKIT-3830 2013-03-25 10:51:54 -04:00
Travis Watkins
5f089137ee Cleanup comments, formatting, etc 2013-03-25 00:51:36 -05:00
Patrick Seidel
7c40a073d8 Add ability to change player item in hand. Adds BUKKIT-3318 2013-03-24 14:04:27 -04:00
Travis Watkins
b532042973 Don't assume all hoppers are blocks. Fixes BUKKIT-3883 2013-03-24 12:38:57 -05:00
riking
8d3ba07f93 Add check for Thorns damage - Fixes BUKKIT-3505 2013-03-23 19:45:46 -07:00
Carlos Cobo
62c6d223e4 Include ThrownPotion in spawn methods. Adds BUKKIT-2542 2013-03-23 19:05:14 -07:00
EdGruberman
e1b50b0110 Identify outside slot independent of inventory type. Fixes BUKKIT-2768 2013-03-23 16:23:03 -07:00
Dennis Bliefernicht
e61a6bab05 Implement InventoryMoveItemEvent. Adds BUKKIT-3765
This makes droppers, hoppers and hopper minecarts fire an
InventoryMoveItemEvent whenever an item is being moved from or to another
inventory.
2013-03-23 16:12:52 -06:00
me4502
b10474253c Fire VehicleEnterEvent for loaded chunks only. Fixes BUKKIT-3831 2013-03-23 10:58:01 -06:00
James Clarke
3ad423af07 ANSI color codes now reset text attributes. Fixes BUKKIT-3508
The client resets all formatting after a color code is received, but currently the ANSI codes do not, and so the console does not accurately reflect the appearance of the formatted text. Instead, the ANSI color codes are now set to reset all text attributes.
2013-03-23 00:26:22 -04:00
Travis Watkins
444ced306a Cleanup and rework physical interaction events. Fixes BUKKIT-3686
Currently when dealing with physical interactions with pressure plates
and tripwires we immediately block their activation as soon as a single
entity involved has their event cancelled. We also fire events whenever
an entity intersects the block a wooden button is in even if they aren't
actually pressing it. To correct this we move the button interaction to
the correct place and modify all three to only block the activation if
every entity is blocked from using them instead of just one of them.
2013-03-22 17:18:19 -05:00
Xephi
ae19f2c46f Implement Dropper interface. Adds BUKKIT-3750 2013-03-21 22:33:16 -06:00
Xephi
978de7e9da Add BlockDropper for diff visibility 2013-03-21 21:42:47 -06:00
Travis Watkins
6f9e4f8541 Stationary lava is also a LAVA ignition cause. 2013-03-21 16:59:45 -05:00
Olof Larsson
abee107830 Add ability to modify ThrownPotion properties. Adds BUKKIT-3197 2013-03-21 15:18:27 -04:00