Search in sources :

Example 1 with ScheduledMethod

use of net.runelite.client.task.ScheduledMethod in project runelite by runelite.

the class PluginManager method unschedule.

private void unschedule(Plugin plugin) {
    List<ScheduledMethod> methods = new ArrayList<>(scheduler.getScheduledMethods());
    for (ScheduledMethod method : methods) {
        if (method.getObject() != plugin) {
            continue;
        }
        log.debug("Removing scheduled task {}", method);
        scheduler.removeScheduledMethod(method);
    }
}
Also used : ScheduledMethod(net.runelite.client.task.ScheduledMethod) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 2 with ScheduledMethod

use of net.runelite.client.task.ScheduledMethod in project runelite by runelite.

the class PluginManager method schedule.

private void schedule(Plugin plugin) {
    for (Method method : plugin.getClass().getMethods()) {
        Schedule schedule = method.getAnnotation(Schedule.class);
        if (schedule == null) {
            continue;
        }
        ScheduledMethod scheduledMethod = new ScheduledMethod(schedule, method, plugin);
        log.debug("Scheduled task {}", scheduledMethod);
        scheduler.addScheduledMethod(scheduledMethod);
    }
}
Also used : ScheduledMethod(net.runelite.client.task.ScheduledMethod) Schedule(net.runelite.client.task.Schedule) Method(java.lang.reflect.Method) ScheduledMethod(net.runelite.client.task.ScheduledMethod)

Aggregations

ScheduledMethod (net.runelite.client.task.ScheduledMethod)2 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 Schedule (net.runelite.client.task.Schedule)1