From 1c5d13ab2ee4ed3b4014df257470cf39889789e5 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 7 May 2017 06:26:01 -0500 Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer diff --git a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java index dfba8163..fd97ea21 100644 --- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java @@ -11,6 +11,7 @@ import org.bukkit.event.HandlerList; public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); private final Item item; + private boolean flyAtPlayer = true; // Paper private boolean cancel = false; private final int remaining; @@ -38,12 +39,35 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable { return remaining; } + // Paper Start + /** + * Set if the item will fly at the player + *

Cancelling the event will set this value to false.

+ * + * @param flyAtPlayer True for item to fly at player + */ + public void setFlyAtPlayer(boolean flyAtPlayer) { + this.flyAtPlayer = flyAtPlayer; + } + + /** + * Gets if the item will fly at the player + * + * @return True if the item will fly at the player + */ + public boolean getFlyAtPlayer() { + return flyAtPlayer; + } + // Paper End + public boolean isCancelled() { return cancel; } public void setCancelled(boolean cancel) { this.cancel = cancel; + this.flyAtPlayer = !cancel; // Paper } @Override -- 2.11.0