diff options
Diffstat (limited to 'patches/server/0780-Fix-Bukkit-NamespacedKey-shenanigans.patch')
-rw-r--r-- | patches/server/0780-Fix-Bukkit-NamespacedKey-shenanigans.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/server/0780-Fix-Bukkit-NamespacedKey-shenanigans.patch b/patches/server/0780-Fix-Bukkit-NamespacedKey-shenanigans.patch new file mode 100644 index 0000000000..8f152dd0e7 --- /dev/null +++ b/patches/server/0780-Fix-Bukkit-NamespacedKey-shenanigans.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke <[email protected]> +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 ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java +@@ -13,7 +13,7 @@ public final class CraftNamespacedKey { + return null; + } + ResourceLocation minecraft = ResourceLocation.tryParse(string); +- return (minecraft == null) ? null : CraftNamespacedKey.fromMinecraft(minecraft); ++ return (minecraft == null || minecraft.getPath().isEmpty()) ? null : CraftNamespacedKey.fromMinecraft(minecraft); // Paper - Bukkit's parser does not match Vanilla for empty paths + } + + public static NamespacedKey fromString(String string) { |