[SPIGOT-7878] Server.getLootTable does not return null on invalid loot table Created: 23/Aug/24 Updated: 25/Dec/24 Resolved: 23/Aug/24 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | FullPotato | Assignee: | md_5 |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | API, Spigot | ||
| Environment: |
Debian GNU/Linux 11 (bullseye) x86_64 5.10.0-23-amd64 Intel i5-6600K (4) @ 3.900GHz |
||
| Attachments: |
|
| Version: | This server is running CraftBukkit version 4295-Spigot-ca58122-7548afc (MC: 1.21.1) (Implementing API version 1.21.1-R0.1-SNAPSHOT) |
| Guidelines Read: | Yes |
| Description |
|
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 |