2022-03-16 16:57:51 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Tue, 15 Mar 2022 01:38:15 -0700
|
|
|
|
Subject: [PATCH] Make some itemstacks nonnull
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
|
2024-10-24 19:29:35 +02:00
|
|
|
index 107fa1d4bd977d17dc062da280dda46eb3c5f81c..e62baea16df017f1e394e3c706157e158066eb93 100644
|
2022-03-16 16:57:51 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
|
2023-06-13 01:51:45 +02:00
|
|
|
@@ -155,13 +155,13 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
|
2022-03-16 16:57:51 +01:00
|
|
|
case OFF_HAND:
|
|
|
|
return this.getItemInOffHand();
|
|
|
|
case FEET:
|
|
|
|
- return this.getBoots();
|
|
|
|
+ return java.util.Objects.requireNonNullElseGet(this.getBoots(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
|
|
|
|
case LEGS:
|
|
|
|
- return this.getLeggings();
|
|
|
|
+ return java.util.Objects.requireNonNullElseGet(this.getLeggings(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
|
|
|
|
case CHEST:
|
|
|
|
- return this.getChestplate();
|
|
|
|
+ return java.util.Objects.requireNonNullElseGet(this.getChestplate(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
|
|
|
|
case HEAD:
|
|
|
|
- return this.getHelmet();
|
|
|
|
+ return java.util.Objects.requireNonNullElseGet(this.getHelmet(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
|
|
|
|
default:
|
2024-10-24 19:29:35 +02:00
|
|
|
throw new IllegalArgumentException("Could not get slot " + slot + " - not a valid slot for PlayerInventory");
|
2022-03-16 16:57:51 +01:00
|
|
|
}
|