Only notify staff when a report count reaches a certain amount (3 for hacking, 1 for chat abuse).

This commit is contained in:
Keir 2015-11-13 01:27:34 +00:00
parent a6d3ba10c2
commit bf81c26874
2 changed files with 15 additions and 8 deletions

View File

@ -15,20 +15,22 @@ public enum ReportCategory
{ {
// descriptions borrowed from PunishPage // descriptions borrowed from PunishPage
HACKING(0, Material.IRON_SWORD, C.cRedB + "Hacking", "X-ray, Forcefield, Speed, Fly etc"), HACKING(0, 3, Material.IRON_SWORD, C.cRedB + "Hacking", "X-ray, Forcefield, Speed, Fly etc"),
CHAT_ABUSE(1, Material.BOOK_AND_QUILL, C.cDBlueB + "Chat Abuse", "Verbal Abuse, Spam, Harassment, Trolling, etc"); CHAT_ABUSE(1, 1, Material.BOOK_AND_QUILL, C.cDBlueB + "Chat Abuse", "Verbal Abuse, Spam, Harassment, Trolling, etc");
private int _id; private int _id;
private int _notifyThreshold;
private Material _displayMaterial; private Material _displayMaterial;
private String _title; private String _title;
private List<String> _lore; private List<String> _lore;
ReportCategory(int id, Material displayMaterial, String title, String... lore) ReportCategory(int id, int notifyThreshold, Material displayMaterial, String title, String... lore)
{ {
this._id = id; _id = id;
this._displayMaterial = displayMaterial; _notifyThreshold = notifyThreshold;
this._title = title; _displayMaterial = displayMaterial;
this._lore = new ArrayList<>(); _title = title;
_lore = new ArrayList<>();
// prefix are lore lines // prefix are lore lines
for (String loreLine : lore) { for (String loreLine : lore) {
@ -41,6 +43,11 @@ public enum ReportCategory
return _id; return _id;
} }
public int getNotifyThreshold()
{
return _notifyThreshold;
}
public Material getItemMaterial() public Material getItemMaterial()
{ {
return _displayMaterial; return _displayMaterial;

View File

@ -157,7 +157,7 @@ public class ReportManager {
_reportRepository.addElement(report); // add (or update) the report to Redis _reportRepository.addElement(report); // add (or update) the report to Redis
// only start notifying staff when // only start notifying staff when
if (report.getReporters().size() >= 1) if (report.getReporters().size() >= category.getNotifyThreshold())
{ {
String prefix = getReportPrefix(reportId); String prefix = getReportPrefix(reportId);