mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
74 lines
2.1 KiB
Diff
74 lines
2.1 KiB
Diff
From 520632fdade49977988e20c07bd90d360f86418a Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Thu, 18 Jun 2020 23:29:43 -0500
|
|
Subject: [PATCH] Add PrepareGrindstoneEvent
|
|
|
|
---
|
|
.../inventory/PrepareGrindstoneEvent.java | 54 +++++++++++++++++++
|
|
1 file changed, 54 insertions(+)
|
|
create mode 100644 src/main/java/net/pl3x/purpur/event/inventory/PrepareGrindstoneEvent.java
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/net/pl3x/purpur/event/inventory/PrepareGrindstoneEvent.java
|
|
new file mode 100644
|
|
index 000000000..d0670bb72
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/event/inventory/PrepareGrindstoneEvent.java
|
|
@@ -0,0 +1,54 @@
|
|
+package net.pl3x.purpur.event.inventory;
|
|
+
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.inventory.InventoryEvent;
|
|
+import org.bukkit.inventory.GrindstoneInventory;
|
|
+import org.bukkit.inventory.InventoryView;
|
|
+import org.bukkit.inventory.ItemStack;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+/**
|
|
+ * Called when an item is put in a grindstone slot.
|
|
+ */
|
|
+public class PrepareGrindstoneEvent extends InventoryEvent {
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private ItemStack result;
|
|
+
|
|
+ public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
|
+ super(inventory);
|
|
+ this.result = result;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public GrindstoneInventory getInventory() {
|
|
+ return (GrindstoneInventory) super.getInventory();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Get result item, may be null.
|
|
+ *
|
|
+ * @return result item
|
|
+ */
|
|
+ @Nullable
|
|
+ public ItemStack getResult() {
|
|
+ return result;
|
|
+ }
|
|
+
|
|
+ public void setResult(@Nullable ItemStack result) {
|
|
+ this.result = result;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
--
|
|
2.26.2
|
|
|