public class WrappedAttribute extends AbstractWrapper
| Modifier and Type | Class and Description |
|---|---|
static class |
WrappedAttribute.Builder
Represents a builder for wrapped attributes.
|
| Modifier and Type | Field and Description |
|---|---|
protected Object |
handle
Reference to the underlying attribute snapshot.
|
protected StructureModifier<Object> |
modifier |
handleType| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static WrappedAttribute |
fromHandle(Object handle)
Construct a new wrapped attribute around a specific NMS instance.
|
String |
getAttributeKey()
Retrieve the unique attribute key that identifies its function.
|
double |
getBaseValue()
Retrieve the base value of this attribute, before any of the modifiers have been taken into account.
|
double |
getFinalValue()
Retrieve the final computed value.
|
WrappedAttributeModifier |
getModifierByUUID(UUID id)
Retrieve an attribute modifier by UUID.
|
Set<WrappedAttributeModifier> |
getModifiers()
Retrieve an immutable set of all the attribute modifiers that will compute the final value of this attribute.
|
PacketContainer |
getParentPacket()
Retrieve the parent update attributes packet.
|
int |
hashCode() |
boolean |
hasModifier(UUID id)
Determine if the attribute has a given attribute modifier, identified by UUID.
|
static WrappedAttribute.Builder |
newBuilder()
Construct a new wrapped attribute builder.
|
static WrappedAttribute.Builder |
newBuilder(WrappedAttribute template)
Construct a new wrapped attribute builder initialized to the values from a template.
|
String |
toString() |
WrappedAttribute |
withModifiers(Collection<WrappedAttributeModifier> modifiers)
Construct an attribute with the same key and name, but a different list of modifiers.
|
getHandle, getHandleType, setHandleprotected Object handle
protected StructureModifier<Object> modifier
public static WrappedAttribute fromHandle(@Nonnull Object handle)
handle - - handle to a NMS AttributeSnapshot.IllegalArgumentException - If the handle is not a AttributeSnapshot.public static WrappedAttribute.Builder newBuilder()
public static WrappedAttribute.Builder newBuilder(@Nonnull WrappedAttribute template)
template - - the attribute template.public String getAttributeKey()
Example: "generic.maxHealth"
public double getBaseValue()
public double getFinalValue()
public PacketContainer getParentPacket()
public boolean hasModifier(UUID id)
id - - the id to check for.public WrappedAttributeModifier getModifierByUUID(UUID id)
id - - the id to look for.public Set<WrappedAttributeModifier> getModifiers()
public WrappedAttribute withModifiers(Collection<WrappedAttributeModifier> modifiers)
modifiers - - attribute modifiers.public boolean equals(Object obj)
equals in class AbstractWrapperpublic int hashCode()
hashCode in class AbstractWrapperpublic String toString()
toString in class AbstractWrapperCopyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.