Show message when report has been closed
Also run Bukkit API methods synchronously.
This commit is contained in:
parent
e26ced1438
commit
400a6adab2
@ -11,6 +11,7 @@ import mineplex.core.chatsnap.command.PushSnapshotsCommand;
|
||||
import mineplex.core.chatsnap.command.PushSnapshotsHandler;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.BukkitFuture;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.portal.Portal;
|
||||
@ -200,13 +201,22 @@ public class ReportManager
|
||||
|
||||
if (reportCloser != null)
|
||||
{
|
||||
Optional<String> reasonOptional = reportResult.getReason();
|
||||
String reason = reasonOptional.isPresent() ? reasonOptional.get() : "No reason specified.";
|
||||
BukkitFuture.run(() ->
|
||||
{
|
||||
Optional<String> reasonOptional = reportResult.getReason();
|
||||
String prefix = getReportPrefix(reportId);
|
||||
String reason = reasonOptional.isPresent() ? reasonOptional.get() : "No reason specified.";
|
||||
|
||||
// todo new punish gui
|
||||
CommandCenter.Instance.onPlayerCommandPreprocess(
|
||||
new PlayerCommandPreprocessEvent(reportCloser,
|
||||
String.format("/punish %s Report #%s - %s", suspectName, reportId, reason)));
|
||||
reportCloser.sendMessage(
|
||||
F.main(prefix,
|
||||
C.cGreen + "Report marked as: " + C.cGold + reportResult.getType().getName()));
|
||||
reportCloser.sendMessage(F.main(prefix, C.cGold + reason));
|
||||
|
||||
// todo new punish gui
|
||||
CommandCenter.Instance.onPlayerCommandPreprocess(
|
||||
new PlayerCommandPreprocessEvent(reportCloser,
|
||||
String.format("/punish %s Report #%s - %s", suspectName, reportId, reason)));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -412,7 +412,7 @@ public class ReportRepository
|
||||
PreparedStatement setReportResultStatement = connection.prepareStatement(SET_REPORT_RESULT);
|
||||
ReportResult reportResult = reportResultOptional.get();
|
||||
setReportResultStatement.setLong(1, reportId); // report id
|
||||
setReportResultStatement.setInt(2, reportResult.getResultType().getId()); // result id
|
||||
setReportResultStatement.setInt(2, reportResult.getType().getId()); // result id
|
||||
setReportResultStatement.setString(3, reportResult.getReason().orElse(null)); // reason
|
||||
setReportResultStatement.setTimestamp(4, new Timestamp(reportResult.getClosedTime().getTime())); // closed time
|
||||
setReportResultStatement.execute();
|
||||
|
@ -24,7 +24,7 @@ public class ReportResult
|
||||
_closedTime = closedTime;
|
||||
}
|
||||
|
||||
public ReportResultType getResultType()
|
||||
public ReportResultType getType()
|
||||
{
|
||||
return _resultType;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.report;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* Contains all possible outcomes for a report.
|
||||
*/
|
||||
@ -12,11 +14,13 @@ public enum ReportResultType
|
||||
|
||||
private final int _id;
|
||||
private final boolean _globalStat;
|
||||
private final String _name;
|
||||
|
||||
ReportResultType(int id, boolean globalStat)
|
||||
{
|
||||
_id = id;
|
||||
_globalStat = globalStat;
|
||||
_name = StringUtils.capitalize(name().toLowerCase().replace('_', ' '));
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@ -29,6 +33,11 @@ public enum ReportResultType
|
||||
return _globalStat;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public static ReportResultType getById(int id)
|
||||
{
|
||||
for (ReportResultType resultType : values())
|
||||
|
@ -22,7 +22,7 @@ public class ReportCloseCommand extends CommandBase<ReportPlugin>
|
||||
@Override
|
||||
public void Execute(final Player player, final String[] args)
|
||||
{
|
||||
if(args == null || args.length < 2)
|
||||
if (args == null || args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Your arguments are inappropriate for this command!"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user