#2520: Fix ConcurrentModificationException when tasks are cancelled during shutdown

This commit is contained in:
JoJoDeveloping 2018-08-28 09:25:50 +02:00 committed by md_5
parent 1bb826109c
commit 16b3490576

View File

@ -62,10 +62,13 @@ public class BungeeScheduler implements TaskScheduler
public int cancel(Plugin plugin)
{
Set<ScheduledTask> toRemove = new HashSet<>();
synchronized ( lock )
{
for ( ScheduledTask task : tasksByPlugin.get( plugin ) )
{
toRemove.add( task );
}
}
for ( ScheduledTask task : toRemove )
{
cancel( task );