Paper/patches/api/0246-Add-PlayerFlowerPotManipulateEvent.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
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
2022-10-02 09:56:36 +02:00

95 Zeilen
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com>
Date: Tue, 13 Aug 2019 19:44:19 -0700
Subject: [PATCH] Add PlayerFlowerPotManipulateEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..4c141f3d8f668cdf9c75865a8e3ecbd012d9e521
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java
@@ -0,0 +1,82 @@
+package io.papermc.paper.event.player;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a player places an item in or takes an item out of a flowerpot.
+ */
+public class PlayerFlowerPotManipulateEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ private final Block flowerpot;
+ @NotNull
+ private final ItemStack item;
+ private final boolean placing;
+
+ private boolean cancel = false;
+
+ public PlayerFlowerPotManipulateEvent(@NotNull final Player player, @NotNull final Block flowerpot, @NotNull final ItemStack item, final boolean placing) {
+ super(player);
+ this.flowerpot = flowerpot;
+ this.item = item;
+ this.placing = placing;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ /**
+ * Gets the flowerpot that is involved in this event.
+ *
+ * @return the flowerpot that is involved with this event
+ */
+ @NotNull
+ public Block getFlowerpot() {
+ return flowerpot;
+ }
+
+ /**
+ * Gets the item being placed, or taken from, the flower pot.
+ * Check if placing with {@link #isPlacing()}.
+ *
+ * @return the item placed, or taken from, the flowerpot
+ */
+ @NotNull
+ public ItemStack getItem() {
+ return item;
+ }
+
+ /**
+ * Gets if the item is being placed into the flowerpot.
+ *
+ * @return if the item is being placed into the flowerpot
+ */
+ public boolean isPlacing() {
+ return placing;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}