2016-03-30 05:57:56 +00:00
|
|
|
From 9ffd06f684daada133fc1b90cc983c8598a6e328 Mon Sep 17 00:00:00 2001
|
2016-03-19 16:57:19 +00:00
|
|
|
From: Jedediah Smith <jedediah@silencegreys.com>
|
|
|
|
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 8ab76b1..42aad88 100644
|
|
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java
|
|
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java
|
|
|
|
@@ -20,6 +20,7 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
private boolean isCancelled = false;
|
|
|
|
private ItemStack item;
|
|
|
|
+ private ItemStack replacement; // Paper
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param player the player consuming
|
|
|
|
@@ -55,6 +56,24 @@ 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).
|
|
|
|
+ */
|
|
|
|
+ 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.
|
|
|
|
+ */
|
|
|
|
+ public void setReplacement(ItemStack replacement) {
|
|
|
|
+ this.replacement = replacement;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public boolean isCancelled() {
|
|
|
|
return this.isCancelled;
|
|
|
|
}
|
|
|
|
--
|
2016-03-30 05:57:56 +00:00
|
|
|
2.8.0
|
2016-03-19 16:57:19 +00:00
|
|
|
|