mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
0254c46a8b
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 09943450 Update SnakeYAML version 5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc 6f82b381 PR-788: Add getHand() to all relevant events CraftBukkit Changes: aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe 5329dd6fd PR-1107: Add getHand() to all relevant events 93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
48 lines
1.9 KiB
Diff
48 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerItemConsumeEvent.java
|
|
@@ -0,0 +0,0 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
|
|
private boolean isCancelled = false;
|
|
private ItemStack item;
|
|
private final EquipmentSlot hand;
|
|
+ @Nullable private ItemStack replacement; // Paper
|
|
|
|
/**
|
|
* @param player the player consuming
|
|
@@ -0,0 +0,0 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
|
|
return hand;
|
|
}
|
|
|
|
+ // 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;
|