summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeLines
* Don't apply fall damage when cancelled. Fixes BUKKIT-4065Travis Watkins2013-04-13-5/+7
|
* Add delay to hopper even if it doesn't do anything. Fixes BUKKIT-4061Travis Watkins2013-04-13-1/+4
| | | | | | | | If a hopper is unable to perform any action during a tick it attempts to do so every tick from then on. Once it is able to do so it then sets a delay before attempting to do something again. To avoid excessive CPU usage for hoppers sitting idle we now apply this delay regardless of the success of the action.
* Perform anvil calculations when using 1.5 drop feature.riking2013-04-13-1/+1
| | | | | | When using the new feature in 1.5 to drop the item in any highlighted slot, the anvil result slot does not apply the full anvil calculation that picking up the item does, including the experience calculation.
* Use wall time instead of ticks for several things. Fixes BUKKIT-4059Travis Watkins2013-04-13-17/+37
| | | | | | | | | | | | | | | | | | | | | | | | Currently furnace smelting and the item pickup delay timer use wall time (aka actual time passed) to emulate a constant tick rate so run at the same speed regardless of the server's actual tick rate. There are several other places this makes sense so this commit converts them. The item despawn timer is converted so now always takes 5 minutes. Users know this 5 minute number well so keeping this constant helps to avoid confusion. This also helps alleviate lag because if a large number of item drops is the reason your server is running slowly having them stay around longer just means your server is slow longer. Potion brewing and the zombie villager conversion timer are now constant. These match the furnace criteria of being useful for hiding lag and not having a detrimental effect on gameplay. Potion effects are now also using wall time. The client is told about effect times in ticks and displays this information to the user as minutes and seconds assuming a solid 20 ticks per second. The server does have code for updating the client with the current time remaining to help avoid skew due to differing tick rates but making this a constant makes sense due to this display.
* Add MobEffect from mc-dev for diff visibilityTravis Watkins2013-04-13-0/+143
|
* Various minor performance improvementsTravis Watkins2013-04-13-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a check to avoid doing movement work if an entity doesn't move. This usually will not ever happen in the current server but is useful when it does and will be more useful in the future. Only process mob on mob (non-player) collisions every other tick. Players tend to pack a lot of mobs into a small space (sheep farm, mob grinder, etc) so they do a lot of work processing collisions. To help alleviate some of this we only run these calculations every other tick. This has no visible effect on the client but can be a huge win on the server depending on circumstances. Use generic entity inWater checking for squids. Squids have their own logic currently for determining if they are in water. This check is almost identical to the generic entity checking which is run anyway. To avoid doing duplicate work we just remove the squid version. This does not have any noticeable effect on gameplay since the checks are so similar. Use HashSet for tile entities instead of ArrayList. Using an ArrayList for storing tile entities in a world means we have very expensive inserts and removes that aren't at the end of the array due to the array copy this causes. This is most noticeable during chunk unload when a large number of tile entities are removed from the world at once. Using a HashSet here uses a little more memory but is O(1) for all operations so removes this bottleneck.
* Correct vehicle movement issues. Fixes BUKKIT-2993, BUKKIT-4056Travis Watkins2013-04-13-4/+8
| | | | | | | | | | | | | | When a player comes into range of an entity in a vehicle they will often be sent the spawn packet for the rider before receiving one for the vehicle. This causes the attachment packet to fail client side because it attempts to attach the rider to a vehicle that doesn't exist on the client. To correct this we account for both possible orderings and send the attachment packet appropriately. Vanilla also sends an new attach packet every 60 ticks even if the vehicle has not changed. As this packet is a toggle this resulting in players teleporting around randomly. Since we handle attachments properly now we simply revert this section to use the 1.4 logic.
* Fetch tile entities from chunks instead of world. Fixes BUKKIT-4055Travis Watkins2013-04-13-9/+19
| | | | | | | | | | | | | When looking up tile entities for a chunk to send to a player we currently loop through every tile entity in the world checking if it is within the bounds of the relevant chunk. Instead of doing this we can just use the tile entities list stored in the chunk to avoid this costly searching. As a further optimization, we also modify the generic range-based lookup to use chunks as well. For most lookups this will give a smaller search pool which will result in faster lookups. Thanks to @mikeprimm for the idea and most of the implementation.
* Boats can only die once.Travis Watkins2013-04-13-1/+1
| | | | | | In certain scenarios a boat can be killed multiple ways in a single tick. Due to improper guards this can cause the death code to run multiple times creating item drops. To correct this we insert the appropriate death check.
* Check connection status before setting scoreboard. Fixes BUKKIT-4064Wesley Wolfe2013-04-12-0/+8
| | | | | | | | | 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.
* Change perspective of team checking. Fixes BUKKIT-4044Wesley Wolfe2013-04-11-9/+10
| | | | | | 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.
* Use correct method for getting player's team. Fixes BUKKIT-4050Wesley Wolfe2013-04-11-1/+1
| | | | | | | 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
* Refactor EntityDamageEvents. Adds BUKKIT-1944 & BUKKIT-3684feildmaster2013-04-10-155/+116
|
* Make auxiliary worlds use the main scoreboard. Addresses BUKKIT-3984Wesley Wolfe2013-04-04-2/+3
| | | | | | | | | | | 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
* Handle large chests correctly for hopper events. Fixes BUKKIT-3979Travis Watkins2013-04-04-2/+16
| | | | | | | 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.
* We compile for 1.5Wesley Wolfe2013-04-04-3/+0
|
* Implement Scoreboard API. Adds BUKKIT-3776mbax2013-04-04-32/+756
| | | | | | | | | | | | | | | | | | 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.
* Add a WeakCollection utility class.Wesley Wolfe2013-04-04-0/+173
| | | | | | | | | | 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.
* Add ScoreboardServer from mc-dev for diff visibilitymbax2013-04-04-0/+204
|
* Add missing calls to BlockRedstoneEvent. Adds BUKKIT-3926gjmcferrin@gmail.com2013-04-03-0/+27
| | | | | | | 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.
* Add BlockDaylightDetector from mc-dev for diff visibilitygjmcferrin@gmail.com2013-04-03-0/+71
|
* Properly return contents of Inventory. Fixes BUKKIT-3930h31ix2013-04-02-1/+2
| | | | | | 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.
* Set world on fixed tile entity to avoid NPE. Addresses BUKKIT-3949Travis Watkins2013-04-01-0/+1
|
* Fix mismatched tile entities for new blocks. Fixes BUKKIT-3949Travis Watkins2013-03-31-0/+16
|
* Don't update physics when block place is cancelled. Fixes BUKKIT-3939Travis Watkins2013-03-31-25/+29
| | | | | | | | | 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.
* Correct slot types for brewing stand. Fixes BUKKIT-3937Travis Watkins2013-03-31-1/+1
|
* Throw exception for disabled plugin tasks. Fixes BUKKIT-3951Wesley Wolfe2013-03-31-0/+4
| | | | | | | | | | | 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).
* Limit hopper to valid directions. Fixes BUKKIT-3940Travis Watkins2013-03-31-1/+1
|
* Add BlockHopper from mc-dev for diff visibility.Travis Watkins2013-03-31-0/+166
|
* Include anvil result in inventory size. Fixes BUKKIT-3741Travis Watkins2013-03-30-3/+19
|
* Only call event when turning pressure plate on. Fixes BUKKIT-3881Travis Watkins2013-03-29-15/+17
|
* Special case large chests for hopper events. Fixes BUKKIT-3916Travis Watkins2013-03-29-1/+8
| | | | | | | | 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.
* Add Beacon block state for hopper events. Fixes BUKKIT-3932Travis Watkins2013-03-29-1/+40
|
* Call PotionSplashEvent even for no effects. Fixes BUKKIT-3618EdGruberman2013-03-28-2/+2
| | | | | | | | | | 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.
* Call appropriate event for zombies igniting players. Adds BUKKIT-3915gjmcferrin@gmail.com2013-03-28-2/+12
|
* Properly copy collection references in ItemMeta.clone(). Fixes BUKKIT-3913Wesley Wolfe2013-03-28-5/+12
| | | | | | | | | | | | 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.
* Correct missed diff on skeletons. Fixes BUKKIT-3912Travis Watkins2013-03-28-1/+1
|
* Improve calling of ProjectileHitEvent. Fixes BUKKIT-3872Andre LeBlanc2013-03-26-15/+10
|
* Add missing semicolonriking2013-03-25-1/+1
| | | | | | | | 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)
* Allow plugins to enchant already enchanted items. Fixes BUKKIT-1956Kristofer Henriksson2013-03-25-1/+2
| | | | | | This causes the server to generate PrepareItemEnchantEvent even in the case that an item is already enchanted or otherwise would normally not be enchantable.
* Call EntityChangeBlockEvent when boats destroy blocks. Fixes BUKKIT-3871Black-Hole2013-03-25-0/+13
|
* Allow fishing success rate to be adjustable. Adds BUKKIT-3837Andre LeBlanc2013-03-25-7/+22
|
* Add methods to check conflicting enchantments. Adds BUKKIT-3830GJ2013-03-25-0/+69
|
* Cleanup comments, formatting, etcTravis Watkins2013-03-25-471/+421
|
* Add ability to change player item in hand. Adds BUKKIT-3318Patrick Seidel2013-03-24-0/+13
|
* Don't assume all hoppers are blocks. Fixes BUKKIT-3883Travis Watkins2013-03-24-1/+8
|
* Add check for Thorns damage - Fixes BUKKIT-3505riking2013-03-23-0/+2
|
* Include ThrownPotion in spawn methods. Adds BUKKIT-2542Carlos Cobo2013-03-23-0/+9
|
* Identify outside slot independent of inventory type. Fixes BUKKIT-2768EdGruberman2013-03-23-1/+1
|
* Implement InventoryMoveItemEvent. Adds BUKKIT-3765Dennis Bliefernicht2013-03-23-6/+58
| | | | | | This makes droppers, hoppers and hopper minecarts fire an InventoryMoveItemEvent whenever an item is being moved from or to another inventory.