Packages com.phoenixplugins.phoenixcrates.api crate animation

Class AnimationProperties

All Implemented Interfaces:
Cloneable

public class AnimationProperties extends Object implements Cloneable
Represents a collection of properties for configuring an animation. This class allows you to dynamically add, retrieve, and manipulate properties that affect the behavior of an animation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addProperty(String key, Object value)
    Adds a property to the animation properties.
     
    Static method to create an empty AnimationProperties object.
    Color
    getColorOrDefault(String key, Color defaultValue)
    Returns a Color property by key, or the given default value if not found or not parseable.
    <E extends Enum<E>>
    E
    getEnumOrDefault(String key, E defaultValue)
    Returns an enum constant property by key, or the given default value if not found or not parseable.
    Object
    getProperty(String key)
    Retrieves a property by its key.
    <T> T
    getProperty(String key, Class<T> clazz)
    Retrieves a property by its key, with type conversion compatibility.
    <T> T
    getPropertyOrDefault(String key, T defaultValue)
    Retrieves a property by its key, with type conversion compatibility.
    boolean
    hasProperty(String key)
    Checks if a property exists in the animation properties.
    Map<String,Object>
    map()
    Returns the raw underlying properties map.
    of(Object... keyValuePairs)
    Static method to create an AnimationProperties object from alternating key-value pairs.
    void
    removeProperty(String key)
    Removes a property from the animation properties.
    void
    Resets all properties in this animation to their default values.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • empty

      public static AnimationProperties empty()
      Static method to create an empty AnimationProperties object.
      Returns:
      A new empty AnimationProperties object.
    • of

      public static AnimationProperties of(Object... keyValuePairs)
      Static method to create an AnimationProperties object from alternating key-value pairs. The key and value pairs are passed as Object arguments.
      Parameters:
      keyValuePairs - An array of alternating keys and values for the properties.
      Returns:
      A new AnimationProperties object with the provided key-value pairs.
    • addProperty

      public void addProperty(String key, Object value)
      Adds a property to the animation properties.
      Parameters:
      key - The key for the property.
      value - The value of the property.
    • getProperty

      public Object getProperty(String key)
      Retrieves a property by its key.
      Parameters:
      key - The key of the property.
      Returns:
      The value of the property, or null if not found.
    • getProperty

      public <T> T getProperty(String key, Class<T> clazz)
      Retrieves a property by its key, with type conversion compatibility. It supports auto-conversion of compatible types (e.g., Integer to Double, String to Boolean, etc.).
      Type Parameters:
      T - The type to cast the property to.
      Parameters:
      key - The key of the property.
      clazz - The class type to cast the property value to.
      Returns:
      The property value as the specified type, or null if not found or cannot be converted.
    • getPropertyOrDefault

      public <T> T getPropertyOrDefault(String key, @NonNull T defaultValue)
      Retrieves a property by its key, with type conversion compatibility. It supports auto-conversion of compatible types (e.g., Integer to Double, String to Boolean, etc.). If the property does not exist, the default value is returned.
      Type Parameters:
      T - The type of the default value (and the type to cast the property to).
      Parameters:
      key - The key of the property.
      defaultValue - The default value to return if the property doesn't exist.
      Returns:
      The property value as the specified type, or the default value if not found or cannot be converted.
    • getColorOrDefault

      public Color getColorOrDefault(String key, Color defaultValue)
      Returns a Color property by key, or the given default value if not found or not parseable. Supports Color, Color, and hex string formats (#RRGGBB / #AARRGGBB).
      Parameters:
      key - the property key to look up
      defaultValue - the fallback color when the key is absent or the value cannot be parsed
      Returns:
      the resolved color, or defaultValue
    • getEnumOrDefault

      public <E extends Enum<E>> E getEnumOrDefault(String key, E defaultValue)
      Returns an enum constant property by key, or the given default value if not found or not parseable. Supports enum instance, name string (case-insensitive), and ordinal number values.
      Type Parameters:
      E - the enum type
      Parameters:
      key - the property key to look up
      defaultValue - the fallback enum constant when the key is absent or the value cannot be parsed
      Returns:
      the resolved enum constant, or defaultValue
    • hasProperty

      public boolean hasProperty(String key)
      Checks if a property exists in the animation properties.
      Parameters:
      key - The key of the property to check.
      Returns:
      true if the property exists, false otherwise.
    • removeProperty

      public void removeProperty(String key)
      Removes a property from the animation properties.
      Parameters:
      key - The key of the property to remove.
    • resetProperties

      public void resetProperties()
      Resets all properties in this animation to their default values.
    • map

      public Map<String,Object> map()
      Returns the raw underlying properties map.
      Returns:
      a mutable map of all animation properties
    • clone

      public AnimationProperties clone()
      Overrides:
      clone in class Object
Last updated 10 days ago
My Cart
Spider

Your cart is empty

Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shopping