Class TaskManager


public class TaskManager extends Object
  • Constructor Details

  • Method Details

    • getTask

      public EntityTask getTask(String name)
      Returns the existing task with a given name.
      name - the name to look up
      the task with that name, or null if no registered task matches
    • getTask

      public EntityTask getTask(Class<? extends EntityTask> clazz)
      Returns the existing task whose class is exactly a given class (and not a subclass -- this will always return null for an abstract type).
      clazz - the class to look up
      one of this manager's tasks that's an instance of that class and not a subclass, or null if no such tasks are registered
    • getNewTask

      public EntityTask getNewTask(String name)
      Returns a new instance of the task with a given name.
      name - the task name to look up
      a task with the given name, or null if none match or the matching task class doesn't have a parameterless constructor
    • updateState

      public void updateState()
      Rebuild the list of tasks according to (EntityType, MobState).
    • cancel

      public void cancel(EntityTask task)
      Cancels and unregisters the given task.
      task - the task to cancel
    • cancelTasks

      public void cancelTasks()
      Cancels and unregisters all tasks.
    • pulse

      public void pulse()
    • addTask

      public void addTask(EntityTask task)
      Add the given task, replacing any existing task with the same name.
      task - the task to add
    • addTask

      public void addTask(String taskName)
      Add the task with this name, or replace it with a new instance if it already exists.
      taskName - the task name