#638: Add CreativeCategory API for Materials

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
Bukkit/Spigot
2022-03-03 18:55:54 +11:00
parent 6b7d2d9a91
commit 7c60ceee2c
3 changed files with 68 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ import org.bukkit.block.data.type.TripwireHook;
import org.bukkit.block.data.type.TurtleEgg;
import org.bukkit.block.data.type.Wall;
import org.bukkit.block.data.type.WallSign;
import org.bukkit.inventory.CreativeCategory;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull;
@@ -9780,4 +9781,15 @@ public enum Material implements Keyed {
return Bukkit.getUnsafe().getDefaultAttributeModifiers(this, slot);
}
/**
* Get the {@link CreativeCategory} to which this material belongs.
*
* @return the creative category. null if does not belong to a category
*/
@Nullable
public CreativeCategory getCreativeCategory() {
return Bukkit.getUnsafe().getCreativeCategory(this);
}
}