Only allow 1 player at a time to handle a report.

This commit is contained in:
Keir 2015-11-11 19:05:29 +00:00
parent d7ba2e4731
commit f2e88c1c54
2 changed files with 20 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package mineplex.core.report;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mineplex.serverdata.data.Data;
@ -22,6 +23,10 @@ public class Report implements Data
public Set<String> getReporters() { return _reporters; }
public void addReporter(String reporter) { _reporters.add(reporter); }
private String _handler = null;
public void setHandler(String handler) { _handler = handler; }
public String getHandler() { return _handler; }
private Category _category;
public Category getCategory() { return _category; }

View File

@ -9,6 +9,7 @@ import mineplex.core.command.CommandCenter;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.report.command.ReportNotificationCallback;
@ -110,15 +111,22 @@ public class ReportManager {
if (_reportRepository.elementExists(String.valueOf(reportId)))
{
Report report = getReport(reportId);
Portal.transferPlayer(reportHandler.getName(), report.getServerName());
String handlerName = reportHandler.getName();
sendReportNotification(String.format("[Report %d] %s is handling this report.", reportId, handlerName));
// TODO: Send display message to handler when they arrive on the server
// with info about the case/report.
if (report.getPlayerName() != null) {
reportHandler.sendMessage(C.cRed + "Someone is already handling this report.");
} else {
String handlerName = reportHandler.getName();
report.setHandler(handlerName);
int handlerId = getPlayerAccount(reportHandler).getAccountId();
_reportSqlRepository.logReportHandling(reportId, handlerId); // Log handling into sql database
sendReportNotification(String.format("[Report %d] %s is handling this report.", reportId, handlerName));
Portal.transferPlayer(reportHandler.getName(), report.getServerName());
// TODO: Send display message to handler when they arrive on the server
// with info about the case/report.
int handlerId = getPlayerAccount(reportHandler).getAccountId();
_reportSqlRepository.logReportHandling(reportId, handlerId); // Log handling into sql database
}
}
}