Commits

Martoph authored and md_5 committed d264e972e9f
#591: Add option for a consumer before spawning an item
No tags

src/main/java/org/bukkit/World.java

Modified
464 464 /**
465 465 * Drops an item at the specified {@link Location}
466 466 *
467 467 * @param location Location to drop the item
468 468 * @param item ItemStack to drop
469 469 * @return ItemDrop entity created as a result of this method
470 470 */
471 471 @NotNull
472 472 public Item dropItem(@NotNull Location location, @NotNull ItemStack item);
473 473
474 + /**
475 + * Drops an item at the specified {@link Location}
476 + * Note that functions will run before the entity is spawned
477 + *
478 + * @param location Location to drop the item
479 + * @param item ItemStack to drop
480 + * @param function the function to be run before the entity is spawned.
481 + * @return ItemDrop entity created as a result of this method
482 + */
483 + @NotNull
484 + public Item dropItem(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<Item> function);
485 +
474 486 /**
475 487 * Drops an item at the specified {@link Location} with a random offset
476 488 *
477 489 * @param location Location to drop the item
478 490 * @param item ItemStack to drop
479 491 * @return ItemDrop entity created as a result of this method
480 492 */
481 493 @NotNull
482 494 public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item);
483 495
496 + /**
497 + * Drops an item at the specified {@link Location} with a random offset
498 + * Note that functions will run before the entity is spawned
499 + *
500 + * @param location Location to drop the item
501 + * @param item ItemStack to drop
502 + * @param function the function to be run before the entity is spawned.
503 + * @return ItemDrop entity created as a result of this method
504 + */
505 + @NotNull
506 + public Item dropItemNaturally(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<Item> function);
507 +
484 508 /**
485 509 * Creates an {@link Arrow} entity at the given {@link Location}
486 510 *
487 511 * @param location Location to spawn the arrow
488 512 * @param direction Direction to shoot the arrow in
489 513 * @param speed Speed of the arrow. A recommend speed is 0.6
490 514 * @param spread Spread of the arrow. A recommend spread is 12
491 515 * @return Arrow entity spawned as a result of this method
492 516 */
493 517 @NotNull

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut