diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java index 0bcfc8cef..97c771422 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportPlugin.java @@ -26,9 +26,8 @@ public class ReportPlugin extends MiniPlugin _reportManager = reportManager; // purge old reports every minute - // TODO does this need to be async? _reportPurgeTask = new ReportPurgeTask(_reportManager); - _reportPurgeTask.runTaskTimer(getPlugin(), 20L * 10, 20L * 60); + _reportPurgeTask.runTaskTimerAsynchronously(getPlugin(), 20L * 10, 20L * 60); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportPurgeTask.java b/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportPurgeTask.java index 558d67f76..644fc1726 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportPurgeTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportPurgeTask.java @@ -1,5 +1,7 @@ package mineplex.core.report.task; +import java.util.ArrayList; + import org.bukkit.scheduler.BukkitRunnable; import mineplex.core.common.util.C; @@ -21,7 +23,7 @@ public class ReportPurgeTask extends BukkitRunnable @Override public void run() { - for (int reportId : _reportManager.getActiveReports()) + for (int reportId : new ArrayList<>(_reportManager.getActiveReports())) // create copy as this will be run async { Report report = _reportManager.getReport(reportId);