Package de.Keyle.MyPet.api.config
Class PetConfigLookup
java.lang.Object
de.Keyle.MyPet.api.config.PetConfigLookup
Resolves per-pet config values from a runtime
Class<? extends Pet>
reference — the form marker interfaces (PetFlyingEntity.canFly,
PetSwimmingEntity.canSwim, etc.) need. Callers with a compile-time
dependency on plugin pet classes should prefer the direct field reference
(e.g. PetCreeper.ALLOW_LIGHTNING_POWER.get()) which gives typed
access and skips the class-name parsing.
This class converts the pet class to its pet-type name (stripping the
"Pet" prefix from the simple name) and delegates to
ConfigKeyRegistry, which transitively loads every pet class on
first call so all keys are registered before any read.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturns the boolean value for(petClass, key)from the registry, orfallbackif no such key is registered (e.g.static ConfigItemconfigItemValue(Class<? extends Pet> petClass, String key)
-
Method Details
-
boolValue
Returns the boolean value for(petClass, key)from the registry, orfallbackif no such key is registered (e.g. a third-party pet that hasn't declared this flag).- Parameters:
petClass- the pet class to resolve againstkey- the key's short namefallback- returned when the key is absent- Returns:
- the configured value, or
fallback
-
configItemValue
- Parameters:
petClass- the pet class to resolve againstkey- the key's short name- Returns:
- the configured item, or
nullif the key is absent
-