From e22a1a9d053a8f3cf56f62ef1749434a398e4a57 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 17 Nov 2021 10:53:41 +0100 Subject: [PATCH] Fix more namespacedkey parsing (#6903) --- ...Fix-Bukkit-NamespacedKey-shenanigans.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/patches/server/0837-Fix-Bukkit-NamespacedKey-shenanigans.patch b/patches/server/0837-Fix-Bukkit-NamespacedKey-shenanigans.patch index dba489e79c..8f152dd0e7 100644 --- a/patches/server/0837-Fix-Bukkit-NamespacedKey-shenanigans.patch +++ b/patches/server/0837-Fix-Bukkit-NamespacedKey-shenanigans.patch @@ -4,6 +4,32 @@ Date: Sun, 24 Oct 2021 15:49:35 +0200 Subject: [PATCH] Fix Bukkit NamespacedKey shenanigans +diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java +index 6d2e0493729b7b4e109ff103a6ac36c9901568c0..83dd3c254fd10e4596e454cc75c8e5e976b73ac0 100644 +--- a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java ++++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java +@@ -16,7 +16,7 @@ public class PaperMinecartLootableInventory implements PaperLootableEntityInvent + + @Override + public org.bukkit.loot.LootTable getLootTable() { +- return entity.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; ++ return entity.lootTable != null && !entity.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; + } + + @Override +diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java +index 3377b86c337d0234bbb9b0349e4034a7cd450a97..94dc68182ec5f6dc1294ad15523427836228086a 100644 +--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java ++++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java +@@ -15,7 +15,7 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven + + @Override + public org.bukkit.loot.LootTable getLootTable() { +- return tileEntityLootable.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null; ++ return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null; + } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java index 5f40d240b879e3989897b6e45725a8e5a6a7f194..5014192edb9616ce725fc1592832034789527b6f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java