Update report message if a player reports another player multiple times
This commit is contained in:
parent
103f31afc1
commit
976e8788b7
@ -1,7 +1,6 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
@ -82,10 +82,10 @@ public class ReportManager
|
||||
* @param reporter the player creating the report
|
||||
* @param suspect the player that is being reported
|
||||
* @param category the category of the report
|
||||
* @param reason the reason this player reported the other
|
||||
* @param message the reason this player reported the other
|
||||
* @return a future which when completed contains a {@link Report} instance of the report just created or added to
|
||||
*/
|
||||
public CompletableFuture<Report> createReport(Player reporter, Player suspect, ReportCategory category, String reason)
|
||||
public CompletableFuture<Report> createReport(Player reporter, Player suspect, ReportCategory category, String message)
|
||||
{
|
||||
int reporterId = _clientManager.Get(reporter).getAccountId();
|
||||
int suspectId = _clientManager.Get(suspect).getAccountId();
|
||||
@ -97,7 +97,18 @@ public class ReportManager
|
||||
{
|
||||
if (report != null)
|
||||
{
|
||||
report.addReportReason(new ReportMessage(reporterId, reason, _serverName, _serverWeight));
|
||||
ReportMessage reportMessage = report.getReportMessage(reporterId);
|
||||
|
||||
if (reportMessage != null)
|
||||
{
|
||||
reportMessage.setMessage(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
reportMessage = new ReportMessage(reporterId, message, _serverName, _serverWeight);
|
||||
report.addReportReason(reportMessage);
|
||||
}
|
||||
|
||||
saveReport(report).join();
|
||||
}
|
||||
});
|
||||
|
@ -53,6 +53,16 @@ public class Report
|
||||
_reportMessages.put(reportMessage.getReporterId(), reportMessage);
|
||||
}
|
||||
|
||||
public Map<Integer, ReportMessage> getReportMessages()
|
||||
{
|
||||
return _reportMessages;
|
||||
}
|
||||
|
||||
public ReportMessage getReportMessage(int accountId)
|
||||
{
|
||||
return _reportMessages.get(accountId);
|
||||
}
|
||||
|
||||
public Set<Integer> getReporterIds()
|
||||
{
|
||||
return _reportMessages.keySet();
|
||||
|
@ -46,6 +46,11 @@ public class ReportMessage
|
||||
return _message;
|
||||
}
|
||||
|
||||
public void setMessage(String message)
|
||||
{
|
||||
_message = message;
|
||||
}
|
||||
|
||||
public String getServer()
|
||||
{
|
||||
return _server;
|
||||
|
Loading…
Reference in New Issue
Block a user