public class AttributeManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AttributeManager.Key |
class |
AttributeManager.Property |
Constructor and Description |
---|
AttributeManager(GlowLivingEntity entity)
Create an instance for the given entity.
|
Modifier and Type | Method and Description |
---|---|
void |
applyMessages(Collection<com.flowpowered.network.Message> messages)
Adds an
EntityPropertyMessage with our entity's properties to the given collection of
messages, if the client's snapshot is stale. |
Map<String,AttributeManager.Property> |
getAllProperties()
Returns all the properties stored in the manager.
|
AttributeManager.Property |
getProperty(AttributeManager.Key key)
Get the property for a certain
AttributeManager.Key . |
double |
getPropertyValue(AttributeManager.Key key)
Returns the base value of the given property with all modifiers applied.
|
void |
sendMessages(GlowSession session)
Sends the managed entity's properties to the client, if the client's snapshot is stale.
|
void |
setProperty(AttributeManager.Key key,
double value)
Updates a property and removes all modifiers.
|
void |
setProperty(AttributeManager.Key key,
double value,
Collection<org.bukkit.attribute.AttributeModifier> modifiers)
Updates a property and its modifiers.
|
public AttributeManager(GlowLivingEntity entity)
entity
- the entity whose attributes will be managedpublic void applyMessages(Collection<com.flowpowered.network.Message> messages)
EntityPropertyMessage
with our entity's properties to the given collection of
messages, if the client's snapshot is stale.messages
- the message collection to add topublic void sendMessages(GlowSession session)
session
- the client's sessionpublic AttributeManager.Property getProperty(AttributeManager.Key key)
AttributeManager.Key
.key
- the kind of property to getnull
public void setProperty(AttributeManager.Key key, double value)
key
- the property to updatevalue
- the new valuepublic void setProperty(AttributeManager.Key key, double value, Collection<org.bukkit.attribute.AttributeModifier> modifiers)
key
- the property to updatevalue
- the new base valuemodifiers
- the new and retained modifiers, or null
to remove all modifierspublic double getPropertyValue(AttributeManager.Key key)
key
- the property to look uppublic Map<String,AttributeManager.Property> getAllProperties()
Copyright © 2021. All rights reserved.