Fix issues cleaning up after repeating tasks.

A mass of NullPointerExceptions would be outputted when tasks were stopped. This is resolved by checking if we are still running (indicating a possible scheduler cancel) before telling the scheduler to pull the plug.

Ideally, the entire BungeeCord scheduler should be rewritten. It has quite a few issues which could be avoided with a new system.
This commit is contained in:
Tux 2014-12-13 23:42:44 -05:00 committed by md_5
parent 02d3660f32
commit 36c4af35de

View File

@ -76,6 +76,11 @@ public class BungeeTask implements Runnable, ScheduledTask
}
}
sched.cancel( this );
// We might have been previously running before, but now we aren't.
// If we weren't already cancelled, then cancel ourselves.
if ( running.get() )
{
sched.cancel( this );
}
}
}