mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
57 lines
1.8 KiB
Diff
57 lines
1.8 KiB
Diff
From 409f5510dda42a7cfd18698436fc766df133c4e2 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index c76f423e..46c6d519 100644
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
|
|
@@ -16,6 +16,7 @@ import org.bukkit.event.entity.EntityPickupItemEvent;
|
|
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;
|
|
|
|
@@ -43,12 +44,34 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
|
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
|
|
}
|
|
|
|
@Override
|
|
--
|
|
2.13.0
|
|
|