mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 19:28:03 +01:00
SPIGOT-7878: Server#getLootTable does not return null on invalid loot table
By: md_5 <git@md-5.net>
This commit is contained in:
parent
0916d51f5d
commit
ab921984fc
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue