3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/patches/server/0812-Make-some-itemstacks-nonnull.patch
Jake Potrebic 6a7fef0e4a
Allow entity effect changes off the main thread for worldgen (#8942)
* Allow entity effect modification off the main thread for worldgen

* squash all async catcher patches
2023-04-09 11:38:32 -07:00

29 Zeilen
1.8 KiB
Diff

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
index d6a228473ca6f425757683a4b17b035a53ab117f..8801d3f7ff6d2ff810f3e34a821dfb659c03f844 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
@@ -156,13 +156,13 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
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:
throw new IllegalArgumentException("Not implemented. This is a bug");
}