MinionRegistry.java 623 B

123456789101112131415161718192021222324252627
  1. package me.lethunderhawk.minion.registry;
  2. import me.lethunderhawk.minion.api.MinionType;
  3. import java.util.HashMap;
  4. import java.util.Map;
  5. public class MinionRegistry {
  6. private static final Map<String, MinionType> TYPES = new HashMap<>();
  7. public static void register(MinionType type) {
  8. TYPES.putIfAbsent(type.getId(), type);
  9. }
  10. public static MinionType get(String id) {
  11. return TYPES.get(id);
  12. }
  13. public static boolean exists(String id) {
  14. return TYPES.containsKey(id);
  15. }
  16. public static Map<String, MinionType> getAllRegisteredTypes() {
  17. return TYPES;
  18. }
  19. }