Wait until report data has been saved to the database, otherwise the

message task will not function until it's second iteration
This commit is contained in:
Keir Nellyer 2016-07-09 15:32:46 -04:00
parent 400a6adab2
commit d7736e9e02

View File

@ -156,14 +156,18 @@ public class ReportManager
pushCommand.publish();
}
saveReport(report);
// Wait until this has been pushed to the database, otherwise the message task
// will not function correctly
saveReport(report).thenAccept(reportId2 ->
{
// Show user details of the report every x seconds
new ReportHandlerMessageTask(this, report).runTaskTimer(_plugin, 1L, 20L * 10);
});
Portal.transferPlayer(reportHandler.getName(), report.getLatestMessage().getServer());
reportHandler.sendMessage(
F.main(getReportPrefix(reportId), C.cAqua + "You are now handling this report."));
// Show user details of the report every x seconds
new ReportHandlerMessageTask(this, report).runTaskTimer(_plugin, 0L, 20L * 10);
}
}