From ec402c4974d5c77a3d1d28139a9180aef4a4b522 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 19 Mar 2022 09:59:56 +1100 Subject: [PATCH] Improve CreativeCategory conversion By: md_5 --- .../craftbukkit/inventory/CraftCreativeCategory.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftCreativeCategory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftCreativeCategory.java index 5fc078b2ce..55ed932d95 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftCreativeCategory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftCreativeCategory.java @@ -20,10 +20,15 @@ public final class CraftCreativeCategory { .build(); 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."); } - return (tab != null) ? NMS_TO_BUKKIT.get(tab) : null; + return bukkit; } }