Package noppes.npcs.api.handler.data
Interface IPlayerAttributes
-
public interface IPlayerAttributes
Represents a collection of a player's custom attributes.Expose methods to retrieve all attribute instances as an array, look up individual attributes by key, and check for the presence of a specific attribute.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ICustomAttribute
getAttribute(java.lang.String key)
Returns the custom attribute instance identified by the given key.ICustomAttribute[]
getAttributes()
Returns an array of all custom attribute instances associated with the player.float
getAttributeValue(java.lang.String key)
Returns the value of the attribute identified by the given key.boolean
hasAttribute(java.lang.String key)
Checks whether an attribute with the given key exists.void
recalculate(IPlayer player)
Recalulates Item Attributes on a Player
-
-
-
Method Detail
-
recalculate
void recalculate(IPlayer player)
Recalulates Item Attributes on a Player
-
getAttributes
ICustomAttribute[] getAttributes()
Returns an array of all custom attribute instances associated with the player.- Returns:
- an array of
ICustomAttribute
objects
-
getAttributeValue
float getAttributeValue(java.lang.String key)
Returns the value of the attribute identified by the given key.- Parameters:
key
- the attribute key (e.g., "health", "movement_speed")- Returns:
- the float value of the attribute, or 0 if the attribute is not found
-
hasAttribute
boolean hasAttribute(java.lang.String key)
Checks whether an attribute with the given key exists.- Parameters:
key
- the attribute key to check- Returns:
- true if the attribute exists, false otherwise
-
getAttribute
ICustomAttribute getAttribute(java.lang.String key)
Returns the custom attribute instance identified by the given key.- Parameters:
key
- the attribute key (e.g., "health", "movement_speed")- Returns:
- the corresponding
ICustomAttribute
instance, or null if not found
-
-