Paper/Spigot-API-Patches/0035-Arrow-pickup-rule-API.patch
2017-01-20 05:21:44 -06:00

55 lines
1.6 KiB
Diff

From 17223e9ba60ecfb981e037bcc62018b428d71808 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Fri, 4 Mar 2016 03:13:18 -0500
Subject: [PATCH] Arrow pickup rule API
diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java
index 1ff0951..da4678d 100644
--- a/src/main/java/org/bukkit/entity/Arrow.java
+++ b/src/main/java/org/bukkit/entity/Arrow.java
@@ -72,6 +72,40 @@ public interface Arrow extends Projectile {
CREATIVE_ONLY
}
+ // Paper start
+ /**
+ * Gets the {@link PickupRule} for this arrow.
+ *
+ * <p>This is generally {@link PickupRule#ALLOWED} only if the arrow was
+ * <b>not</b> fired from a bow with the infinity enchantment.</p>
+ *
+ * @return The pickup rule
+ * @deprecated Use {@link Arrow#getPickupStatus()} as an upstream compatible replacement for this function
+ */
+ @Deprecated
+ default PickupRule getPickupRule() {
+ return PickupRule.valueOf(this.getPickupStatus().name());
+ }
+
+ /**
+ * Set the rule for which players can pickup this arrow as an item.
+ *
+ * @param rule The pickup rule
+ * @deprecated Use {@link Arrow#setPickupStatus(PickupStatus)} with {@link PickupStatus} as an upstream compatible replacement for this function
+ */
+ @Deprecated
+ default void setPickupRule(PickupRule rule) {
+ this.setPickupStatus(PickupStatus.valueOf(rule.name()));
+ }
+
+ @Deprecated
+ enum PickupRule {
+ DISALLOWED,
+ ALLOWED,
+ CREATIVE_ONLY;
+ }
+ // Paper end
+
public class Spigot extends Entity.Spigot
{
--
2.9.3