From ab921984fce0570f22207dbc648d8e7a700b5047 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 24 Aug 2024 08:02:44 +1000 Subject: [PATCH] SPIGOT-7878: Server#getLootTable does not return null on invalid loot table By: md_5 --- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 117b47715e..e16de43eb4 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2492,7 +2492,10 @@ public final class CraftServer implements Server { Preconditions.checkArgument(key != null, "NamespacedKey key cannot be null"); ReloadableServerRegistries.b registry = getServer().reloadableRegistries(); - return new CraftLootTable(key, registry.getLootTable(CraftLootTable.bukkitKeyToMinecraft(key))); + return registry.lookup().lookup(Registries.LOOT_TABLE) + .flatMap((lookup) -> lookup.get(CraftLootTable.bukkitKeyToMinecraft(key))) + .map((holder) -> new CraftLootTable(key, holder.value())) + .orElse(null); } @Override