From 77af63772fa13e55fcc198792d933a813c63ae0c Mon Sep 17 00:00:00 2001 From: KrystilizeNevaDies <57762380+KrystilizeNevaDies@users.noreply.github.com> Date: Mon, 22 Mar 2021 21:23:57 +1000 Subject: [PATCH] Add getTask in SchedulerManager --- .../server/timer/SchedulerManager.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/net/minestom/server/timer/SchedulerManager.java b/src/main/java/net/minestom/server/timer/SchedulerManager.java index 33e9ca2e8..4c126be8d 100644 --- a/src/main/java/net/minestom/server/timer/SchedulerManager.java +++ b/src/main/java/net/minestom/server/timer/SchedulerManager.java @@ -151,6 +151,16 @@ public final class SchedulerManager implements IExtensionObserver { public ObjectCollection getTasks() { return tasks.values(); } + + /** + * Returns the task associated with this task id + * + * @param id the id of the task + * @return task the task itself + */ + public Task getTask(int id) { + return tasks.get(id); + } /** * Gets a {@link Collection} with all the registered shutdown {@link Task}. @@ -161,6 +171,16 @@ public final class SchedulerManager implements IExtensionObserver { public ObjectCollection getShutdownTasks() { return shutdownTasks.values(); } + + /** + * Returns the shutdown task associated with this task id + * + * @param id the id of the task + * @return task the shutdown task itself + */ + public Task getShutdownTask(int id) { + return shutdownTasks.get(id); + } /** * Gets the execution service for all the registered {@link Task}.