public class WrappedAttributeModifier extends AbstractWrapper
This is used to compute the final attribute value.
Modifier and Type | Class and Description |
---|---|
static class |
WrappedAttributeModifier.Builder
Represents a builder of attribute modifiers.
|
static class |
WrappedAttributeModifier.Operation
Represents the different modifier operations.
|
Modifier and Type | Field and Description |
---|---|
protected StructureModifier<java.lang.Object> |
modifier |
handle, handleType
Modifier | Constructor and Description |
---|---|
protected |
WrappedAttributeModifier(java.lang.Object handle)
Construct an attribute modifier wrapper around a given NMS instance.
|
protected |
WrappedAttributeModifier(java.lang.Object handle,
java.util.UUID uuid,
java.lang.String name,
double amount,
WrappedAttributeModifier.Operation operation)
Construct an attribute modifier wrapper around a NMS instance.
|
protected |
WrappedAttributeModifier(java.util.UUID uuid,
java.lang.String name,
double amount,
WrappedAttributeModifier.Operation operation)
Construct a new wrapped attribute modifier with no associated handle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Determine if a given modifier is equal to the current modifier.
|
static WrappedAttributeModifier |
fromHandle(java.lang.Object handle)
Construct an attribute modifier wrapper around a given NMS instance.
|
double |
getAmount()
Retrieve the amount to modify in the operation.
|
java.lang.Object |
getHandle()
Retrieve the underlying attribute modifier.
|
java.lang.String |
getName()
Retrieve a human readable name of this modifier.
|
WrappedAttributeModifier.Operation |
getOperation()
Retrieve the operation that is used to compute the final attribute value.
|
java.util.UUID |
getUUID()
Retrieve the unique UUID that identifies the origin of this modifier.
|
int |
hashCode() |
boolean |
isPendingSynchronization()
Whether or not the modifier is pending synchronization with the client.
|
static WrappedAttributeModifier.Builder |
newBuilder()
Construct a new attribute modifier builder.
|
static WrappedAttributeModifier.Builder |
newBuilder(java.util.UUID id)
Construct a new attribute modifier builder with the given UUID.
|
static WrappedAttributeModifier.Builder |
newBuilder(WrappedAttributeModifier template)
Construct a new wrapped attribute modifier builder initialized to the values from a template.
|
void |
setPendingSynchronization(boolean pending)
Set whether or not the modifier is pending synchronization with the client.
|
java.lang.String |
toString() |
getHandleType, setHandle
protected StructureModifier<java.lang.Object> modifier
protected WrappedAttributeModifier(java.util.UUID uuid, java.lang.String name, double amount, WrappedAttributeModifier.Operation operation)
Note that the handle object is not initialized after this constructor.
uuid
- - the UUID.name
- - the human readable name.amount
- - the amount.operation
- - the operation.protected WrappedAttributeModifier(@Nonnull java.lang.Object handle)
handle
- - the NMS instance.protected WrappedAttributeModifier(@Nonnull java.lang.Object handle, java.util.UUID uuid, java.lang.String name, double amount, WrappedAttributeModifier.Operation operation)
handle
- - the NMS instance.uuid
- - the UUID.name
- - the human readable name.amount
- - the amount.operation
- - the operation.public static WrappedAttributeModifier.Builder newBuilder()
It will automatically be supplied with a random UUID.
public static WrappedAttributeModifier.Builder newBuilder(java.util.UUID id)
id
- - the new UUID.public static WrappedAttributeModifier.Builder newBuilder(@Nonnull WrappedAttributeModifier template)
template
- - the attribute modifier template.public static WrappedAttributeModifier fromHandle(@Nonnull java.lang.Object handle)
handle
- - the NMS instance.java.lang.IllegalArgumentException
- If the handle is not an AttributeModifier.public java.util.UUID getUUID()
public java.lang.String getName()
Note that this will be "Unknown synced attribute modifier" on the client side.
public WrappedAttributeModifier.Operation getOperation()
public double getAmount()
public java.lang.Object getHandle()
getHandle
in class AbstractWrapper
public void setPendingSynchronization(boolean pending)
This value will be disregarded for equals(Object)
.
pending
- - TRUE if is is, FALSE otherwise.public boolean isPendingSynchronization()
public boolean equals(java.lang.Object obj)
Two modifiers are considered equal if they use the same UUID.
equals
in class java.lang.Object
obj
- - the object to check against.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object