c97ce029e9
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason <jasonpenilla2@me.com> Co-authored-by: kashike <kashike@vq.lc> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: KennyTV <kennytv@t-online.de> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
211 lines
7.3 KiB
Diff
211 lines
7.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Fri, 3 Jul 2020 11:58:56 -0500
|
|
Subject: [PATCH] Add PrepareResultEvent / PrepareGrindstoneEvent
|
|
|
|
Adds a new event for all crafting stations that generate a result slot item
|
|
|
|
Anvil, Grindstone and Smithing now extend this event
|
|
|
|
Grindstone is a backwards compat from a previous PrepareGrindstoneEvent
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..449e8c06f8434b59d49a76481fa60c5c49e80579
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java
|
|
@@ -0,0 +1,28 @@
|
|
+package com.destroystokyo.paper.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 slot for grinding in a Grindstone
|
|
+ * @see com.destroystokyo.paper.event.inventory.PrepareResultEvent
|
|
+ */
|
|
+@Deprecated
|
|
+public class PrepareGrindstoneEvent extends PrepareResultEvent {
|
|
+
|
|
+ public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
|
+ super(inventory, result);
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public GrindstoneInventory getInventory() {
|
|
+ return (GrindstoneInventory) super.getInventory();
|
|
+ }
|
|
+
|
|
+}
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..045ce9ec3c9134aced5f5235b760ac85599d16c6
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java
|
|
@@ -0,0 +1,48 @@
|
|
+package com.destroystokyo.paper.event.inventory;
|
|
+
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.inventory.InventoryEvent;
|
|
+import org.bukkit.event.inventory.InventoryType;
|
|
+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 an inventory containing a result slot
|
|
+ */
|
|
+public class PrepareResultEvent extends InventoryEvent {
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private ItemStack result;
|
|
+
|
|
+ public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
|
+ super(inventory);
|
|
+ this.result = result;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * 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;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
|
|
index 77109a07f07aa6985106dc1a9ad5218f6c7f360f..f1f6f4ab4f81a3f21e757fef4a30b00e94371f8d 100644
|
|
--- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
|
|
@@ -1,5 +1,6 @@
|
|
package org.bukkit.event.inventory;
|
|
|
|
+import com.destroystokyo.paper.event.inventory.PrepareResultEvent;
|
|
import org.bukkit.event.HandlerList;
|
|
import org.bukkit.inventory.AnvilInventory;
|
|
import org.bukkit.inventory.InventoryView;
|
|
@@ -10,14 +11,16 @@ import org.jetbrains.annotations.Nullable;
|
|
/**
|
|
* Called when an item is put in a slot for repair by an anvil.
|
|
*/
|
|
-public class PrepareAnvilEvent extends InventoryEvent {
|
|
+// Paper start - extend PrepareResultEvent
|
|
+public class PrepareAnvilEvent extends PrepareResultEvent {
|
|
|
|
- private static final HandlerList handlers = new HandlerList();
|
|
- private ItemStack result;
|
|
+ //private static final HandlerList handlers = new HandlerList();
|
|
+ //private ItemStack result;
|
|
|
|
public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
|
- super(inventory);
|
|
- this.result = result;
|
|
+ super(inventory, result);
|
|
+ //this.result = result;
|
|
+ // Paper end
|
|
}
|
|
|
|
@NotNull
|
|
@@ -33,13 +36,14 @@ public class PrepareAnvilEvent extends InventoryEvent {
|
|
*/
|
|
@Nullable
|
|
public ItemStack getResult() {
|
|
- return result;
|
|
+ return super.getResult(); // Paper
|
|
}
|
|
|
|
public void setResult(@Nullable ItemStack result) {
|
|
- this.result = result;
|
|
+ super.setResult(result); // Paper
|
|
}
|
|
|
|
+ /* // Paper - comment out
|
|
@NotNull
|
|
@Override
|
|
public HandlerList getHandlers() {
|
|
@@ -50,4 +54,5 @@ public class PrepareAnvilEvent extends InventoryEvent {
|
|
public static HandlerList getHandlerList() {
|
|
return handlers;
|
|
}
|
|
+ */ // Paper
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
|
index 99af1540324c4d68c5890ac40b591c5cbdd2e870..0bc0ca4f96c800e9c46c61710f44446691d8b93f 100644
|
|
--- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
|
@@ -1,5 +1,6 @@
|
|
package org.bukkit.event.inventory;
|
|
|
|
+import com.destroystokyo.paper.event.inventory.PrepareResultEvent;
|
|
import org.bukkit.event.HandlerList;
|
|
import org.bukkit.inventory.InventoryView;
|
|
import org.bukkit.inventory.ItemStack;
|
|
@@ -10,14 +11,16 @@ import org.jetbrains.annotations.Nullable;
|
|
/**
|
|
* Called when an item is put in a slot for upgrade by a Smithing Table.
|
|
*/
|
|
-public class PrepareSmithingEvent extends InventoryEvent {
|
|
+// Paper start - extend PrepareResultEvent
|
|
+public class PrepareSmithingEvent extends PrepareResultEvent {
|
|
|
|
- private static final HandlerList handlers = new HandlerList();
|
|
- private ItemStack result;
|
|
+ //private static final HandlerList handlers = new HandlerList();
|
|
+ //private ItemStack result;
|
|
|
|
public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
|
- super(inventory);
|
|
- this.result = result;
|
|
+ super(inventory, result);
|
|
+ //this.result = result;
|
|
+ // Paper end
|
|
}
|
|
|
|
@NotNull
|
|
@@ -33,13 +36,14 @@ public class PrepareSmithingEvent extends InventoryEvent {
|
|
*/
|
|
@Nullable
|
|
public ItemStack getResult() {
|
|
- return result;
|
|
+ return super.getResult(); // Paper
|
|
}
|
|
|
|
public void setResult(@Nullable ItemStack result) {
|
|
- this.result = result;
|
|
+ super.setResult(result); // Paper
|
|
}
|
|
|
|
+ /* // Paper - comment out
|
|
@NotNull
|
|
@Override
|
|
public HandlerList getHandlers() {
|
|
@@ -50,4 +54,5 @@ public class PrepareSmithingEvent extends InventoryEvent {
|
|
public static HandlerList getHandlerList() {
|
|
return handlers;
|
|
}
|
|
+ */ // Paper
|
|
}
|