Paper/patches/api/0465-Add-CartographyItemEvent.patch

45 lines
1.8 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Janet Blackquill <uhhadd@gmail.com>
Date: Sun, 7 Apr 2024 16:51:04 -0400
Subject: [PATCH] Add CartographyItemEvent
Similar to SmithItemEvent, but for cartography tables.
diff --git a/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..659b620696e5cc0784ed707c70876e4348897c7f
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java
@@ -0,0 +1,31 @@
+package io.papermc.paper.event.player;
+
+import org.bukkit.inventory.InventoryView;
+import org.bukkit.inventory.CartographyInventory;
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.event.inventory.InventoryType;
+import org.bukkit.event.inventory.InventoryAction;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Called when the recipe of an Item is completed inside a cartography table.
+ */
+public class CartographyItemEvent extends InventoryClickEvent {
+ @ApiStatus.Internal
+ public CartographyItemEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action) {
+ super(view, type, slot, click, action);
+ }
+
+ @ApiStatus.Internal
+ public CartographyItemEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action, int key) {
+ super(view, type, slot, click, action, key);
+ }
+
+ @NotNull
+ @Override
+ public CartographyInventory getInventory() {
+ return (CartographyInventory) super.getInventory();
+ }
+}