Interface IDataAbilities


  • public interface IDataAbilities
    Interface for an NPC's ability data manager. Provides access to the NPC's abilities and execution state.
    • Method Detail

      • isEnabled

        boolean isEnabled()
        Check if the ability system is enabled for this NPC.
        Returns:
        true if enabled
      • setEnabled

        void setEnabled​(boolean enabled)
        Enable or disable the ability system for this NPC.
        Parameters:
        enabled - whether to enable
      • getAbilities

        IAbility[] getAbilities()
        Get all abilities assigned to this NPC (resolved from slots). Returns safe deep copies. Use getSourceAbility(String) for live references.
        Returns:
        array of abilities
      • addAbility

        void addAbility​(IAbility ability)
        Add an inline ability to this NPC.
        Parameters:
        ability - the ability to add
      • addAbilityReference

        void addAbilityReference​(String key)
        Add a reference ability by key (built-in name or custom UUID).
        Parameters:
        key - the ability reference key
      • removeAbility

        void removeAbility​(String abilityId)
        Remove an ability by ID.
        Parameters:
        abilityId - the ability ID to remove
      • getAbility

        IAbility getAbility​(String abilityId)
        Get an ability by ID. Returns a safe deep copy. Use getSourceAbility(String) for the live reference.
        Parameters:
        abilityId - the ability ID
        Returns:
        the ability, or null
      • hasAbility

        boolean hasAbility​(String abilityId)
        Check if the NPC has an ability with the given ID.
        Parameters:
        abilityId - the ability ID
        Returns:
        true if found
      • isAbilityReference

        boolean isAbilityReference​(String abilityId)
        Check if a slot is a reference (by ability ID).
        Parameters:
        abilityId - the ability ID
        Returns:
        true if reference
      • convertToInline

        boolean convertToInline​(String abilityId)
        Convert a reference slot to inline (by ability ID). Returns false if the reference cannot be resolved.
        Parameters:
        abilityId - the ability ID
        Returns:
        true if converted successfully
      • clearAbilities

        void clearAbilities()
        Clear all abilities from this NPC.
      • getCurrentAbility

        IAbility getCurrentAbility()
        Get the currently executing ability, or null if none. Returns a safe deep copy. Use getSourceCurrentAbility() for the live reference.
        Returns:
        the current ability, or null
      • isExecutingAbility

        boolean isExecutingAbility()
        Check if any ability is currently executing.
        Returns:
        true if executing
      • interruptCurrentAbility

        void interruptCurrentAbility()
        Interrupt the current ability if one is executing.
      • completeCurrentAbility

        void completeCurrentAbility()
        Signal the current ability to complete immediately.
      • getGlobalCooldown

        int getGlobalCooldown()
        Get the global cooldown timer in ticks.
        Returns:
        cooldown in ticks
      • setGlobalCooldown

        void setGlobalCooldown​(int ticks)
        Set the global cooldown timer in ticks.
        Parameters:
        ticks - cooldown in ticks
      • resetCooldowns

        void resetCooldowns()
        Reset all ability cooldowns.
      • forceStartAbility

        boolean forceStartAbility​(String abilityId)
        Force start an ability on this NPC. If an ability is currently executing, it will be cancelled.
        Parameters:
        abilityId - The ID of the ability to start
        Returns:
        true if the ability was started successfully
      • forceStartAbility

        boolean forceStartAbility​(String abilityId,
                                  Object target)
        Force start an ability on this NPC with a specific target. If an ability is currently executing, it will be cancelled.
        Parameters:
        abilityId - The ID of the ability to start
        target - The target entity (can be null for self-targeted abilities)
        Returns:
        true if the ability was started successfully
      • executeAbility

        boolean executeAbility​(String key)
        Execute an ability on this NPC by key (built-in name or custom UUID). The NPC does NOT need to have this ability assigned. If an ability is currently executing, it will be cancelled.
        Parameters:
        key - The ability key (built-in name or custom UUID)
        Returns:
        true if the ability was started successfully
      • executeAbility

        boolean executeAbility​(String key,
                               Object target)
        Execute an ability on this NPC with a specific target. The NPC does NOT need to have this ability assigned. If an ability is currently executing, it will be cancelled.
        Parameters:
        key - The ability key (built-in name or custom UUID)
        target - The target entity (can be null for self-targeted abilities)
        Returns:
        true if the ability was started successfully
      • createAbility

        IAbility createAbility​(String typeId)
        Create a new ability instance by type ID. The ability is not assigned to this NPC - use addAbility() to assign it.
        Parameters:
        typeId - The type ID (e.g., "cnpc:slam", "cnpc:projectile")
        Returns:
        The new ability, or null if the type is unknown
      • getSourceAbility

        IAbility getSourceAbility​(String abilityId)
        Get the live source reference of an ability by ID. Unlike getAbility(String) which returns a safe copy, this returns the actual ability object. Modifications will permanently affect the NPC's ability configuration.
        Parameters:
        abilityId - The ID of the ability
        Returns:
        The live ability reference, or null if not found
      • getSourceCurrentAbility

        IAbility getSourceCurrentAbility()
        Get the live source reference of the currently executing ability. Unlike getCurrentAbility() which returns a safe copy, this returns the actual ability object. Modifications will permanently affect the NPC's ability configuration.
        Returns:
        The live ability reference, or null if no ability is executing