-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
Environment:
Debian GNU/Linux 11 (bullseye) x86_64 5.10.0-23-amd64
Intel i5-6600K (4) @ 3.900GHz
-
This server is running CraftBukkit version 4295-Spigot-ca58122-7548afc (MC: 1.21.1) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
-
Yes
Server.getLootTable(NamespacedKey) should return null when given a key for a non-existent loot table, but returns a non-null object instead.
This behavior contradicts documentation outlined here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Server.html#getLootTable(org.bukkit.NamespacedKey)
import org.bukkit.NamespacedKey; import org.bukkit.loot.LootTable; import org.bukkit.plugin.java.JavaPlugin; public final class SamplePlugin extends JavaPlugin { @Override public void onEnable() { final LootTable lt = getServer().getLootTable(NamespacedKey.fromString("asdf:hnu9awdfhaw9uh")); getLogger().info("" + lt); } }
Expected Output:
[17:47:28] [Server thread/INFO]: [SamplePlugin] null
Actual Output:
[17:47:28] [Server thread/INFO]: [SamplePlugin] asdf:hnu9awdfhaw9uh