Class Property<T>
- Type Parameters:
T- The type of the property.
- All Implemented Interfaces:
IKeyed
Several properties are predefined in this class. For example, the OPEN_STATUS property is used to represent
whether a structure is open or closed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe registry of all registered properties. -
Field Summary
FieldsModifier and TypeFieldDescriptionA property for structures whose animation speed is variable.A property for structures that move a certain amount of blocks when activated.A property for structures that have a defined open and closed state.A property for structures that can rotate multiples of 90 degrees.static final Property<RedstoneMode> A property for structures that can have different redstone modes.static final Property.RegistryThe registry of all registered properties.A property for structures that have a defined rotation point. -
Constructor Summary
ConstructorsConstructorDescriptionProperty(String owner, String name, Class<T> type, T defaultValue, PropertyAccessLevel propertyAccessLevel, PropertyScope... scopes) Creates a new property.Property(NamespacedKey namespacedKey, Class<T> type, T defaultValue, PropertyAccessLevel propertyAccessLevel, PropertyScope... scopes) Creates a new property. -
Method Summary
Modifier and TypeMethodDescriptionCasts the given value to the type of the property.booleanstatic @Nullable Property<?> Gets the property with the given serialization name.The default value of the property.The namespace and key of the property.The type of the property.The scopes in which this property is used.getType()The type of the property.inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface nl.pim16aap2.animatedarchitecture.core.api.IKeyed
getFullKey
-
Field Details
-
REGISTRY
The registry of all registered properties. -
ANIMATION_SPEED_MULTIPLIER
A property for structures whose animation speed is variable. -
BLOCKS_TO_MOVE
A property for structures that move a certain amount of blocks when activated. -
OPEN_STATUS
A property for structures that have a defined open and closed state. -
QUARTER_CIRCLES
A property for structures that can rotate multiples of 90 degrees. -
REDSTONE_MODE
A property for structures that can have different redstone modes. -
ROTATION_POINT
A property for structures that have a defined rotation point.
-
-
Constructor Details
-
Property
public Property(NamespacedKey namespacedKey, Class<T> type, @Nullable T defaultValue, PropertyAccessLevel propertyAccessLevel, PropertyScope... scopes) Creates a new property.- Parameters:
namespacedKey- The namespace and key of the property.type- The type of the property.defaultValue- The default value of the property.This is the value that will be used if a structure whose type has this property does not have a value set for this property.
propertyAccessLevel- The level of access users have to this property.scopes- The scopes in which this property is used.This is used to prevent side effects of changing the property value. For example, clearing cached values related to the property, such as the animation range when changing the blocks to move.
-
Property
public Property(String owner, String name, Class<T> type, @Nullable T defaultValue, PropertyAccessLevel propertyAccessLevel, PropertyScope... scopes) Creates a new property.- Parameters:
owner- The name of the plugin that owns this property. This is used to prevent conflicts between properties between different plugins.All properties supplied by this plugin are set to
Constants.PLUGIN_NAME.Properties from other plugins should use the name of the plugin that owns the property.
name- The name of the property that is used for serialization.type- The type of the property.defaultValue- The default value of the property.This is the value that will be used if a structure whose type has this property does not have a value set for this property.
propertyAccessLevel- The level of access users have to this property.scopes- The scopes in which this property is used.This is used to prevent side effects of changing the property value. For example, clearing cached values related to the property, such as the animation range when changing the blocks to move.
-
-
Method Details
-
fromName
Gets the property with the given serialization name.Shortcut for
Property.Registry.fromName(String)withREGISTRY.- Parameters:
propertyKey- The serialization name of the property.- Returns:
- The property with the given serialization name, or null if no property with that name exists.
-
cast
Casts the given value to the type of the property.This method is a wrapper around
Class.cast(Object)forgetType().- Parameters:
value- The value to cast.- Returns:
- The value cast to the type of the property.
- Throws:
ClassCastException- If the value cannot be cast to the type of the property.
-
toString
-
equals
-
hashCode
public int hashCode() -
getNamespacedKey
The namespace and key of the property.Note that this name should be unique for each property.
- Specified by:
getNamespacedKeyin interfaceIKeyed- Returns:
- The name of the property.
-
getPropertyAccessLevel
The type of the property.- Returns:
- The type of the property.
-
getType
The type of the property.- Returns:
- The type of the property.
-
getDefaultValue
The default value of the property.- Returns:
- The default value of the property.
-
getPropertyScopes
The scopes in which this property is used.
-