diff options
Diffstat (limited to 'Spigot-API-Patches-Unmapped/0027-Custom-replacement-for-eaten-items.patch')
-rw-r--r-- | Spigot-API-Patches-Unmapped/0027-Custom-replacement-for-eaten-items.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Spigot-API-Patches-Unmapped/0027-Custom-replacement-for-eaten-items.patch b/Spigot-API-Patches-Unmapped/0027-Custom-replacement-for-eaten-items.patch new file mode 100644 index 0000000000..94ff9d88e2 --- /dev/null +++ b/Spigot-API-Patches-Unmapped/0027-Custom-replacement-for-eaten-items.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jedediah Smith <[email protected]> +Date: Sun, 21 Jun 2015 15:05:21 -0400 +Subject: [PATCH] Custom replacement for eaten items + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java +index c2793f3ef01c1246c130971c17e1c2bf8f551435..373f4b5b5185aa81ff728da89c9cc4e0ccf87889 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java +@@ -22,6 +22,7 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean isCancelled = false; + private ItemStack item; ++ @Nullable private ItemStack replacement; // Paper + + /** + * @param player the player consuming +@@ -58,6 +59,29 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable { + } + } + ++ // Paper start ++ /** ++ * Return the custom item stack that will replace the consumed item, or null if no ++ * custom replacement has been set (which means the default replacement will be used). ++ * ++ * @return The custom item stack that will replace the consumed item or null ++ */ ++ @Nullable ++ public ItemStack getReplacement() { ++ return this.replacement; ++ } ++ ++ /** ++ * Set a custom item stack to replace the consumed item. Pass null to clear any custom ++ * stack that has been set and use the default replacement. ++ * ++ * @param replacement Replacement item to set, null to clear any custom stack and use default ++ */ ++ public void setReplacement(@Nullable ItemStack replacement) { ++ this.replacement = replacement; ++ } ++ // Paper end ++ + @Override + public boolean isCancelled() { + return this.isCancelled; |