PaperMC/Spigot-API-Patches/0053-PlayerPickupItemEvent-setFlyAtPlayer.patch
Shane Freeder 0976d52bbd Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Please note that this build includes changes to meet upstreams
requirements for nullability annotations. While we aim for a level of
accuracy, these might not be 100% correct, if there are any issues,
please speak to us on discord, or open an issue on the tracker to
discuss.

Bukkit Changes:
9a6a1de3 Remove nullability annotations from enum constructors
3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API

CraftBukkit Changes:
8d8475fc SPIGOT-4666: Force parameter in HumanEntity#sleep
8b1588e2 Fix ExplosionPrimeEvent#setFire not working with EnderCrystals
39a287b7 Don't ignore newlines in PlayerListHeader/Footer

Spigot Changes:
cf694d87 Add nullability annotations
2019-03-20 00:31:18 +00:00

56 lines
1.8 KiB
Diff

From bfb751c0cc1a9b5d9e913c1334d2fd5b67045402 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 c7599116..5777d380 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerPickupItemEvent.java
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
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;
@@ -45,12 +46,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
}
@NotNull
--
2.21.0