PC-958 Allow reporting of offline players

This commit is contained in:
Keir Nellyer 2016-09-07 09:50:10 +01:00
parent 353cdb2413
commit 640a8d3516
2 changed files with 5 additions and 4 deletions

View File

@ -118,6 +118,7 @@ public class ReportManager
*/
public CompletableFuture<Report> createReport(int reporterId, int suspectId, ReportCategory category, String message)
{
// TODO only allow report if suspect actually did something
return _reportRepository.getOngoingReport(suspectId, category)
.thenCompose(reportIdOptional ->
reportIdOptional.isPresent() ? _reportRepository

View File

@ -47,6 +47,7 @@ public class ReportCommand extends CommandBase<ReportPlugin>
else
{
CoreClientManager clientManager = _commandCenter.GetClientManager();
int reporterId = clientManager.getAccountId(reporter);
String playerName = args[0];
Player suspect = UtilPlayer.searchOnline(reporter, playerName, false);
String reason = F.combine(args, 1, null, false);
@ -60,18 +61,17 @@ public class ReportCommand extends CommandBase<ReportPlugin>
}
else
{
int reporterId = clientManager.getAccountId(reporter);
CoreClient suspectClient = clientManager.Get(suspect);
new ReportCategoryPage(Plugin, reporter, reporterId, suspectClient, reason).openInventory();
}
}
else
{
clientManager.loadClientByName(playerName, client ->
clientManager.loadClientByName(playerName, suspectClient ->
{
if (client != null)
if (suspectClient != null)
{
// TODO report category page
new ReportCategoryPage(Plugin, reporter, reporterId, suspectClient, reason).openInventory();
}
else
{