From cd487e11223e515b7590c4edf6123264d0dd1a45 Mon Sep 17 00:00:00 2001 From: Kam Date: Fri, 28 Feb 2025 13:05:43 -0500 Subject: [PATCH] Add another Register --- .../kamkeel/npcs/controllers/AttributeController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/kamkeel/npcs/controllers/AttributeController.java b/src/main/java/kamkeel/npcs/controllers/AttributeController.java index 9e9687f16..dac29046c 100644 --- a/src/main/java/kamkeel/npcs/controllers/AttributeController.java +++ b/src/main/java/kamkeel/npcs/controllers/AttributeController.java @@ -41,6 +41,15 @@ public class AttributeController { return def; } + public static AttributeDefinition registerAttribute(AttributeDefinition definition) { + if (definitions.containsKey(definition.getKey())) { + throw new IllegalArgumentException("Attribute already registered with key: " + definition.getKey()); + } else { + definitions.put(definition.getKey(), definition); + return definition; + } + } + public static AttributeDefinition getAttribute(String key) { return definitions.get(key); }