Updated Upstream (Bukkit/CraftBukkit) (#8663)

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:
f50ad1f8 PR-798: Add PrepareGrindstoneEvent and refactor related events to use PrepareInventoryResultEvent
0cac7963 SPIGOT-7204: Add TeleportCause#DISMOUNT
b4dd47b0 SPIGOT-7202: Deprecate removed door effects

CraftBukkit Changes:
ab1586c2f PR-1123: Add PrepareGrindstoneEvent
b402824ea SPIGOT-7204: Add TeleportCause#DISMOUNT
06a6a1012 PR-1121: Add unit test for spawn egg meta
c18668be3 SPIGOT-7192: Call PlayerInteractEvent with Action.LEFT_CLICK_AIR if the entity interacted is hidden to the player
47124f639 Increase outdated build delay
645993470 SPIGOT-7201: Spawner ItemMeta not working as expected
This commit is contained in:
Jake Potrebic 2022-12-13 21:03:57 -08:00
parent e849888abb
commit a4112a5c50
9 changed files with 114 additions and 116 deletions

View file

@ -17,8 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.event.inventory; +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.GrindstoneInventory;
+import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.InventoryView;
+import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ItemStack;
@ -27,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+/** +/**
+ * Called when an item is put in a slot for grinding in a Grindstone + * Called when an item is put in a slot for grinding in a Grindstone
+ * @see com.destroystokyo.paper.event.inventory.PrepareResultEvent + * @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent}
+ */ + */
+@Deprecated +@Deprecated
+public class PrepareGrindstoneEvent extends PrepareResultEvent { +public class PrepareGrindstoneEvent extends PrepareResultEvent {
@ -51,9 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.event.inventory; +package com.destroystokyo.paper.event.inventory;
+ +
+import org.bukkit.event.HandlerList; +import org.bukkit.event.inventory.PrepareInventoryResultEvent;
+import org.bukkit.event.inventory.InventoryEvent;
+import org.bukkit.event.inventory.InventoryType;
+import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.InventoryView;
+import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull;
@ -62,14 +58,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+/** +/**
+ * Called when an item is put in an inventory containing a result slot + * Called when an item is put in an inventory containing a result slot
+ */ + */
+public class PrepareResultEvent extends InventoryEvent { +public class PrepareResultEvent extends PrepareInventoryResultEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ private ItemStack result;
+ +
+ // HandlerList on PrepareInventoryResultEvent to ensure api compat
+ public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { + public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
+ super(inventory); + super(inventory, result);
+ this.result = result;
+ } + }
+ +
+ /** + /**
@ -79,133 +72,125 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ @Nullable + @Nullable
+ public ItemStack getResult() { + public ItemStack getResult() {
+ return result; + return super.getResult();
+ } + }
+ +
+ /**
+ * Set result item, may be null.
+ *
+ * @param result result item
+ */
+ public void setResult(@Nullable ItemStack result) { + public void setResult(@Nullable ItemStack result) {
+ this.result = result; + super.setResult(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 diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java --- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
@@ -0,0 +0,0 @@
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;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Called when an item is put in a slot for repair by an anvil. * Called when an item is put in a slot for repair by an anvil.
*/ */
-public class PrepareAnvilEvent extends InventoryEvent { -public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
+// Paper start - extend PrepareResultEvent +public class PrepareAnvilEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent {
+public class PrepareAnvilEvent extends PrepareResultEvent {
- private static final HandlerList handlers = new HandlerList(); - private static final HandlerList handlers = new HandlerList();
- private ItemStack result; + // Paper - move HandlerList to PrepareInventoryResultEvent
+ //private static final HandlerList handlers = new HandlerList();
+ //private ItemStack result;
public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
- super(inventory); super(inventory, result);
- this.result = result; @@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
+ super(inventory, result); return (AnvilInventory) super.getInventory();
+ //this.result = result;
+ // Paper end
} }
@NotNull - @NotNull
@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends InventoryEvent { - @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ // Paper - move HandlerList to PrepareInventoryResultEvent
}
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
/**
* Called when an item is put in a slot for repair or unenchanting in a grindstone.
*/ */
@Nullable -public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent {
public ItemStack getResult() { +public class PrepareGrindstoneEvent extends com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent { // Paper
- return result;
+ return super.getResult(); // Paper - private static final HandlerList handlers = new HandlerList();
+ // Paper - move HandlerList to PrepareInventoryResultEvent
public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
super(inventory, result);
@@ -0,0 +0,0 @@ public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent {
return (GrindstoneInventory) super.getInventory();
} }
public void setResult(@Nullable ItemStack result) { - @NotNull
- this.result = result; - @Override
+ super.setResult(result); // Paper - public HandlerList getHandlers() {
- return handlers;
- }
-
- @NotNull
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ // Paper - move HandlerList to PrepareInventoryResultEvent
} }
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
+ /* // Paper - comment out /**
@NotNull * Called when an item is put in a slot and the result is calculated.
@Override + * @deprecated use {@link com.destroystokyo.paper.event.inventory.PrepareResultEvent}
public HandlerList getHandlers() { */
@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends InventoryEvent { +@Deprecated // Paper
public static HandlerList getHandlerList() { public class PrepareInventoryResultEvent extends InventoryEvent {
return handlers;
} private static final HandlerList handlers = new HandlerList();
+ */ // Paper
}
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java --- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
@@ -0,0 +0,0 @@
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;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Called when an item is put in a slot for upgrade by a Smithing Table. * Called when an item is put in a slot for upgrade by a Smithing Table.
*/ */
-public class PrepareSmithingEvent extends InventoryEvent { -public class PrepareSmithingEvent extends PrepareInventoryResultEvent {
+// Paper start - extend PrepareResultEvent +public class PrepareSmithingEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent {
+public class PrepareSmithingEvent extends PrepareResultEvent {
- private static final HandlerList handlers = new HandlerList(); - private static final HandlerList handlers = new HandlerList();
- private ItemStack result; + // Paper - move HandlerList ot PrepareInventoryResultEvent
+ //private static final HandlerList handlers = new HandlerList();
+ //private ItemStack result;
public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
- super(inventory); super(inventory, result);
- this.result = result; @@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent {
+ super(inventory, result); return (SmithingInventory) super.getInventory();
+ //this.result = result;
+ // Paper end
} }
@NotNull - @NotNull
@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent { - @Override
*/ - public HandlerList getHandlers() {
@Nullable - return handlers;
public ItemStack getResult() { - }
- return result; -
+ return super.getResult(); // Paper - @NotNull
} - public static HandlerList getHandlerList() {
- return handlers;
public void setResult(@Nullable ItemStack result) { - }
- this.result = result; + // Paper - move HandlerList to PrepareInventoryResultEvent
+ super.setResult(result); // Paper
}
+ /* // Paper - comment out
@NotNull
@Override
public HandlerList getHandlers() {
@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent {
public static HandlerList getHandlerList() {
return handlers;
}
+ */ // Paper
} }

View file

@ -107,13 +107,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - disable this method, handled below + // Paper start - disable this method, handled below
+ public static void callPrepareAnvilEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult + public static void callPrepareAnvilEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult
+ PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone + PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
+ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // disable event + //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event
event.getInventory().setItem(2, event.getResult()); event.getInventory().setItem(2, event.getResult());
- return event; - return event;
+ //return event; // Paper + //return event; // Paper
} }
+ // Paper end + // Paper end
- public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
- PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone());
- event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
+ // Paper start - disable this method, handled below
+ public static void callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
+ PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
+ // event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event
event.getInventory().setItem(2, event.getResult());
- return event;
+ // return event; // Paper
}
+ // Paper end
- public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) { - public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) {
- PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item).clone()); - PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item).clone());
- event.getView().getPlayer().getServer().getPluginManager().callEvent(event); - event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
@ -136,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (view.getTopInventory() instanceof org.bukkit.inventory.AnvilInventory) { + if (view.getTopInventory() instanceof org.bukkit.inventory.AnvilInventory) {
+ event = new PrepareAnvilEvent(view, result); + event = new PrepareAnvilEvent(view, result);
+ } else if (view.getTopInventory() instanceof org.bukkit.inventory.GrindstoneInventory) { + } else if (view.getTopInventory() instanceof org.bukkit.inventory.GrindstoneInventory) {
+ event = new com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent(view, result); + event = new PrepareGrindstoneEvent(view, result);
+ } else if (view.getTopInventory() instanceof org.bukkit.inventory.SmithingInventory) { + } else if (view.getTopInventory() instanceof org.bukkit.inventory.SmithingInventory) {
+ event = new PrepareSmithingEvent(view, result); + event = new PrepareSmithingEvent(view, result);
+ } else { + } else {

View file

@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -3); deadline.add(Calendar.DAY_OF_YEAR, -7);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

View file

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity()); org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity));
- if (result == null) { - if (result == null) {
+ if (result == null || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode + if (result == null || this.player.gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { // Paper - call PlayerInteractEvent when left-clicking on a block in adventure mode

View file

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main { @@ -0,0 +0,0 @@ public class Main {
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -3); deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
- System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Error, this build is outdated ***");
+ // Paper start - This is some stupid bullshit + // Paper start - This is some stupid bullshit

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!itemstack2.isDamageableItem()) { if (!itemstack2.isDamageableItem()) {
- if (!ItemStack.matches(itemstack, itemstack1)) { - if (!ItemStack.matches(itemstack, itemstack1)) {
+ if (!ItemStack.matches(itemstack, itemstack1) || (itemstack2.getMaxStackSize() == 1 && !io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking)) { // Paper - add max stack size check & config value + if (!ItemStack.matches(itemstack, itemstack1) || (itemstack2.getMaxStackSize() == 1 && !io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking)) { // Paper - add max stack size check & config value
this.resultSlots.setItem(0, ItemStack.EMPTY); org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(this.getBukkitView(), ItemStack.EMPTY); // CraftBukkit
this.broadcastChanges(); this.broadcastChanges();
return; return;
} }

View file

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main { @@ -0,0 +0,0 @@ public class Main {
deadline.add(Calendar.DAY_OF_YEAR, -3); deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Error, this build is outdated ***");
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

@ -1 +1 @@
Subproject commit dea9ce0a799f48e90e17e0f8c3db89bfb7cda3cd Subproject commit f50ad1f8b307cda71968d3f53921ab29d1e5835a

@ -1 +1 @@
Subproject commit 4fa7e1c31d8f2b8dd3ec002563f11c4136f15491 Subproject commit ab1586c2fb5fa7a381e6191e1137acc69aeebbf2