Package noppes.npcs.api.handler
Interface IAttributeHandler
-
public interface IAttributeHandler
Handles registration and lookup of attribute definitions as well as retrieval of player attributes.Maintain a unique registry of attribute definitions and provide methods to retrieve a player's aggregated attributes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IAttributeDefinition[]
getAllAttributesArray()
Returns an array of all registered attribute definitions.IAttributeDefinition
getAttributeDefinition(java.lang.String key)
Returns the attribute definition corresponding to the given key.IPlayerAttributes
getPlayerAttributes(IPlayer player)
Returns the aggregated attributes for a given player.
-
-
-
Method Detail
-
getPlayerAttributes
IPlayerAttributes getPlayerAttributes(IPlayer player)
Returns the aggregated attributes for a given player.- Parameters:
player
- the player whose attributes are requested- Returns:
- an
IPlayerAttributes
instance containing all custom attributes for the player, or null if the player is invalid
-
getAttributeDefinition
IAttributeDefinition getAttributeDefinition(java.lang.String key)
Returns the attribute definition corresponding to the given key.- Parameters:
key
- the unique key identifying the attribute (e.g., "health", "movement_speed")- Returns:
- the
IAttributeDefinition
instance for the specified key, or null if not found
-
getAllAttributesArray
IAttributeDefinition[] getAllAttributesArray()
Returns an array of all registered attribute definitions.- Returns:
- an array of
IAttributeDefinition
objects representing all attributes
-
-