mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 12:12:08 -07:00
Add ItemStack#isEmpty and related methods (#9664)
* Add new patches * Change from an EMPTY static var to a static method since ItemStack is mutable * Properly set nullability of return value * Move annotation changes to different patch * Send the Kotlin code back to where it came from * rebased --------- Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
@@ -592,6 +592,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
super(hopper);
|
||||
this.inventory = inventory;
|
||||
this.containerType = containerType;
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java
|
||||
@@ -0,0 +0,0 @@ public class InventoryClickEvent extends InventoryInteractEvent {
|
||||
*
|
||||
* @return the cursor ItemStack
|
||||
*/
|
||||
- @Nullable
|
||||
+ @NotNull // Paper - fix nullability
|
||||
public ItemStack getCursor() {
|
||||
return getView().getCursor();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||
@@ -795,6 +808,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
/**
|
||||
* Checks if the inventory contains any ItemStacks with the given
|
||||
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
@@ -0,0 +0,0 @@ public abstract class InventoryView {
|
||||
/**
|
||||
* Get the item on the cursor of one of the viewing players.
|
||||
*
|
||||
- * @return The item on the player's cursor, or null if they aren't holding
|
||||
- * one.
|
||||
+ * @return The item on the player's cursor, or an empty stack
|
||||
+ * if they aren't holding one.
|
||||
*/
|
||||
- @Nullable
|
||||
+ @NotNull // Paper - fix nullability
|
||||
public final ItemStack getCursor() {
|
||||
return getPlayer().getItemOnCursor();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
|
Reference in New Issue
Block a user