13
0
geforkt von Mirrors/Paper

Improve CreativeCategory conversion

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2022-03-19 09:59:56 +11:00
Ursprung 16d405ff1c
Commit ec402c4974

Datei anzeigen

@ -20,10 +20,15 @@ public final class CraftCreativeCategory {
.build(); .build();
public static CreativeCategory fromNMS(CreativeModeTab tab) { public static CreativeCategory fromNMS(CreativeModeTab tab) {
if (!NMS_TO_BUKKIT.containsKey(tab)) { if (tab == null) {
return null;
}
CreativeCategory bukkit = NMS_TO_BUKKIT.get(tab);
if (bukkit == null) {
throw new UnsupportedOperationException("Item is not present in any known CreativeModeTab. This is a bug."); throw new UnsupportedOperationException("Item is not present in any known CreativeModeTab. This is a bug.");
} }
return (tab != null) ? NMS_TO_BUKKIT.get(tab) : null; return bukkit;
} }
} }