aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0455-Add-CartographyItemEvent.patch
blob: 8bfd237e0ccffc6484fdd9cd89f18a1f61223529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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..d5c67f5462b9011683ce742a197959f9c4380d40
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java
@@ -0,0 +1,32 @@
+package io.papermc.paper.event.player;
+
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.event.inventory.InventoryAction;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.inventory.InventoryType;
+import org.bukkit.inventory.CartographyInventory;
+import org.bukkit.inventory.InventoryView;
+import org.jetbrains.annotations.ApiStatus;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Called when the recipe of an Item is completed inside a cartography table.
+ */
+@NullMarked
+public class CartographyItemEvent extends InventoryClickEvent {
+
+    @ApiStatus.Internal
+    public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action) {
+        super(view, type, slot, click, action);
+    }
+
+    @ApiStatus.Internal
+    public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action, final int key) {
+        super(view, type, slot, click, action, key);
+    }
+
+    @Override
+    public CartographyInventory getInventory() {
+        return (CartographyInventory) super.getInventory();
+    }
+}