Fix Nullability Annotations for PrepareItemEnchantEvent (#7681)

This commit is contained in:
Peter Crawley 2022-04-02 04:14:56 +01:00
parent 98451ad73f
commit 2e9ebc6ff4

View file

@ -106,6 +106,15 @@ diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
+++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
@@ -0,0 +0,0 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
private boolean cancelled;
private final Player enchanter;
- public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @NotNull final EnchantmentOffer[] offers, final int bonus) {
+ public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @org.jetbrains.annotations.Nullable final EnchantmentOffer @NotNull [] offers, final int bonus) { // Paper - offers can contain null values
super(view);
this.enchanter = enchanter;
this.table = table;
@@ -0,0 +0,0 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
* @return experience level costs offered
* @deprecated Use {@link #getOffers()} instead of this method
@ -114,6 +123,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@NotNull
public int[] getExpLevelCostsOffered() {
int[] levelOffers = new int[offers.length];
@@ -0,0 +0,0 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
*
* @return list of available enchantment offers
*/
- @NotNull
- public EnchantmentOffer[] getOffers() {
+ public @org.jetbrains.annotations.Nullable EnchantmentOffer @NotNull [] getOffers() { // Paper offers can contain null values
return offers;
}
diff --git a/src/main/java/org/bukkit/inventory/CraftingInventory.java b/src/main/java/org/bukkit/inventory/CraftingInventory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/CraftingInventory.java