2019-06-14 04:27:40 +02:00
|
|
|
From 86d616000511cc1aeed2f8a4870f13de4abad628 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-06-06 17:36:57 +02:00
|
|
|
index 951ea2cc7..18d82c111 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-05-06 04:58:04 +02:00
|
|
|
@@ -45,6 +46,27 @@ 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
|
|
|
|
+
|
2019-05-06 04:58:04 +02:00
|
|
|
@Override
|
2017-06-12 02:43:59 +02:00
|
|
|
public boolean isCancelled() {
|
|
|
|
return cancel;
|
2019-05-06 04:58:04 +02:00
|
|
|
@@ -53,6 +75,7 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
|
|
|
@Override
|
2017-06-12 02:43:59 +02:00
|
|
|
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
|
|
|
|