Skip to content

Commit

Permalink
Allow clicking on /reports list
Browse files Browse the repository at this point in the history
This will run /reports info <id> on each report

Part of #763
  • Loading branch information
confuser committed Apr 7, 2018
1 parent 5ec209c commit a59bc8a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/me/confuser/banmanager/util/CommandUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import me.confuser.banmanager.data.PlayerReportData;
import me.confuser.banmanager.util.parsers.Reason;
import me.confuser.bukkitutil.Message;
import me.rayzr522.jsonmessage.JSONMessage;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.FastDateFormat;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -202,7 +203,7 @@ public static void sendReportList(ReportList reports, CommandSender sender, int
.sendTo(sender);

for (PlayerReportData report : reports.getList()) {
Message.get("report.list.row.all")
String message = Message.get("report.list.row.all")
.set("id", report.getId())
.set("state", report.getState().getName())
.set("player", report.getPlayer().getName())
Expand All @@ -211,8 +212,13 @@ public static void sendReportList(ReportList reports, CommandSender sender, int
.set("created", dateFormatter
.format(report.getCreated() * 1000L))
.set("updated", dateFormatter
.format(report.getUpdated() * 1000L))
.sendTo(sender);
.format(report.getUpdated() * 1000L)).toString();

if (sender instanceof Player) {
JSONMessage.create(message).runCommand("/reports info " + report.getId()).send((Player) sender);
} else {
sender.sendMessage(message);
}
}
}

Expand Down

0 comments on commit a59bc8a

Please sign in to comment.