Players should still be report banned if they reach abuse threshold

even if reportCloser is not present

Also alert players of report closing regardless of whether
reportCloser is present
This commit is contained in:
Keir Nellyer 2016-09-28 10:40:39 +01:00
parent 84e1a7291b
commit 6f77c05f1e

View File

@ -266,25 +266,26 @@ public class ReportManager
saveCompletableFuture.thenAccept(reportId ->
{
if (reportCloser != null)
if (reportResult.getType() == ReportResultType.ABUSIVE)
{
if (reportResult.getType() == ReportResultType.ABUSIVE)
{
// if report was marked abusive, check if each of the reporters
// should be banned from using the report system
report.getReporterIds().forEach(reporterId ->
_reportRepository.getAccountUUID(reporterId).thenAccept(reporterUUID ->
{
CoreClient reporterClient = _clientManager.Get(reporterUUID);
checkAbuseBan(reporterClient, reportCloser, reportId);
}));
}
// if report was marked abusive, check if each of the reporters
// should be banned from using the report system
report.getReporterIds().forEach(reporterId ->
_reportRepository.getAccountUUID(reporterId).thenAccept(reporterUUID ->
{
CoreClient reporterClient = _clientManager.Get(reporterUUID);
checkAbuseBan(reporterClient, reportCloser, reportId);
}));
}
Bukkit.getScheduler().runTask(_plugin, () ->
Bukkit.getScheduler().runTask(_plugin, () ->
{
Optional<String> reasonOptional = reportResult.getReason();
String prefix = getReportPrefix(reportId);
String reason = reasonOptional.isPresent() ? reasonOptional.get() : "No reason specified.";
if (reportCloser != null)
{
Optional<String> reasonOptional = reportResult.getReason();
String prefix = getReportPrefix(reportId);
String reason = reasonOptional.isPresent() ? reasonOptional.get() : "No reason specified.";
if (reportResult.getType() == ReportResultType.ACCEPTED)
{
@ -299,27 +300,27 @@ public class ReportManager
F.main(prefix, "Report marked as: "
+ C.cGold + reportResult.getType().getName()));
reportCloser.sendMessage(F.main(prefix, "Reason: " + F.elem(reason)));
}
getUUIDs(report.getReporterIds()).thenAccept(ids ->
getUUIDs(report.getReporterIds()).thenAccept(ids ->
{
ReportResultType resultType = reportResult.getType();
ChildJsonMessage jsonMessage = new JsonMessage(F.main(
prefix,
"Your report against " + F.elem(suspectName) + " was marked as " + F.elem(resultType.getName()) + "."))
.extra("\n");
if (resultType == ReportResultType.ABUSIVE)
{
ReportResultType resultType = reportResult.getType();
ChildJsonMessage jsonMessage = new JsonMessage(F.main(
prefix,
"Your report against " + F.elem(suspectName) + " was marked as " + F.elem(resultType.getName()) + "."))
.extra("\n");
jsonMessage = jsonMessage.add(F.main(prefix, C.cRed + "Submitting false reports may result in punishment."))
.add("\n");
}
if (resultType == ReportResultType.ABUSIVE)
{
jsonMessage = jsonMessage.add(F.main(prefix, C.cRed + "Submitting false reports may result in punishment."))
.add("\n");
}
jsonMessage = jsonMessage.add(F.main(prefix, "Reason: " + F.elem(reason)));
jsonMessage = jsonMessage.add(F.main(prefix, "Reason: " + F.elem(reason)));
new ReportersNotification(ids, jsonMessage).publish();
});
new ReportersNotification(ids, jsonMessage).publish();
});
}
});
_reportRepository.clearCache(reportId);
}).exceptionally(throwable -> {