Commit Graph

2977 Commits

Author SHA1 Message Date
Thinkofdeath
30d751b362 Move the entity slice loading 2015-03-16 19:44:51 +00:00
Thinkofdeath
7f609b12b9 SPIGOT-705: Fix possible CME 2015-03-15 21:38:05 +00:00
md_5
6e0120a058 SPIGOT-323: Enchanting tables can no longer be force opened. (reverted from commit bbe75338c1) 2015-03-13 17:53:15 +11:00
md_5
bbe75338c1 SPIGOT-323: Enchanting tables can no longer be force opened. 2015-03-13 17:48:57 +11:00
Thinkofdeath
2acb9e4ec3 SPIGOT-370: Remove LOCKED_CHEST
It doesn't exist anymore and has been deprecated for a year
2015-03-11 17:50:32 +00:00
Thinkofdeath
7f52bd6c95 Fix getActivePotionEffects ignoring the particles flag 2015-03-11 13:18:06 +00:00
Thinkofdeath
294d07dcc0 SPIGOT-678: Fix the particles flag being ignored in PotionMeta 2015-03-11 11:54:31 +00:00
Thinkofdeath
4e47c1c393 Add a unit test for map colors 2015-03-07 12:57:59 +00:00
Thinkofdeath
d8a9c7be42 Update to Minecraft 1.8.3 2015-03-04 09:48:58 +00:00
Thinkofdeath
3ee97a30eb SPIGOT-586: Fix a mistake in CraftMetaItem 2015-02-18 10:21:40 +00:00
md_5
726656b864 Fix hashcode / equals / formatting. 2015-02-15 12:54:18 +11:00
md_5
709f95833b API for setting/getting hideFlags. Implementation of the hideFlags to be saved in NBT. 2015-02-15 12:47:07 +11:00
FearThe1337
116514c162 Implement armor stand event. 2015-02-15 12:24:14 +11:00
BillyGalbreath
9648edfa61 Add alternatives for deprecated methods 2015-02-15 12:16:12 +11:00
Thinkofdeath
15e81cf551 SPIGOT-449: Fix the wrong caller being used in chain execute commands 2015-01-25 15:17:48 +00:00
Thinkofdeath
4b6df5adfe SPIGOT-456: Provide equals & hashCode methods for CraftObjective and CraftTeam 2015-01-25 14:39:20 +00:00
Thinkofdeath
df17927d45 Fix PerMaterialTest skipping useful tests for certain blocks 2015-01-25 12:04:21 +00:00
md_5
0d52f683db SPIGOT-469: Increment and print reload count. 2015-01-25 10:31:31 +11:00
BuildTools
17962f66ec SPIGOT-443: Synchronize access to HANDLED_TAGS as Spigot uses it async 2015-01-18 17:33:13 +00:00
Thinkofdeath
59dd2ddb9d SPIGOT-438: Correct CraftScoreboard.getObjective NPEing instead of returning null for missing objectives 2015-01-17 23:10:08 +00:00
md_5
00eba538b0 Fix mismatch between teams and player teams. 2015-01-17 19:59:16 +11:00
md_5
42ebec1f71 SPIGOT-242: Fix scoreboard API.
In particular don't maintain an internal list of state, as this gets out of whack when Minecraft adds or removes scoreboards / teams.
2015-01-17 09:41:52 +11:00
md_5
e6f9fd4dc7 isThundering should just reflect thunder state. 2015-01-13 20:42:33 +11:00
md_5
93e7b199bd Fix the CraftWorld weather methods duplicating events. 2015-01-13 20:40:23 +11:00
Hitoprl
5e6c347daa Fix SPIGOT-260: Item drops don't spill in correct place. 2015-01-11 09:46:54 +11:00
md_5
7658819130 Fix off by one in CraftRabbit. Fixes SPIGOT-392 2015-01-10 14:15:34 +11:00
md_5
4470462a54 SPIGOT-387: Remove redundant custom vehicle handling. 2015-01-09 16:59:40 +11:00
Thinkofdeath
5b92dc3d0a Whoops missed a file 2015-01-04 23:36:55 +00:00
Thinkofdeath
6ac32df219 Redirect execute through our command system and allow entities to be CommandSenders 2015-01-04 23:26:02 +00:00
md_5
dde25d45ef SPIGOT-323: Allow force creating enchant table containers. Usefullness is not guaranteed. 2015-01-05 10:05:01 +11:00
md_5
c99cdafd3f SPIGOT-323: Enchanting tables can no longer be force opened. (reverted from commit 9784338acf) 2015-01-05 10:00:26 +11:00
md_5
9784338acf SPIGOT-323: Enchanting tables can no longer be force opened. 2015-01-05 09:59:31 +11:00
md_5
e5c51c790f Actually return. 2015-01-05 09:25:27 +11:00
md_5
93efa5a803 "Fix" SPIGOT-349 - don't allow + or ! in path. 2015-01-05 09:24:44 +11:00
Xor Boole
e8e3ca29e2 Add null check before iterating over iterator. 2014-12-28 13:57:27 -04:00
Thinkofdeath
eae50b4f2a Remove DEBUG_ALL_BLOCK_STATES due to it being broken 2014-12-28 16:56:54 +00:00
Thinkofdeath
0a0d3aa5a7 SPIGOT-287: Fire a cancelled inventory open event for locked chests 2014-12-28 15:14:53 +00:00
Thinkofdeath
0e2396c22f Remove tile entity tags for signs and command blocks 2014-12-27 22:44:51 +00:00
Thinkofdeath
d51936efb4 SPIGOT-298: Fix book serialization 2014-12-27 12:13:28 +00:00
Thinkofdeath
306b233a40 SPIGOT-279: Fix all metadata being cleared for items that support blockEntityTag on material mis-match 2014-12-27 00:51:59 +00:00
Thinkofdeath
264d479fd8 SPIGOT-136, SPIGOT-267: Store pages as chat component to retain chat events unless a plugin touches them 2014-12-26 21:55:35 +00:00
FearThe137
2db3ea29a6 Implement Rabbit types. 2014-12-24 09:11:25 +11:00
md_5
6dfcbc61ab SPIGOT-204: Add way to set block type without using IDs or updating physics. 2014-12-22 19:48:02 +11:00
Thinkofdeath
40aaa31c49 Fix EntityEquipment for armor stands and redirect the getters/setters to use it 2014-12-21 23:26:42 +00:00
FearThe1337
53fc3cf74f Fix custom chunk generators. Fixes SPIGOT-193. 2014-12-21 17:38:42 +00:00
FearThe1337
89944c09c9 SPIGOT-231 and SPIGOT-229. Fix itemframe behaviour.
Confirmed fix for itemframes not showing up. Based on the code in
CraftPainting.
Besids this fix we now pass null itemstacks directly to the
EntityItemFrame to allow the removal of items in ItemFrames.
2014-12-21 09:59:45 +11:00
Fabian Faßbender
ce7dd34b5c aW() does re register Attributes which causes a IllegalArgumentException. This fixes it and sets the Guardian back to a normal Guardian without any problem. 2014-12-21 08:52:20 +11:00
Adam Thomas
606cf0eea4 Implement NameTag visibility API for Teams. 2014-12-18 21:27:46 +11:00
0x277F
dadb43af92 Use value from new potion effect particle visibility API. 2014-12-18 21:20:51 +11:00
FrozenBrain
618abf7a36 SPIGOT-228: Don't deserialize meta of written books twice 2014-12-18 09:47:10 +11:00
FearThe1337
6fab8fe51e SPIGOT-236 - fix notes playing wrongly.
Formula is from BlockNote (NMS), slightly formatted different to be smaller.
2014-12-18 09:47:10 +11:00
Thinkofdeath
20c65caae7 SPIGOT-210: Remove the exception when dropping a non-existant task
If the server crashes during chunk generation then the chunk would have never
been added to the executor, this caused a second exception to be thrown when
the server shutdown from the first exception
2014-12-16 10:53:29 +00:00
Thinkofdeath
6b061e2581 SPIGOT-152, SPIGOT-197: Add a system to handle new tags before an api is ready for them 2014-12-15 15:44:57 +00:00
Stefan
e1070b9fbb SPIGOT-206 Further checks and fixes for Hanging entities.
Adds an check for existing entities before selecting the location allowing
for hanging entities to be spawned in blocks where there already is an
hanging entity at the default rotation.
Fixes the CraftHanging setRotation function to use the new 1.8 logic.
2014-12-15 14:42:00 +00:00
Thinkofdeath
28f37a113c Fix entities freezing when a chunk is regenerated 2014-12-15 13:46:41 +00:00
TheCutter
07c2162118 Implement WorldBorder API 2014-12-14 10:02:33 +11:00
Stefan
01f0122a9e Fix the spawning of HangingEntities by picking the right direction
Related to SPIGOT-206.
Currently HangingEntities should be located next to the block they are
hanging on. With the direction set to the opposite of the block they
are hanging from.
This code is modified to find the correct direction.
2014-12-13 19:15:29 +01:00
Thinkofdeath
d5ede3bd6d Rework the vanilla link fix so that hover/click events aren't lost 2014-12-13 10:27:26 +00:00
Thinkofdeath
5f2a9eadde SPIGOT-199: Default to white instead of black for chat messages 2014-12-13 09:37:47 +00:00
Thinkofdeath
64157d1de5 SPIGOT-189: Remove ListenerWrapper in favour of just doing it in EntityPlayer 2014-12-12 19:27:37 +00:00
Thinkofdeath
54888dfafb Wrap player's ICommandListener so that our permission system can handle permission
for vanilla commands
2014-12-12 10:33:54 +00:00
Thinkofdeath
81db41b4d2 Ignore errors when parsing books and treat them as old books
In previous versions there was a mistake with book handled which
may leave books in a broken state, this tries to handle that
2014-12-12 09:46:31 +00:00
zreed
45be36a7b8 Update JLine
Later releases include the TerminalLineSettings patch. Also move call to AnsiConsole.systemInstall() to avoid patching AnsiWindowsTerminal.
2014-12-12 11:06:13 +11:00
FearThe1337
c13e6e69a2 Implement displayblocks for minecarts (SPIGOT-14). 2014-12-12 11:01:47 +11:00
TheCutter
fe8d20e376 using generator settings from WorldCreator to specify presets for FLAT or CUSTOMIZED world types 2014-12-12 11:00:41 +11:00
md_5
9fa497cd55 Add implementation of the elder Guardian API 2014-12-12 10:57:00 +11:00
Thinkofdeath
6575597292 Merge pull request #43 in SPIGOT/craftbukkit from ~FEARTHE1337/craftbukkit:perm to master
* commit '33af6fbbbf1c1a8fee3ecc8d4cf79b4a2ba17c16':
  Add the new minecraft command permission nodes.
2014-12-11 21:43:19 +01:00
FearThe1337
33af6fbbbf Add the new minecraft command permission nodes.
Previously bukkit ones were in bukkit. Moved to CraftBukkit with new prefixes.
2014-12-11 21:36:02 +01:00
Thinkofdeath
b13fd35165 Re-enable selectors for players and the console using vanilla commands 2014-12-11 20:05:48 +00:00
Thinkofdeath
84699b36a8 Rewrite book handling, Fixes SPIGOT-182 and part of SPIGOT-164 2014-12-11 19:38:09 +00:00
Thinkofdeath
14d69f1513 Remove old dev comments 2014-12-11 00:40:25 +00:00
Thinkofdeath
a6465002bf Add some missing Tile Entities 2014-12-07 13:38:16 +00:00
Thinkofdeath
44ea9d88c2 Add CraftMetaTileEntity, fixes the previously broken tests 2014-12-07 13:22:56 +00:00
Thinkofdeath
fb445e5337 Minor bug fixes 2014-12-07 12:18:50 +00:00
Thinkofdeath
c571bbe590 Disable some tests whilst issues with them are looked into 2014-12-07 11:50:45 +00:00
Thinkofdeath
6880e5277f Fix isEmpty and hashCode for CraftMetaItem 2014-12-07 11:42:37 +00:00
Thinkofdeath
6268eb5a3e Fix BlockEntityTag being stripped from items 2014-12-07 11:36:31 +00:00
Thinkofdeath
1227934d57 Make CraftMetaItem's attribute handling less strict on types 2014-12-07 10:48:14 +00:00
Thinkofdeath
cc2b09de09 Add basic support for executing commands from signs
TODO: Wrap the player in to allow for plugins to handle it better
2014-12-05 23:10:47 +00:00
zreed
9e04f2f765 Use PlayerList's UUID->EntityPlayer map in CraftServer.getPlayer(UUID) 2014-12-05 02:03:49 -05:00
Thinkofdeath
e2c4f20ed1 Serialize baseColor as a string 2014-12-04 10:10:24 +00:00
Thinkofdeath
2ba7357b4a Merge pull request #27 in SPIGOT/craftbukkit from ~AIKAR/craftbukkit:fixWorldSaveEvent to master
* commit '64492523a761fb37d2b73f4aad8b8041f7a30d83':
  Move WorldSaveEvent to proper location
2014-12-03 20:37:32 +01:00
Aikar
64492523a7 Move WorldSaveEvent to proper location
calling CraftWorld.save() currently does not call WorldSaveEvent, and WorldSaveEvent could fire on worlds that have saving disabled.

New location will always fire during a world save and only during an actual save.
2014-12-03 14:35:33 -05:00
Thinkofdeath
200ae2b6ac Fix a issue with skulls that have a blank owner 2014-12-03 19:04:19 +00:00
Thinkofdeath
4c02ffcaf3 Merge pull request #5 in SPIGOT/craftbukkit from ~DMCK2B/craftbukkit:feature/implementDepthStrider to master
* commit 'cce45591f624c915e87ce132b508adf8e0d7961b':
  Implement the Depth Strider enchantment for the API
2014-12-03 17:41:27 +01:00
Fabian Faßbender
497a7b4cfb Add ANVIL and BEACON custom inventories. Also handle a few special cases for inventory sizes 2014-12-03 16:20:55 +00:00
Thinkofdeath
8110f51b50 Minor formatting fixes 2014-12-03 11:08:35 +00:00
Thinkofdeath
a972ddfc74 Missed a case 2014-12-02 23:57:29 +00:00
Thinkofdeath
1613d09138 Don't wrap the y coordinate in World.getBlockAt 2014-12-02 23:54:38 +00:00
BuildTools
351edbf4e5 Fix CraftMetaBanner serialization. 2014-12-02 15:29:04 +01:00
Thinkofdeath
275603d37a Merge pull request #21 in SPIGOT/craftbukkit from ~GENAZT/craftbukkit:bugfix/SPIGOT-93 to master
* commit '7371301edb1c44ab9153e1fba3722ba2f4e3c411':
  Forgot that i work in Bukkit... Screw sun conventions
  Implementation for the new rotation values. Fixes SPIGOT-93
2014-12-02 13:23:46 +01:00
Thinkofdeath
733e4290d8 [Slightly breaking] setType(Id) will not longer reuse the previous data value
of the block and instead reset the the data value to the block's default
2014-12-02 12:03:02 +00:00
Thinkofdeath
b58808d54d Fix tree related crashes due to lazy BlockState updating 2014-12-02 11:51:49 +00:00
Fabian Faßbender
7371301edb Forgot that i work in Bukkit... Screw sun conventions 2014-12-02 00:20:31 +01:00
Fabian Faßbender
0d5693dec5 Implementation for the new rotation values. Fixes SPIGOT-93 2014-12-02 00:13:25 +01:00
Adam Thomas
cc9b479fe6 Fix show player 2014-11-30 20:12:54 +00:00
Thinkofdeath
22df292258 Add a somewhat hacky fix for plugins converting between book types 2014-11-30 15:06:14 +00:00
Thinkofdeath
6eb0c79271 Fix Chunk.getTileEntities() (Fixes SPIGOT-62) 2014-11-30 12:15:56 +00:00
Thinkofdeath
20207a0124 Correct the return value of getPlayerListName 2014-11-30 10:30:32 +00:00
Fabian Faßbender
b08f233fe1 Rewrite the level.dat properly. This fixes SPIGOT-46 2014-11-29 20:33:33 +01:00
Mike Primm
4692204921 SPIGOT-30: Fix restoring of WorldData when loading worlds 2014-11-29 09:34:54 -06:00
Suddenly
cce45591f6 Implement the Depth Strider enchantment for the API 2014-11-29 15:13:43 +00:00
Thinkofdeath
f498585ecc Ignore invalid blocks in ChunkSnapshots 2014-11-29 15:05:28 +00:00
Mike Primm
dd33bcf6a5 Fix chunk snapshot generation (needed for Dynmap) 2014-11-28 18:30:59 -06:00
Thinkofdeath
585a827dcd Fix setAge and related methods 2014-11-29 00:17:45 +00:00
Thinkofdeath
923b375d8e Fix missed case in CraftBlock 2014-11-29 00:14:46 +00:00
Thinkofdeath
2575b3f9c0 Remove extra color codes at the start from converted json chat 2014-11-28 19:59:41 +00:00
Thinkofdeath
24557bc2b3 Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
2014-11-28 17:16:30 +11:00
bendude56
a4805dbd77 Allow teleportation of entities on vehicles. Fixes BUKKIT-4210
Up until Minecraft version 1.5 it was not possible to teleport entities
within vehicles. With the 1.5 update came the change in the Minecraft
teleportation logic to dismount before teleporting the entity, if
applicable.

This commit ammends the existing CraftBukkit logic for rejecting
teleportation for entities in vehicles to permit the action. Due to this
change, CraftBukkit is now in-line with Minecraft 1.5 teleportation logic.
2014-08-17 11:49:27 -06:00
Jerom van der Sar
80e8f2ab87 Implement ability to keep items on death via plugins. Adds BUKKIT-5724
When a player dies their inventory is normally scattered over the the area
in which they died. Plugins should be able to modify this behaviour by
defining whether or not the player's inventory will be dropped on the ground or waiting for the player when they eventually respawn.

This commit implements the methods included in the Bukkit half for the new
behaviour by acting upon the boolean flag. The boolean flag is tested
prior to clearing the inventory as well as prior to dropping the items on
the ground. If the flag is true (indicating "keep inventory"), the items
are not removed from the player's inventory and are not dropped on the
ground.
2014-08-17 11:41:40 -06:00
Starbuck Johnson
3626720d53 Modify the invalid item set to permit command blocks. Fixes BUKKIT-4342
When using a "vanilla" Minecraft server using the "pick block" key on a
command block yields the invoker with a command block within their
inventory while in creative mode. Implications of the invalid items set
containing the command block also include having a "ghost" item that
cannot be placed due to it not actually existing.

This commit resolves the problem and brings Craftbukkit closer to vanilla
behaviour by removing the command block item ID, 137, from the invalid
items set.
2014-08-17 11:23:28 -06:00
myiume
4507cec090 Fix PlayerFishEvent not correctly cancelling. Fixes BUKKIT-5396
Prior to this commit cancelling the PlayerFishEvent would cause various
states of the fishing routine to be incorrectly or wrongly fired. This
incorrect behaviour was due to the miscommunication between the server and
client regarding the fishing state. When the event was cancelled, the
bobber entity was removed and caused the client to incorrectly determine
what the "next state" was to logically be.

This commit resolves the issue by ensuring the client is made aware of the
correct changes at the correct time regarding the bobber entity, therefore
keeping the logical steps of "fishing" proper and in-tact.
2014-08-17 00:17:02 -06:00
Wesley Wolfe
b3e83b00fc Implement deprecated methods. Adds BUKKIT-5752 2014-08-07 19:35:16 -05:00
Wesley Wolfe
1f0c791444 Use sensible AssertionError instead of ambiguous RuntimeException 2014-08-07 19:29:35 -05:00
ase34
87f6fa7bc9 Fix cancelling PlayerDropItemEvent. Fixes BUKKIT-3313
Up until this commit the PlayerDropItemEvent, if cancelled, would return
items to the first available slot in the inventory - which is clearly
undesirable as a player and plugin author to deal with.

This commit changes that by ensuring that the item is returned to where
it came from in the player's inventory. This still supports modifying the
drop from the player and will default to "first available slot" if the
item has changed since the event was fired. Other remaining behaviour of
the event is still in tact and has not been modified.
2014-08-04 12:27:50 -06:00
feildmaster
971329c42b Fix removal of items from Item Frames. Fixes BUKKIT-5736 2014-08-02 16:12:03 -05:00
Travis Watkins
594d7cb8c9 Don't confuse client with sound coordinates outside view distance. 2014-07-15 21:28:10 -05:00
Wesley Wolfe
c7398b9fdf Provide modifier functions to EntityDamageEvent. Fixes BUKKIT-5688 2014-07-13 00:07:38 -05:00
Travis Watkins
319a9c20eb Handle uniform block ids greater than 127. Fixes BUKKIT-5686 2014-07-10 19:19:48 -05:00
Travis Watkins
13482ac7f6 Put damage modifiers in Functions for event. Fixes BUKKIT-5681 2014-07-09 18:21:59 -05:00
Travis Watkins
dbb5e6e3cd Update CraftBukkit to Minecraft 1.7.10 2014-07-08 14:31:10 -05:00
Wesley Wolfe
a8628fd645 Use 4787c23dce0f5ac856d8d398225828971a93a3ff Guava patch for onlinePlayers
This change improves the quality of life for plugin developers using
iterator iteration with side-effects. In the specified Guava patch, the
internal iterator no longer relies on the AbstractList iterator which
iterates by index, and will instead wrap the provided iterator in a
transformer given the Function.
2014-07-01 00:48:07 -05:00
Wesley Wolfe
b602b5efa4 Implement new getOnlinePlayers. Adds BUKKIt-5668 2014-06-25 15:59:58 -05:00
t00thpick1
83e934b3bd [Bleeding] Fix checks for non-living entities. Fixes BUKKIT-5667 2014-06-24 18:24:29 -05:00
t00thpick1
9099e48e74 [Bleeding] Ignore damage done by LivingEntity.damage(). Fixes BUKKIT-5666
This matches behavior previous to new damage event API of not throwing
events for plugin-triggered damage.
2014-06-23 16:42:31 -05:00
Travis Watkins
6364f59ac4 Use compact memory format for uniform chunk section data.
Many chunk sections contain parts of their data that are the same for
every block they contain. In these cases we can save memory by saving
a single value instead of an array of 4096 copies of that value. Block light
and block data are most likely to be uniform followed closely by sky light
data. Block ids are far less likely to be uniform but give the largest
saving when they are. Because of this we use a compact format for every
part of the chunk. Memory saved from this technique will vary based on the
world but seems to be about 50% on normal Minecraft generated chunks.
2014-06-23 16:24:39 -05:00
t00thpick1
5adbab524d [Bleeding] Set projectile source for reflected fireballs. Fixes BUKKIT-5661 2014-06-22 16:52:52 -05:00
t00thpick1
6f21d3ca8f [Bleeding] Implement new damage api. Fixes BUKKIT-5326, BUKKIT-3878.
This commit centralizes event handling to where damage is actually applied
to the entity to avoid bugs that have resulted from nodamageticks,
modifications to damage after the event has been called, and similar
mishaps. This also implements new API for getting and setting of
modifications made to the damage amount actually applied to the entity.
This is done by storing the change in the damage amount as each modifier
is applied by vanilla code.

The method that actually damages the armor worn by an entity has been
relocated beneath the event called as to not apply durability loss when
the event has been cancelled.
2014-06-22 15:23:16 -05:00
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
GJ
a0e50c36b9 [Bleeding] Fix Blazes not firing death events. Fixes BUKKIT-4898
Previously, due to the way that death events were called, Blazes only
fired death events when they dropped loot. This change fixes that,
enabling death events for Blazes whenever they die, regardless of loot
drops.
2013-12-13 22:21:11 -07:00
t00thpick1
ae9cd0729e [Bleeding] Call EntityTargetEvent for EnderDragons. Fixes BUKKIT-5160
EnderDragons did not call an EntityTargetEvent when they
were targeting random players in the End.  This commit
adds that event call into the targeting code.
2013-12-13 22:20:39 -07:00
t00thpick1
1154484815 Do not fire EntityDamageEvent for explosions twice. Fixes BUKKIT-5156
Explosions directly caused by LivingEntities, such as creepers and tnt lit
by players, have their EntityDamageEvent explicitely handled within
the Explosion class.  In order to prevent double events when damage
is handled for other DamageSources, we need return null for explosion
based damage sources.
2013-12-13 20:05:36 -07:00
t00thpick1
c2a0396af2 Throw event when EnderCrystals harm EnderDragon. Fixes BUKKIT-4052
The EntityLiving dealDamage method will not call an event for the
entity damage caused by an explosion without an associated
entity cause, therefore, the explosion caused by EnderCrystals
needs to be explicitely handled within the EnderDragon class.
2013-12-13 20:05:35 -07:00
t00thpick1
e6bccf6bfd Re-add WorldLoadEvent lost in 314051580a0a8e4745d3a539f232b552916eb302 Fixes BUKKIT-5125
In the 1.4.2 update for CraftBukkit, a missed diff resulted in the
WorldLoadEvent no longer being fired for the worlds loaded on
startup.
2013-12-13 20:05:35 -07:00
t00thpick1
1460f250cf Alter fall particles to respect visibility API. Fixes BUKKIT-5158
Bukkits Visibility API should prevent players from seeing fall particles
of players that they cannot see.  This commit alters the handling to
provide an EntityPlayer argument that is later used to determine if they
are visible.
2013-12-13 20:05:19 -07:00
t00thpick1
bdbd1808f7 Show fall particles while in creative mode. Fixes BUKKIT-5009
Relocate CraftBukkit patch to fall damage when changing
gamemode from creative mode.
2013-12-13 18:51:13 -07:00
Travis Watkins
fbe062caf5 Only filter data from block items, not all of them. Fixes BUKKIT-5047 2013-12-13 18:52:33 -06:00
Travis Watkins
f5fad449bd Call interact event if block cannot be punched. Fixes BUKKIT-5126
We do ray tracing on arm swings to filter out swings that hit blocks since
punching blocks has its own event handling. However, some blocks cannot
be punched so the air interact type is still valid for them. Luckily
these blocks all have a means to query them so add an additional check
for this and don't fail the check for them.
2013-12-12 02:01:22 -06:00
Wesley Wolfe
ca4c118994 Rework furnace result log. Fixes BUKKIT-5115
This changes the logic for furnace smelt event to consider a result of
null (read: air / invalid), which will still consume an item. It also
properly considers item meta in the result, instead of only checking the
item data value.
2013-12-10 16:21:09 -06:00
Travis Watkins
f5f71a5502 Print message on startup before loading log4j
Log4j takes a long time to load on startup. Before it loads, the server
appears to have frozen as there is no output until after. We now print
a loading message before this happens to let the user know the server
is actually working.
2013-12-09 14:12:34 -06:00
Travis Watkins
772867eb51 Call event when pistons push an item frame/painting. Fixes BUKKIT-5110
When pistons push/pull blocks they call Entity.move(float, float) to move
entities out of their path. For hanging entities this code path makes them
simply die and drop as an item. We now call an event in this scenario so
plugins can control this behavior.
2013-12-09 13:43:02 -06:00
Travis Watkins
305e5f4f08 Handle null damage events for item frames. Fixes BUKKIT-5114
Some types of damage are handled specially so do not end up returning an
event in handleEntityDamageEvent. To ensure we don't have problems with
these we need to check for them and simply ignore them, as they've been
handled already.
2013-12-09 13:40:52 -06:00
Alex Ciuba
80935e5c2b Don't consume bonemeal if there is no crop present. Fixes BUKKIT-3790
Bonemeal dispense behavior already took care of decrementing the item
stack, therefore we shouldn't manage the size manually.

Pulled from PR #1172
2013-12-08 23:21:11 -06:00
t00thpick1
0aa187f151 [Bleeding] Ignore Block Physics in Chunk population. Fixes BUKKIT-4923
Suppressing physics updates during Chunk population prevents
infinite recursion due to custom Block Populators editing border
blocks on chunks.
2013-12-08 22:39:50 -06:00
BlackHole
c7b4514ad3 Call BlockPlaceEvent for cocoa beans planted on log. Adds BUKKIT-5039
The behavior of cocoa are now aligned to be the same as other plants.

Pulled from PR #1281
2013-12-08 21:47:26 -06:00
Starbuck Johnson
36ef37b982 Call EntityDamageEvent on ItemFrame item removal. Fixes BUKKIT-5020
Calling this event allows plugins to react to the situation by simply
handling a normal damage event, possibly using existing code to
handle other entity damage.

Pulled from PR #1279
2013-12-08 20:58:27 -06:00
Starbuck Johnson
3cf569a33f Added EntityItemFrame.java for diff visibility 2013-12-08 20:31:38 -06:00
Kodekpl
431e5ea442 Set proper position of snow block. Fixes BUKKIT-5004
Missed diffs when updating to 1.7.

Pulled from PR #1278
2013-12-08 20:26:37 -06:00
AlphaBlend
ff0da6bad5 Fix BlockPhysicsEvent having incorrect changed type. Fixes BUKKIT-5063
This change updates the reference to the local variable representing the
block being checked when calling BlockPhysicsEvent.
2013-12-07 21:34:50 -07:00
t00thpick1
6f4d9bea2b [Bleeding] Correctly generate giant mushrooms. Fixes BUKKIT-5066
This change fixes the reference to the local variables representing the
block position during large mushroom generation.
2013-12-07 20:31:04 -06:00
feildmaster
97cb46f9f8 Reintroduce disconnection flag that was removed in 1.7 update. 2013-12-06 21:34:06 -06:00
Wesley Wolfe
70747ca28b Follow vanilla settings behavior. Fixes BUKKIT-5069
A vanilla server does a series of checks for the client black-listing
certain chat types (commands or chat). This change changes a CB
whitelist to the vanilla blacklist behavior.
2013-12-06 16:44:32 -06:00
Wesley Wolfe
dc86362c9a Implement Firework.detonate(). Adds BUKKIT-4538
This implements the detonate method from bukkit by setting the fuse
timer to 0. This makes a firework explode using the normal codepath,
but without waiting for the fuse.
2013-12-06 00:05:23 -06:00
feildmaster
8a29829d1a Correctly register Furnace Recipies. Fixes BUKKIT-5044
We should also use items, not blocks. :)
2013-12-05 14:37:14 -06:00
GJ
b880a2d24c Add new fishing enchants. Fixes BUKKIT-5035 2013-12-04 21:17:54 -07:00
t00thpick1
e5353b82a7 Correctly validate map colors. Fixes BUKKIT-4984
The validation check in CraftMapView.render(CraftPlayer) filters out any
values less than 0. As of Minecraft 1.7, -128 through -113 are valid colors,
so filtering them out prevents some of the new colors from being sent.

This commit fixes the issue by adjusting the validation check to include
any values less than or equal to -113.  As the minimum value for a byte is
-128, no invalid colors are included.
2013-12-03 18:56:36 -07:00
Travis Watkins
169fd46960 Finish kicking player before letting their clone in. Fixes BUKKIT-4960 2013-12-03 19:21:27 -06:00
Travis Watkins
bc0ac48074 Try to detect when to disable jline automatically. Fixes BUKKIT-5028 2013-12-03 11:21:26 -06:00
Nate Mortensen
39719fff74 Maintain old setType method in WorldGenerator. Fixes BUKKIT-4915
WorldGenerator setType and setTypeAndData have their arguments changed to
add in support for CraftBlockChangeDelegate, which changes the method
signature. This change in the method signature breaks any WorldGenerators
that aren't modified to use CraftBlockChangeDelegate.

This commit fixes the issue by readding the old method and maintaining the
CraftBlockChangeDelegate method.  This makes it so that there is a
compatible method for both  CraftBlockChangeDelegate WorldGenerators and
unmodified WorldGenerators.

Additionally, this commit reduces and corrects the diffs in
WorldGenerator, moving the fix for layering violations to
CraftBlockChangeDelegate.
2013-12-02 21:03:57 -07:00
toastedtruth
a721fe8473 Fix BlockCanBuildEvent returning null. Fixes BUKKIT-4972
A Block object is now passed in place of the previous id value, so the
obfuscated name for all subsequent arguments was shifted.  As such,
BlockCanBuildEvent was using the incorrect values for both the material
and the location of the event.

This is corrected by swapping the values into the correct order and
providing an id based upon the Block passed into the method.
2013-12-02 21:03:57 -07:00
toastedtruth
803268867e Fix written books crashing the server. Fixes BUKKIT-4945
CraftBukkit modifies the IRecipe interface, adding new methods, so all
classes that implement IRecipe need to be imported and modified to add the
new methods.

Extending ShapelessRecipes implements the added methods and allows
RecipeBookClone to work with the Recipes API in a way that is consistent
with similar recipes, even if the recipe information present in the API
isn't technically correct.
2013-12-02 21:03:56 -07:00
toastedtruth
579b203347 Added RecipeBookClone from nms for diff visibility 2013-12-02 21:03:56 -07:00
Aikar
9969a86e83 Use strict lookup for op permission refresh. Fixes BUKKIT-4698
Adding or removing operators was mistakenly using a loose player lookup
method, which would cause a permission refreshes on an online player whos
name starts with the name of the (offline) opped player.

Add/Remove op operations are exact name match only and the permission
refresh will behave the same way.
2013-12-02 20:34:01 -06:00
Travis Watkins
c5d8b4393a Use correct packet data for toggling flying. Fixes BUKKIT-4989 2013-12-02 20:13:07 -06:00
feildmaster
8c444f275a Correctly drop BlockBreakEvent experience. Fixes BUKKIT-4942
This was a missed diff from the update.
2013-12-02 17:29:12 -06:00
Travis Watkins
963cd5438a Catch all exceptions in jansi initialization. Fixes BUKKIT-4936
Both log4j and our own jline/jansi initialization attempt to catch
errors caused by jansi's use of native libraries. However both of them use
the Exception type which does not catch all errors. On Windows Server 2008
R2 Enterprise without installing extra software the required C++ libraries
are not available which causes an error that does not extend Exception. To
ensure we catch all errors I've changed both of these to catch Throwable
instead which gets us a working console minus jansi functionality.
2013-12-02 15:46:34 -06:00
Travis Watkins
f3865064f8 Add ConsoleAppender from log4j for diff visibility 2013-12-02 15:43:29 -06:00
Nate Mortensen
5b6f271037 Fix missed doors diff. Fixes BUKKIT-4908
l previously was the block id, however Minecraft's refactoring means that
the method is now passed a Block reference rather than the id.  l is now
the data value of the block, so the block retrieved with that value is not
the correct block to be testing.
2013-12-01 14:54:51 -07:00
feildmaster
f0af95505b Fix fishing ignoring event experience. 2013-12-01 14:46:41 -06:00
mbax
46c11eb83f Handle ChatColor-ending messages FIXES BUKKIT-4924
Now adds the component upon creation, eliminating issues where the
created component was discarded.
2013-12-01 15:24:15 -05:00
feildmaster
72b36b8b07 Correctly send player names for the tab list. Fixes BUKKIT-4925 2013-12-01 14:15:59 -06:00
Travis Watkins
6aafe7c5a1 Make console work on Windows again. Fixes BUKKIT-4956
Something the log4j ConsoleAppender does makes the console work correctly
on Windows. After trying to pull pieces of it out and run them manually
I decided to just put the appender back. We now once again start with the
ConsoleAppender then remove it immediately after starting.
2013-12-01 13:21:22 -06:00
Travis Watkins
d48bcbe642 Handle JUL logger formatting 2013-12-01 12:29:22 -06:00
Travis Watkins
c098854591 Forward exceptions to log4j, cleanup logger handling. Fixes BUKKIT-4948 2013-12-01 11:15:18 -06:00
mbax
2726696652 Update CraftBukkit to Minecraft 1.7.2 2013-11-30 19:26:12 -06:00
feildmaster
1c7698fab2 Ensure maps are stored only in the main world. Fixes BUKKIT-4872 2013-10-30 17:00:41 -04:00
Wesley Wolfe
7aabcb2ab3 Don't share WorldMapCollection. Fixes BUKKIT-4871
WorldMapCollection stores scoreboard, map (item), structure, and
village information. Scoreboards are explicitly handled globally,
while villages and structures are erroneously shared.

This commit separates the WorldMapCollections to not be shared among
custom worlds. Maps are special-cased to maintain the previous shared
behavior.
2013-10-30 04:22:00 -05:00
Wesley Wolfe
bd1389895b Add auto-save plugin redundancy detection.
This change will print a warning when a plugin induces a forced save. A
player or console forcing a save (via a command) is ignored for purposes
of printing a warning.
2013-10-23 20:22:30 -04:00
EvilSeph
de16ba6eec Re-enable built in auto-save. Fixes BUKKIT-4800
When Minecraft first introduced an auto-save feature, we
were taken by surprise by how much of an impact it actually had on the performance
of the server. After investigating the potential causes of the significant
slow-downs we saw at the time, we came to the conclusion that it was a
combination of the auto-save interval being incredibly frequent and
servers already having an auto-save solution that was conflicting with the
newly added built-in one.

Since we noticed that most servers already had their own auto-save
solution, we decided to completely disable the built in auto-save by
default. In hindsight, however, we were so happy that we discovered and
squashed the cause of the performance issues that we forgot to consider
the future and, as a result, some servers have unfortunately been caught
by surprise when they ran their servers without any auto-save plugins.

Without the auto-save plugin conflict, however, Minecraft's default save
interval of 45 seconds is not suitable for the types of servers that run
Bukkit, to the point where it was negatively impacting performance. As
such, we've decided to re-enable the built in auto-save at an interval of
5 minutes for newly created servers.
2013-10-23 19:29:05 -04:00
Nate Mortensen
6430c868c7 Remove redundant call to worldMaps.a(). Addresses BUKKIT-4828
The WorldMapCollection object for SecondaryWorldServers(Nether, End) is
shared with the main world, so saving it again for each SecondaryWorldServer
is redundant.

This commit removes the redundant call by checking if the WorldServer is an
instanceof SecondaryWorldServer before invoking worldMaps.a().
2013-10-19 20:01:52 -06:00
feildmaster
f4277d7105 Force item data to use a tag name. Fixes BUKKIT-4809
The recent Minecraft update rendered the
e20e50f85083dc53cb5456254bcf5781ef750daa fix incorrect by adding a
compound name to the base tag in some code. This fix changes all uses
of tag changes to explicitly use a name.
2013-10-12 03:18:45 -05:00
Phil Watson
159403e085 Call BlockFadeEvent for fire on inflammable block. Fixes BUKKIT-4835
This adds a call to fireExtinguished for fire burning out on inflamable
blocks, similar to other causes of fire fading.
2013-10-09 16:34:10 -05:00
Wesley Wolfe
ca5e0c6db0 Add exception-resilience to reading UUID. Fixes BUKKIT-4833
When a "uid.dat" file is corrupt (empty or <16 bytes), WorldNBTStorage
will silently fail to read and return null. Non-null behavior is
expected everywhere that this value is used.

This change will force a random UUID when the previous UUID cannot be
read, and getUUID to no longer silently ignore read/write exceptions.
2013-10-06 22:37:44 -05:00
Wesley Wolfe
cfa5490a58 Clarify exception message for bad hanging location. Fixes BUKKIT-4824
This change adds the location and a more specific message to the
IllegalArgumentException that gets thrown when a hanging entity is being
spawned in a location that it cannot survive.
2013-10-05 13:21:15 -05:00
Wesley Wolfe
90e8aa008a Initialize hostname on handshake. Fixes BUKKIT-4793
This restores a lost CraftBukkit diff that initializes the hostname
field used during login events.
2013-09-20 09:13:48 -05:00
feildmaster
dcb9d6a5ef Update CraftBukkit to 1.6.4 2013-09-19 20:01:02 -05:00
feildmaster
7ad5d6098d Fix villager death sound 2013-09-10 21:55:42 -05:00
feildmaster
ac73522ecf Add missing villager sounds. Addresses BUKKIT-4756 2013-09-10 21:30:36 -05:00
EvilSeph
6d700c3320 Use correct spawn reason for Zombie reinforcements. Fixes BUKKIT-4744 2013-09-10 22:24:00 -04:00
EvilSeph
b8feaf059c Remove unnecessary error logging. Fixes BUKKIT-4406 2013-09-10 22:23:59 -04:00
Phillip Schichtel
ffcd0f4502 Provide a tab completion handler for JLine. Adds BUKKIT-4168 2013-09-10 20:57:31 -05:00
FrozenBrain
5f65cd9a1c Add support for custom Hopper inventories. Fixes BUKKIT-4722
Opening a hopper inventory created by Server.createInventory will
currently have no effect as proper handling code is missing in
CraftEntityHuman for hopper inventories that aren't associated with a tile
entity or minecart. Initialization logic for hoppers is also missing from
CraftContainer, which is necessary for the opening of custom hopper
inventories.

This commit fixes the two aforementioned by adding proper handling to
CraftHumanEntity for opening inventories not associated with a tile
entity, and by adding initialization logic for hoppers to CraftContainer.
2013-09-10 20:51:35 -05:00
feildmaster
600e1524a9 Update and add new sound mappings. Fixes BUKKIT-4756 2013-09-10 20:24:34 -05:00
Brokkonaut
5f43109c0e Correct location of fire from lightning strikes. Fixes BUKKIT-4707
Previously fires spawned by lightning strikes were in the wrong locations.
This introduced the possibility of having blocks replaced when they should
not be.

EntityLightning now uses the correct locations as defined to spawn the
fires when needed.
2013-09-10 20:53:48 -04:00
feildmaster
8ae8957d15 Properly set persistence flag for bred animals. Fixes BUKKIT-4751 2013-09-10 19:42:08 -05:00
Nate Mortensen
c62375f95e Check that a vehicle is a Vehicle before casting. Fixes BUKKIT-4749
When an entity is being moved as the passenger of an entity from one
entity to another, a VehicleExitEvent is fired, but it is assumed that the
current entity is a Vehicle. However, entities can be passengers of more than
just Vehicles, which causes a ClassCastException to be thrown.

This commit fixes the issue by checking that the current entity's vehicle's
bukkitEntity is an instance of Vehicle before casting it to Vehicle.
2013-09-09 22:07:27 -05:00
Wesley Wolfe
5c861fe864 Fix improperly initialized usernames 2013-09-02 16:51:14 -05:00
T00thpick1
cd593fb1ee Set current recipe to null when a recipe isn't found. Fixes BUKKIT-2311
This commit restores the diff from 84dbc21aa71b96fd1d2ea40d624b536309118cde
that has since been lost.
2013-08-28 08:14:01 -06:00
Roger Baumgartner
2e7f66787d Return correct hasLineOfSight value for players. Fixes BUKKIT-4634
Prior to this change when a plugin called Player.hasLineOfSite() the
method would always return false because EntityHuman does not extend
EntityInsentient. This commit changes that by explicitly checking for
line of sight between two entities and returning that value.
2013-08-26 08:43:51 -06:00
T00thpick1
6482b6f0bd Fire FoodLevelChangeEvent when eating cake. Fixes BUKKIT-2242 2013-08-15 11:59:47 -06:00
T00thpick1
3fb4ccb62c Add BlockCake for diff visibility. 2013-08-15 11:59:46 -06:00
Wesley Wolfe
f481c9ee07 Make ItemFactoryTest.java platform agnostic. Fixes BUKKIT-4695
Maven paths that include spaces (and possible other characters) get
improperly translated when using a file handle from a URL. This changes
the unit test to open a stream directly from the URL, providing proper
file resolution on multiple platforms.
2013-08-14 02:37:24 -05:00
T00thpick1
ea39ca187b Return instance of CraftInventoryBeacon for Beacons. Fixes BUKKIT-4521 2013-08-07 13:42:23 -06:00
Wesley Wolfe
92f111cfed Fix missed diff for chat packets. Fixes BUKKIT-4666
This commit removes chat wrapping. It is no longer needed, as clients
properly render lines with line breaks.

This commit also changes an outgoing chat message to use the vanilla
behavior for indicating a client cannot chat with commands-only setting.
2013-08-07 04:05:56 -05:00
riking
0506b709fe Wrap plugin.getDefaultWorldGenerator in try-catch. Fixes BUKKIT-4116
If a plugin generates an exception when returning a world generator, the
server will crash. This change adds a try-catch block to keep the server
from crashing on plugin defined world generators.
2013-08-07 01:01:12 -05:00
Wesley Wolfe
71a6a56572 Fix javac workaround in ItemStackTest 2013-08-06 20:09:42 -05:00
Wesley Wolfe
9ba5c79c30 Add BukkitObjectIOStream tests on top of ItemMeta tests 2013-08-06 20:00:29 -05:00
Wesley Wolfe
066fcfe79f Validate title for custom inventories. Fixes BUKKIT-4616, BUKKIT-4663
Custom inventories currently do not validate the titles provided. Null values
cause NPEs when writing packets. Values longer than 32 characters
disconnect clients.

This change throws and IllegalArgumentException for null titles or titles
longer than 32 characters.
2013-08-06 17:11:30 -05:00
T00thpick1
5e8dd7d57d Use correct spawn reason for Villagers Breeding. Fixes BUKKIT-4113 2013-08-06 13:03:14 -06:00
T00thpick1
485e9ad93f Add PathfinderGoalMakeLove for diff visibility 2013-08-06 13:03:13 -06:00
T00thpick1
4aeb3ff63d Call unleash event for non-sitting animals. Fixes BUKKIT-4658
The unleash event is only called for animals that are sitting - ones that
receive no movement vector. This adds the missing event call for
non-sitting animals.
2013-08-06 00:38:44 -05:00
Jonatan Noponen
6d0d33b9d2 Fix off by 1 error for spawn protection. Fixes BUKKIT-4154 2013-08-03 18:23:38 -04:00
Kai Dederichs
e7539378fa Fix mistranslation in isPlayerCreated() for IronGolems. Fixes BUKKIT-4543 2013-08-03 18:23:37 -04:00
Wesley Wolfe
da5d494b36 Update players when coming into view of vehicle. Fixes BUKKIT-4628
When only considering trackers from player perspective, attach entity
packet could be sent before a packet for a respective vehicle is in view
and will, in turn, be ignored.

This adds another notification when the vehicle comes into view to cover
all cases.
2013-08-03 17:03:49 -05:00
T00thpick1
54672a75f6 Implement Leash API. Adds BUKKIT-4459, BUKKIT-4583 2013-08-03 15:03:41 -05:00
T00thpick1
f7ca953ff1 Add EntityLeash and ItemLeash for diff visibility 2013-08-03 14:48:40 -05:00
Wesley Wolfe
8a7c582d54 Ignore null sound by contract. Fixes BUKKIT-4641 2013-08-02 20:05:22 -05:00
Wesley Wolfe
93cfe3961f Indicate help is a command. Fixes BUKKIT-4642 2013-08-02 20:03:50 -05:00
EvilSeph
720a8d706a Revert to 1.5 despawning behaviour for Ocelots and Wolves. Fixes BUKKIT-4449 2013-08-02 19:21:35 -04:00
EvilSeph
a466e0aa6c Add timeout for Panic goal. Fixes BUKKIT-4531 2013-08-02 19:20:26 -04:00
EvilSeph
ab36dbb6a9 Add PathfinderGoalPanic for diff visibility. 2013-08-02 19:20:25 -04:00
h31ix
f959530f6b Add raw sound string playSound method. Adds BUKKIT-2443
A method has been added to Player which allows the server to send a sound string to the client. Assuming the client has the specified sound, it will be played. This is needed by the implementation of the /playsound command.
2013-08-02 00:13:20 -05:00
Wesley Wolfe
c8b09db844 Restore diff missed in 4176258a836062b22ac46919aefa5cc36fae78f2 2013-08-01 12:12:40 -05:00
Wesley Wolfe
69d3362335 Revert "Correct vehicle movement issues." Fixes BUKKIT-4565
This reverts commit 3d906d134417cfeefe7f71b916fee4d105e7650f.

Conflicts:
	src/main/java/net/minecraft/server/EntityTrackerEntry.java
2013-07-29 13:04:23 -05:00
Wesley Wolfe
b2be908fbb Fix NBT token for attribute names. Addresses BUKKIT-4483 2013-07-28 14:52:25 -05:00
Wesley Wolfe
1e7f2ebebd Store item attributes. Addresses BUKKIT-4523 2013-07-27 18:00:01 -05:00
T00thpick1
b6fec0467f Restore CraftBukkit diff in ItemDye. Fixes BUKKIT-4493
Change ItemDye to pass the EntityHuman for StructureGrowEvent again.
2013-07-25 18:27:00 -05:00
Wesley Wolfe
5bfd599e9f Store owning Horse in horse inventory. Fixes BUKKIT-4586 2013-07-25 18:04:09 -05:00
Wesley Wolfe
0a9758ae54 Fix CraftBukkit diffs 2013-07-23 22:07:42 -05:00
Wesley Wolfe
e88cea8402 Check interactable items before event. Fixes BUKKIT-4576
Items that cause entities to change state, including tags, chest, and
leashes, do not update the client properly following the firing of
PlayerInteractEntityEvent. This change makes the item checks occur
before the event fires, to concur with the client's assumptions.
2013-07-23 21:52:31 -05:00
T00thpick1
1192f2a53a Add API to control scaled health. Adds BUKKIT-4590
This commit implements the ability to set the scale of hearts that the
client renders.  When the Packet44UpdateAttributes packet is sent, the
max health attribute is replaced with a scaled version, to preserve the
scaled health illusion clientside.

In order to accurately display the scaled health for players, a true
health is stored within CraftPlayer, and the datawatcher now stores the
scaled health. The getHealth() method for players still returns their
true health.

Changed setHealth() within EntityLiving to appropriately handle health
for instances of EntityPlayer. Inlined a call to
setHealth(getMaxHealth()) within the EntityLiving constructor to work
around CraftEntity instantiation.

Additionally fixes the health values sent when eating food within
FoodMetaData and ItemFood, which previously sent the unscaled health;
this commit alters them to send the properly scaled health.

Additionally fixes BUKKIT-4535, BUKKIT-4536, and BUKKIT-4127
2013-07-23 21:52:17 -05:00
Jim Bilbrey
4ad3cdd4b5 Use ambient setting of potion effects. Fixes BUKKIT-4357 and BUKKIT-3653
This changes livingEntity.addPotionEffect(PotionEffect, boolean) to
construct the MobEffect using the constructor that includes the ambient
setting as supplied by the PotionEffect

This also changes livingEntity.getActivePotionEffects() to construct the
PotionEffects using the ambient setting supplied by the MobEffects.
2013-07-13 20:28:16 -04:00
Nate Mortensen
cebc247b78 Correctly fire VehicleExitEvent. Fixes BUKKIT-3761
This change makes it so that EntityHuman#setPassengerOf(Entity) invokes
its parent method when leaving vehicles so that VehicleExitEvent is fired
for players leaving vehicles.

This change also fixes BUKKIT-2110, making it so VehicleExitEvent
correctly handles cancellation. The implementation of VehicleExitEvent
completely ignored the cancellation state of the event, making it so that
cancelling the event had no effect.  Cancelling a VehicleExitEvent now
causes the entity to remain inside of the vehicle, with no visual stutter.
2013-07-13 13:29:32 -06:00
EvilSeph
67f15266da Return inGround when checking Arrow's OnGround state. Fixes BUKKIT-4439 2013-07-10 20:27:03 -04:00
EvilSeph
a31158bd0b Clear attributes on death; mistranslation issue. 2013-07-10 20:02:18 -04:00
h31ix
f9d58bf481 Implement Horse API. Adds BUKKIT-4424
API has been added to interface with Horses and to modify their inventories. Horse entities will now be recognized with the type EntityType.HORSE, and will no longer be UNKNOWN.

HorseJumpEvent, EntityDamageEvent, and EntityTameEvent are all correctly fired for horses.

This commit fixes BUKKIT-4393.
2013-07-10 13:45:52 -04:00
h31ix
a192775f0f Add PathfinderGoalTame for diff visibility. 2013-07-10 13:45:43 -04:00
EvilSeph
f665884955 Correctly set level name for 'world' option. Fixes BUKKIT-4474 2013-07-09 21:35:49 -04:00
EvilSeph
9109bd7652 Ocelots -> Ocelittle. Addresses BUKKIT-4449 2013-07-09 21:04:45 -04:00
mbax
f6a0b1e426 Update CraftBukkit to 1.6.2 2013-07-08 19:43:37 -04:00
EvilSeph
2d9a9d8cea Removed extra eat call. Fixes BUKKIT-4462 2013-07-04 19:19:36 -04:00
EvilSeph
c00db5f751 Properly clear attributes on remove and death. Fixes BUKKIT-4416 2013-07-03 00:25:31 -04:00
Wesley Wolfe
adcb293a03 Fix scaling for player health. Fixes BUKKIT-4431 2013-07-02 23:09:43 -05:00
EvilSeph
29fa46a4b2 Fix donkey/mule dupe exploit. 2013-07-02 23:38:44 -04:00
EvilSeph
7b71fc23be Added EntityHorse for diff visibility. 2013-07-02 23:38:44 -04:00
mbax
d213f7588f Update client on cancelled entity naming. Fixes BUKKIT-4396 2013-07-02 21:38:01 -04:00
mbax
774cf2a2ca Update client on cancelled leash. Fixes BUKKIT-4395 2013-07-02 21:06:17 -04:00
mbax
a15096ae1c Send event-defined MOTD/maxplayers. Fixes BUKKIT-4409
Also, revert to previous CraftBukkit functionality
2013-07-02 16:36:57 -04:00
mbax
905f00b070 Fix world preparation status output. Fixes BUKKIT-4407 2013-07-02 16:07:50 -04:00
mbax
65ccff6340 Regrow sheep wool on grass consumption. Resolves BUKKIT-4405 2013-07-02 15:01:57 -04:00
Nate Mortensen
3a9622cbdc Fix Entity persistence. Fixes BUKKIT-4397
Missed diff.
2013-07-02 11:50:37 -06:00
Wesley Wolfe
22adf8a3ce Rework max health values. Fixes BUKKIT-4398 2013-07-02 12:34:40 -05:00
Wesley Wolfe
e79d26d7d7 Fixed NPE in BrewingStand 2013-07-01 22:29:43 -05:00
Nate Mortensen
6c09066e22 Update CraftBukkit to 1.6.1 2013-07-01 12:10:06 -05:00
Nate Mortensen
5c8498c8b7 Fix cancellation for InventoryDragEvent. Fixes BUKKIT-4332
Cancelling InventoryDragEvent causes the placed items to be lost.  This is
because the cursor is set to the result prior to the event taking place,
so the items are removed from the cursor. When the event is cancelled, the
items removed from the cursor aren't placed in the inventory, and are just
lost.

This change sets the cursor back to the original cursor when the event is
cancelled.
2013-06-13 22:01:50 -05:00
Nate Mortensen
930a9e805c Correct cancellation of InventoryClickEvent. Fixes BUKKIT-4331
Cancelling an InventoryClickEvent for a single click causes the click not
to be processed by the clicked inventory. The server then doesn't
correctly identify their second click as being a double click, causing an
inconsistency between what the Player believes the inventory to be and
what the server believes the inventory to be.

This change forces an updateInventory call whenever an InventoryClickEvent
whose action is NOTHING is cancelled.  Both clicks are considered
PICKUP_ALL, so updating the inventory after the second click fixes any
inconsistencies that could arise between the client and the server.
2013-06-13 22:01:50 -05:00
ST-DDT
93c0d7e6b5 Fix negative damage from Zombies. Fixes BUKKIT-4193
Currently, the method used for calculating the damage of zombies is scaled
to their health, but it uses the default max health rather than the real
max health value. If zombies have more health than the default max health
value, the amount of damage they deal becomes negative.

This is caused by EntityZombie.getMaxHealth() returning a hardcoded value of
20, which is the vanilla max health for zombies. Rather than using this value
when calculating zombie damage, the call is changed to instead use
((CraftLivingEntity) this.bukkitEntity).getMaxHealth(). This uses the true
maximum health of the Entity. "this.maxHealth" could be used instead of the
aforementioned method, however that creates a very unclear diff, and a
confusing change.
2013-06-13 16:53:35 -06:00
Des Herriott
045121d095 Implement PlayerBookEditEvent. Adds BUKKIT-1995 2013-06-10 12:06:37 -06:00
mbax
c55c0db86d Update blaze breathe sound. Fixes BUKKIT-4286 2013-06-05 19:45:24 -05:00
Nate Mortensen
bf4796d39e Fix creative ArrayIndexOutOfBoundsException. Fixes BUKKIT-4305
When a Player drops an ItemStack while in creative mode by placing it outside
of their inventory window, the slot number in the packet is -1. The check
that was added to avoid throwing InventoryCreativeEvent excessively didn't
take this into account, and would cause an ArrayIndexOutOfBoundsException to
be thrown when attempting to get the slot specified by the packet.

This change shorts the invocation of player.defaultContainer.getSlot(
packet107setcreativeslot.b) to only occur if the slot id is within the range
of the Inventory.  This prevents attempting to get the slot from a location
that is actually outside of the Inventory.
2013-06-04 15:58:36 -05:00
riking
991218a339 Improve events for new inventory features. Adds BUKKIT-3859
This commit brings the InventoryClickEvent up to date with the new Minecraft
changes in 1.5.

InventoryDragEvent (thanks to @YLivay for his PR) is added to represent the
new "dragging" or "painting" functionality, where if you hold an itemstack and
click-drag over several slots, the items will be split evenly (left click) or
1 each (right click).

The ClickType enum is used to represent what the client did to trigger the
event.

The InventoryAction enum is reserved for future expansion, but will be used to
indicate the approximate result of the action.

Additionally, handling of creative inventory editing is improved with the new
InventoryCreativeEvent, and handling of numberkey presses is also improved
within InventoryClickEvent and CraftItemEvent.

Also, cancelling a creative click now displays properly on the client.

Adresses BUKKIT-3692, BUKKIT-4035, BUKKIT-3859 (new 1.5 events),
BUKKIT-2659, BUKKIT-3043, BUKKIT-2659, and BUKKIT-2897 (creative click events).
2013-06-03 18:01:08 -06:00
Travis Watkins
5ed1418bb4 Pass correct block when dispensing empty buckets. Fixes BUKKIT-3668 2013-05-03 06:45:11 -05:00
Travis Watkins
d9eb586568 Correct event handling for dispensing filled buckets. Fixes BUKKIT-4046
We only go through event creation and calling when dispensing filled buckets
if the bucket is able to place its liquid. However, the check for this is
incorrect so the event is not called when a block liquids can destroy is
in front of the dispenser. This commit fixes the check to match the checks
vanilla does when actually using the bucket.
2013-05-03 06:38:44 -05:00
Des Herriott
28fb514a4d Send block updates even when applyPhysics is false. Fixes BUKKIT-3971
The CraftBlock class is setting bit 0x4 of the update flag when bit 0x2
should in fact be set here. Bit 0x2 means "do updates"; bit 0x4 means
"don't do updates if the world is static, even when bit 0x2 is set".
2013-05-02 16:42:47 -06:00
Travis Watkins
4e7ad05111 Fix typo/logic error in previous commit 2013-05-02 13:06:21 -05:00
Travis Watkins
25ca3f41af Fix animal spawning ignoring limits. Fixes BUKKIT-4180
Minecraft 1.5.2 changed mob spawning by ignoring persistent mobs from the
mob count. In CraftBukkit all mobs that previously used a separate hard
coded persistence system were ported to instead use this one. This causes
all animals to be persistent by default and thus never be counted. To
correct this issue we consider if the mob would be considered persistent
in the hard coded system as well when deciding if a mob should count.
2013-05-02 12:24:31 -05:00
Travis Watkins
401a6809be Improve InventoryCloseEvent handling. Fixes BUKKIT-3286
Currently there are several cases where a player will have their inventory
screen closed client side but we will not call an event. To correct this
we call the event when the server is the cause of the inventory closing
instead of just when the client is the cause. We also ensure the server is
closing the inventory reliably so we get the events. Additionally this
commit also calls the event when a player disconnects which will handle
kicks, quits, and server shutdown.
2013-05-02 06:28:51 -05:00
Score_Under
75641a607e Move world generator warning to CraftBukkit. Fixes BUKKIT-2565 2013-04-30 17:09:04 -07:00
Travis Watkins
f08081c77d Always process movement for vehicles and passengers. Fixes BUKKIT-4142
As an optimization we don't do any movement processing on entities that
have not moved. However, players in minecarts trigger this condition when
the minecart is moving on its own. This causes issues with things that rely
on player collision like tripwires. To correct this and any future related
issues we always handle movement for passengers and their vehicles even
if one of the two hasn't moved since they are linked.
2013-04-30 01:21:04 -05:00
Travis Watkins
2715e43305 Revert "Add delay to hopper even if it doesn't do anything."
This reverts commit f5388e8f94e2cbab76c2255fd872c289e83100a0.
2013-04-27 10:42:25 -05:00
Travis Watkins
3bbfb41798 Fix things using wall time running too fast. Fixes BUKKIT-4155
When converting things in Minecraft to use wall time instead of ticks I
realized we'd run into integer division rounding issues and could have
updates that end up counting as zero ticks. To compensate for this the
code ensures we always process at least one tick. However, every time we
end up with zero ticks the next time we have an extra tick due to rounding
the other way with the leftovers. This means we are going far too fast and
should not have this at least one tick logic at all.

On top of this some potions rely on the number of ticks they run and not
just the amount of time they last and so potions were put back to running
with ticks entirely.
2013-04-27 10:42:25 -05:00
Travis Watkins
799779e4b1 Update CraftBukkit to Minecraft 1.5.2 2013-04-27 10:42:19 -05:00
Wesley Wolfe
83c3aa188b Rework EntityExplodeEvent. Fixes BUKKIT-4140. Adds BUKKIT-4141 2013-04-24 03:03:38 -05:00
Travis Watkins
708b0e6ae1 Don't do physics updates in world generation. Fixes BUKKIT-3747 2013-04-16 07:09:32 -05:00
Mike Primm
40e6308718 Validate chunk data array lengths. Fixes BUKKIT-4093
If a chunk has somehow managed to save with arrays that are not 4096
entries long when reading them again we will get exceptions. Checking the
array length and resizing if needed is cheap so we should do this to help
avoid crashing servers due to this error.
2013-04-15 22:50:20 -05:00
Travis Watkins
928e4d9bbb When moving a misplaced chunk move tile entities too. Fixes BUKKIT-4092
When a chunk is being loaded the server checks to ensure the chunk's idea
of where it is located matches where it was located in the region file. If
these two values do not match the chunk's idea of its position is updated
and the chunk is reloaded. In vanilla minecraft this loading involves the
chunk's tile entities as well. With the change to loading player chunks
asynchronously we split loading tile entities to a separate step that takes
place after this check. Because of this tile entities are loaded with
invalid locations that result in trying to fetch block data from negative
or too large positions in the chunk's internal block storage arrays.

Because loading the tile entities is not thread safe we cannot return to
vanilla behavior here. Instead when we detect a misplaced chunk we just
edit the NBT data for the chunk to relocate the tile entities. This results
in them moving correctly with the chunk without having to actually load
them first.
2013-04-15 22:49:54 -05:00
GJ
0ab14dbaad Make Slimes fire EntityTarget events. Fixes BUKKIT-1408 2013-04-15 20:03:22 -07:00
Travis Watkins
c3cf8a435b Don't apply fall damage when cancelled. Fixes BUKKIT-4065 2013-04-13 01:03:08 -05:00
Travis Watkins
8590492680 Add delay to hopper even if it doesn't do anything. Fixes BUKKIT-4061
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.
2013-04-13 00:36:35 -05:00
riking
5cc4fbd712 Perform anvil calculations when using 1.5 drop feature.
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.
2013-04-13 00:31:20 -05:00
Travis Watkins
1c18834b7d Use wall time instead of ticks for several things. Fixes BUKKIT-4059
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.
2013-04-13 00:31:08 -05:00
Travis Watkins
94f43d8c36 Add MobEffect from mc-dev for diff visibility 2013-04-13 00:30:56 -05:00
Travis Watkins
a2d9f33ca3 Various minor performance improvements
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.
2013-04-13 00:30:43 -05:00
Travis Watkins
159d614a3a Correct vehicle movement issues. Fixes BUKKIT-2993, BUKKIT-4056
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.
2013-04-13 00:30:30 -05:00
Travis Watkins
ce5b97ea83 Fetch tile entities from chunks instead of world. Fixes BUKKIT-4055
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.
2013-04-13 00:30:16 -05:00
Travis Watkins
70a778f475 Boats can only die once.
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.
2013-04-13 00:29:49 -05:00
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
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