From 1c49e3a111ed32babba58903a25c933221da2e7e Mon Sep 17 00:00:00 2001 From: Keir Date: Sun, 10 Jan 2016 21:28:57 +0000 Subject: [PATCH] Make chat log clickable, only close report instruction line suggests command. --- .../report/task/ReportHandlerMessageTask.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java b/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java index 630885704..f9ec06cdd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/task/ReportHandlerMessageTask.java @@ -21,7 +21,7 @@ import org.apache.commons.lang3.StringUtils; */ public class ReportHandlerMessageTask extends BukkitRunnable { - private static final String BORDER = C.cAqua + "------------------------------------"; + private static final String DECORATION = C.cAqua + "------------------------------------"; private ReportManager _reportManager; private Report _report; @@ -41,19 +41,21 @@ public class ReportHandlerMessageTask extends BukkitRunnable { String suspectName = Bukkit.getOfflinePlayer(_report.getSuspect()).getName(); - JsonMessage jsonMessage = new JsonMessage(BORDER - + "\n" - + C.cAqua + "Reviewing Ticket " + C.cGold + "#" + reportId - + "\n\n" - + C.cPurple + StringUtils.join(getReportReasons(), "\n" + C.cPurple) - + "\n\n" - + C.cAqua + "Suspect: " + C.cGold + suspectName - + "\n" - + (_report.hasToken() ? C.cAqua + "Chat Log: " + C.cGold + SnapshotPublisher.getURL(_report.getToken()) + "\n" : "") - + "\n" - + C.cAqua + "Type " + C.cGold + "/reportclose " + reportId + " " + C.cAqua + " to close this report." - + "\n" - + BORDER).click(ClickEvent.SUGGEST_COMMAND, "/reportclose " + reportId); + JsonMessage jsonMessage = new JsonMessage(DECORATION) + .extra("\n") + .add(C.cAqua + "Reviewing Ticket " + C.cGold + "#" + reportId) + .add("\n\n") + .add(C.cPurple + StringUtils.join(getReportReasons(), "\n" + C.cPurple)) + .add("\n\n") + .add(C.cAqua + "Suspect: " + C.cGold + suspectName) + .add("\n") + .add((_report.hasToken() ? C.cAqua + "Chat Log: " + C.cGold + "Click Here" + "\n" : "")) + .click(ClickEvent.OPEN_URL, SnapshotPublisher.getURL(_report.getToken())) + .add("\n") + .add(C.cAqua + "Type " + C.cGold + "/reportclose " + reportId + " " + C.cAqua + " to close this report.") + .click(ClickEvent.SUGGEST_COMMAND, "/reportclose " + reportId) + .add("\n") + .add(DECORATION); new ReportHandlerNotification(_report, jsonMessage).publish(); }