From 1c0c28f5b143c8528fabc9082a261c2edd8460ca Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 31 Mar 2015 16:48:07 +1100 Subject: [PATCH] Fixes #226 --- .../java/com/intellectualcrafters/plot/commands/Comment.java | 2 +- .../java/com/intellectualcrafters/plot/commands/Inbox.java | 4 ++-- .../src/main/java/com/intellectualcrafters/plot/config/C.java | 1 + .../com/intellectualcrafters/plot/database/SQLManager.java | 2 +- .../com/intellectualcrafters/plot/object/PlotComment.java | 4 +++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java index 80c96a598..1ee41dbde 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java @@ -53,7 +53,7 @@ public class Comment extends SubCommand { if ((args.length > 1) && recipients.contains(args[0].toLowerCase())) { if (Permissions.hasPermission(plr, "plots.comment." + args[0].toLowerCase())) { final String text = StringUtils.join(Arrays.copyOfRange(args, 1, args.length), " "); - final PlotComment comment = new PlotComment(text, plr.getName(), recipients.indexOf(args[0].toLowerCase())); + final PlotComment comment = new PlotComment(plot.id, text, plr.getName(), recipients.indexOf(args[0].toLowerCase())); plot.settings.addComment(comment); DBFunc.setComment(loc.getWorld(), plot, comment); return sendMessage(plr, C.COMMENT_ADDED); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java index efce9a794..41f07221f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java @@ -171,11 +171,11 @@ public class Inbox extends SubCommand { } else { final List recipients = Arrays.asList("A", "O", "H", "T", "E"); int count = 1; - final StringBuilder message = new StringBuilder(); + final StringBuilder message = new StringBuilder(C.COMMENT_HEADER.s()+"\n"); String prefix = ""; for (final PlotComment comment : comments) { message.append(prefix).append("&c[").append(count).append("]&6[").append(recipients.get(tier2 == -1 ? 0 : tier2)).append("] &7").append(comment.senderName).append("&f: ").append(comment.comment); - prefix = "\n" + C.PREFIX; + prefix = "\n" + comment.id; count++; } if (comments.size() == 0) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java index a15aa7dd0..911aca4be 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -107,6 +107,7 @@ public enum C { INVALID_INBOX("$2That is not a valid inbox.\n$1Accepted values: %s"), COMMENT_REMOVED("$4Successfully deleted %s."), COMMENT_ADDED("$4A comment has been left"), + COMMENT_HEADER("$2====== Comments ======"), /* * Console */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 605fd2ade..6ca05b1ea 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -1084,7 +1084,7 @@ public class SQLManager implements AbstractDB { while (set.next()) { final String sender = set.getString("sender"); final String msg = set.getString("comment"); - comment = new PlotComment(msg, sender, tier); + comment = new PlotComment(plot.id, msg, sender, tier); comments.add(comment); } statement.close(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java index 5c5409437..2e711a496 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java @@ -27,8 +27,10 @@ public class PlotComment { public final String comment; public final int tier; public final String senderName; + public final PlotId id; - public PlotComment(final String comment, final String senderName, final int tier) { + public PlotComment(final PlotId id, final String comment, final String senderName, final int tier) { + this.id = id; this.comment = comment; this.tier = tier; this.senderName = senderName;