Class AbilityCompiler

java.lang.Object
valorless.rarespawns.compilers.Compiler
valorless.rarespawns.compilers.AbilityCompiler

public class AbilityCompiler extends Compiler
AbilityCompiler handles the execution of dynamically compiled ability classes. It provides methods to invoke abilities by their ID, passing necessary parameters. Also includes a cleanup method to remove temporary source files after compilation.
  • Constructor Details

    • AbilityCompiler

      public AbilityCompiler()
  • Method Details

    • useAbility

      public static void useAbility(String id, EntityData data, org.bukkit.entity.LivingEntity entity) throws Exception
      Executes the cached ability code by invoking its 'execute' method.
      Parameters:
      id - The ability ID (class name).
      data - The EntityData to pass to the ability.
      entity - The LivingEntity to pass to the ability.
      Throws:
      Exception - If the class cannot be found or executed.
    • cleanupTemporaryFiles

      public static void cleanupTemporaryFiles()
      Cleans up temporary .java files created during the compilation process. This method deletes all .java files in the 'abilities/compiled' directory. The compiled .class files are retained for use.