/** * Starts the given {@code timer} with the given {@code duration} on the given subject. * * @param timedSubject the subject to start the timer on * @param duration the duration to use * @param timer the timer to start * @param <T> the type of the subject */ public <T> void start(T timedSubject, Duration duration, TimerAction<T> timer) { checkArgument( !has(timedSubject, timer.getClass()).isTimerRunning(), "A timer of the type %s is already running for %s.", timedSubject, timer.getClass()); runningTimers.put(timedSubject, timer.getClass(), new SelfRunningRunnable<T>(timer, duration)); }
@Override public void cancel() { BukkitTimerHandler.this.cancel(runnable.getTimedSuject(), runnable.getClass()); cancelAbortingCheck(); super.cancel(); }