From a1098641b5212d11ab5b26c12d0b13d1a91a6c84 Mon Sep 17 00:00:00 2001 From: LoJoSho Date: Tue, 21 Jan 2025 11:49:09 -0600 Subject: [PATCH] feat: add cosmetic slot API methods --- .../hmccosmetics/api/HMCCosmeticsAPI.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/HMCCosmeticsAPI.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/HMCCosmeticsAPI.java index c0a6c40d..7b0f4d8c 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/api/HMCCosmeticsAPI.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/api/HMCCosmeticsAPI.java @@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; +import java.util.Map; import java.util.UUID; public class HMCCosmeticsAPI { @@ -85,6 +86,7 @@ public class HMCCosmeticsAPI { * Gets all Cosmetics that are currently registered with HMCC. This list is immutable! * @return A list of all registered cosmetics */ + @NotNull public static List getAllCosmetics() { return List.copyOf(Cosmetics.values()); } @@ -93,10 +95,29 @@ public class HMCCosmeticsAPI { * Gets all CosmeticUsers that are currently registered with HMCC. This list is immutable! * @return A list of all registered CosmeticUsers */ + @NotNull public static List getAllCosmeticUsers() { return List.copyOf(CosmeticUsers.values()); } + /** + * Gets all the cosmetic slots that are registered with HMCC. This map is immutable! + * @return A map of all registered cosmetic slots + */ + @NotNull + public static Map getAllCosmeticSlots() { + return Map.copyOf(CosmeticSlot.values()); + } + + /** + * Registers a new cosmetic slot with the given id. If a slot with the given id already exists, it will be returned. + * @param id The id of the slot, this will automatically be converted to all UPPERCASE when registering the slot + */ + @NotNull + public static CosmeticSlot registerCosmeticSlot(@NotNull String id) { + return CosmeticSlot.register(id); + } + /** * This returns the NMS version of the server as recognized by HMCCosmetics. This will be null until HMCC setup has been completed. * @return The NMS version of the server in String format