2019-03-20 01:28:15 +01:00
|
|
|
From bfb751c0cc1a9b5d9e913c1334d2fd5b67045402 Mon Sep 17 00:00:00 2001
|
2017-06-12 02:43:59 +02:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
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
|
2019-03-20 01:28:15 +01:00
|
|
|
index c7599116..5777d380 100644
|
2017-06-12 02:43:59 +02:00
|
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
|
|
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
2017-06-12 02:43:59 +02:00
|
|
|
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;
|
|
|
|
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -45,12 +46,34 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
2017-06-12 02:43:59 +02:00
|
|
|
return remaining;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper Start
|
|
|
|
+ /**
|
|
|
|
+ * Set if the item will fly at the player
|
|
|
|
+ * <p>Cancelling the event will set this value to false.</p>
|
|
|
|
+ *
|
|
|
|
+ * @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
|
|
|
|
}
|
|
|
|
|
2019-03-20 01:28:15 +01:00
|
|
|
@NotNull
|
2017-06-12 02:43:59 +02:00
|
|
|
--
|
2019-03-20 01:28:15 +01:00
|
|
|
2.21.0
|
2017-06-12 02:43:59 +02:00
|
|
|
|